@Test public void typingACharMakesThePanelDirty() throws Exception { assertEquals(0, root.dirtyRegions.size()); model.setCaretLocation(TextLocation.origin); new CharTypedEvent(0, 'Z').dispatch(panel); assertEquals(1, root.dirtyRegions.size()); assertEquals(panel.getBounds(), root.dirtyRegions.get(0)); }
@Test public void canLoseFocus() { stage.getKeyListener().focusOn(panel); root.dirtyRegions.clear(); stage.getKeyListener().focusOn(root); assertEquals(false, panel.hasFocus()); assertEquals(false, panel.isCaretBlinking()); assertEquals(true, root.dirtyRegions.contains(panel.getBounds())); assertEquals(true, root.dirtyRegions.contains(parent.getBounds())); }
@Test public void canGainFocus() { assertEquals(0, root.dirtyRegions.size()); stage.getKeyListener().focusOn(panel); assertEquals(true, panel.hasFocus()); assertEquals(true, panel.isCaretBlinking()); assertEquals(true, root.dirtyRegions.contains(panel.getBounds())); assertEquals(true, root.dirtyRegions.contains(parent.getBounds())); }