public void testHasChangesWhenaTextIsChanged() throws Exception { TextPanel.staticFontRenderingContext = new FontRenderContext(new AffineTransform(), true, true); panel.doLayout(); panel.setText("blah"); assertEquals(true, panel.needsLayout()); panel.doLayout(); panel.setText("blah"); assertEquals(false, panel.needsLayout()); panel.setText("new text"); assertEquals(true, panel.needsLayout()); }
public void testText() throws Exception { panel.setText("blah"); assertEquals("blah", panel.getText()); assertEquals("blah", panel.getTextAccessor().getText()); panel.getTextAccessor().setText("foo"); assertEquals("foo", panel.getText()); }
public void testChangingTextColor() throws Exception { panel.setText("foo"); panel.resetLayout(); panel.styleChanged(Style.TEXT_COLOR, Style.TEXT_COLOR.compile("red")); assertEquals(true, panel.needsLayout()); }
public void testChangingFontStyle() throws Exception { panel.setText("foo"); panel.resetLayout(); panel.resetPendingSizeChange(); panel.styleChanged(Style.FONT_STYLE, Style.FONT_STYLE.compile("italic")); assertEquals(true, panel.needsLayout()); assertEquals(true, panel.sizeChangePending()); }
public void testKeyPressedForwardedToTextPanel() throws Exception { MockOS os = new MockOS(); Context.instance().os = os; KeyEvent event = new KeyEvent(new JPanel(), 1, 2, 3, 4, 'a'); panel.keyPressed(event); assertEquals(false, os.wasPrimaryModifierDownChecked()); panel.setText("foo"); panel.keyPressed(event); assertEquals(true, os.wasPrimaryModifierDownChecked()); }