@Test public void testSize() { CanvasContext ctx = new CanvasContext(); ctx.size(200, 300); assertEquals(200.0, ctx.getWIDTH()); assertEquals(300.0, ctx.getHeight()); assertEquals(200.0, ctx.getCanvas().getWidth()); assertEquals(300.0, ctx.getCanvas().getHeight()); }
@Test public void testInheritFromContext() { CanvasContext ctx = new CanvasContext(); Color c = new Color(); assertEquals(c, ctx.fill()); ctx.rect(0, 0, 100, 100); Path p = (Path) ctx.getCanvas().getItems().get(0); assertEquals(c, p.getFillColor()); Color red = new Color(1, 0, 0); ctx.fill(red); ctx.align(Text.Align.RIGHT); Text t = ctx.text("hello", 20, 20); assertEquals(red, t.getFillColor()); assertEquals(Text.Align.RIGHT, t.getAlign()); }