/** * The following method sets up the testing framework. It creates a TextFx object and places it * inside a layout. * */ @Before public void setUp() { scene = new SubScene(layout, 800, 600); text = new TextFx( 0, 0, 0.1, 0.8, 0.3, 0.2, "<b>Hello!</b> This <i>is</i> a <b><i>test</i></b>.", "Calibri", 12, Color.AQUAMARINE, 0); textFlow = (TextFlow) text.createContent(scene); System.out.println(text.getNumOfStyleChanges()); layout.getChildren().add(textFlow); }
/** The following method asserts the text properties of the test TestFx object */ @Test public void testFont() { assertEquals(text.getFontSize(), 12); assertEquals(text.getFont(), "Calibri"); assertEquals(text.getFontColour(), Color.AQUAMARINE); }
/** The following method asserts the successful formation of the test object */ @Test public void testContent() { assertEquals(text.getText(), "Hello! This is a test."); assertEquals(text.getNumOfStyleChanges(), 6, 0); }