@Ignore @Test public void setCurrentPageIndexAndNavigateWithMouse() { pagination.setPageCount(25); pagination.setPageFactory( new Callback<Integer, Node>() { @Override public Node call(Integer pageIndex) { Node n = createPage(pageIndex); return n; } }); root.setPrefSize(400, 400); root.getChildren().add(pagination); show(); root.impl_reapplyCSS(); root.layout(); tk.firePulse(); assertTrue(pagination.isFocused()); double xval = (pagination.localToScene(pagination.getLayoutBounds())).getMinX(); double yval = (pagination.localToScene(pagination.getLayoutBounds())).getMinY(); scene.impl_processMouseEvent( MouseEventGenerator.generateMouseEvent(MouseEvent.MOUSE_PRESSED, xval + 170, yval + 380)); tk.firePulse(); assertEquals(3, pagination.getCurrentPageIndex()); }
/** * ****************************************************************** Miscellaneous Tests * * ****************************************************************** */ @Test public void setCurrentPageIndexAndNavigateWithKeyBoard() { pagination.setPageCount(25); pagination.setPageFactory( new Callback<Integer, Node>() { @Override public Node call(Integer pageIndex) { Node n = createPage(pageIndex); return n; } }); root.setPrefSize(400, 400); root.getChildren().add(pagination); show(); tk.firePulse(); assertTrue(pagination.isFocused()); KeyEventFirer keyboard = new KeyEventFirer(pagination); keyboard.doRightArrowPress(); tk.firePulse(); assertEquals(1, pagination.getCurrentPageIndex()); keyboard.doRightArrowPress(); tk.firePulse(); assertEquals(2, pagination.getCurrentPageIndex()); }
@Test public void testDefaultCameraUpdatesPG() { Scene scene = new Scene(new Group(), 300, 200); stage.setScene(scene); Toolkit.getToolkit().firePulse(); Camera cam = scene.getEffectiveCamera(); cam.setNearClip(20); Toolkit.getToolkit().firePulse(); NGCamera camera = ((StubScene) scene.impl_getPeer()).getCamera(); assertEquals(20, camera.getNearClip(), 0.00001); }
protected void startApp(Parent root) { scene = new Scene(root, 800, 600); stage = new Stage(); stage.setScene(scene); stage.show(); tk.firePulse(); }
@Test public void pageCountIsLessThanMaxPageIndicatorCount_RT21660() { pagination.setPageCount(5); root.setPrefSize(400, 400); root.getChildren().add(pagination); show(); pagination.setCurrentPageIndex(4); tk.firePulse(); assertTrue(pagination.isFocused()); KeyEventFirer keyboard = new KeyEventFirer(pagination); keyboard.doRightArrowPress(); tk.firePulse(); assertEquals(4, pagination.getCurrentPageIndex()); }
private Label createNoExistingAssigneeLabel() { Label noExistingAssignee = new Label(MESSAGE_NO_ASSIGNEE); noExistingAssignee.setPrefHeight(40); FontLoader fontLoader = Toolkit.getToolkit().getFontLoader(); double width = fontLoader.computeStringWidth(noExistingAssignee.getText(), noExistingAssignee.getFont()); noExistingAssignee.setPrefWidth(width); return noExistingAssignee; }
@Before public void setup() { tk = (StubToolkit) Toolkit .getToolkit(); // This step is not needed (Just to make sure StubToolkit is loaded // into VM) node = new Rectangle(); separatorMenuItem = smi = new SeparatorMenuItem(); }
public void run(String arg) { Toolkit toolkit = Toolkit.getDefaultToolkit(); Image Image1 = toolkit.getImage(arg); imp = new ImagePlus("title", Image1); AffineTransform aTran = new AffineTransform(); if (imp.isComposite()) { int z = imp.getSlice(); int t = imp.getFrame(); ImagePlus[] channels = split(imp); imp.changes = false; imp.setIgnoreFlush(true); imp.close(); for (int i = 0; i < channels.length; i++) { channels[i].show(); if (z > 1 || t > 1) channels[i].setPosition(1, z, t); } } else if (imp.getType() == ImagePlus.COLOR_RGB) splitRGB(imp); else IJ.error("Split Channels", "Multichannel image required"); }
@Before public void setup() { pagination = new Pagination(); tk = (StubToolkit) Toolkit .getToolkit(); // This step is not needed (Just to make sure StubToolkit is loaded // into VM) root = new StackPane(); scene = new Scene(root); stage = new Stage(); stage.setScene(scene); }
@Test public void divideByZeroErrorWhenSizeIsSmall_RT22687() { pagination.setPageCount(15); root.setMaxSize(100, 200); root.getChildren().add(pagination); show(); try { KeyEventFirer keyboard = new KeyEventFirer(pagination); keyboard.doRightArrowPress(); tk.firePulse(); } catch (Exception e) { fail(); } assertEquals(1, pagination.getCurrentPageIndex()); }
@Test public void testSceneCursorChangePropagatesToScenePeer() { final StubToolkit toolkit = (StubToolkit) Toolkit.getToolkit(); final MouseEventGenerator generator = new MouseEventGenerator(); final Scene scene = new Scene(new Group(), 300, 200); stage.setScene(scene); scene.impl_processMouseEvent(generator.generateMouseEvent(MouseEvent.MOUSE_ENTERED, 100, 100)); toolkit.firePulse(); scene.setCursor(Cursor.TEXT); assertTrue(toolkit.isPulseRequested()); toolkit.firePulse(); assertSame(Cursor.TEXT.getCurrentFrame(), ((StubScene) scene.impl_getPeer()).getCursor()); }
@Test public void testCameraUpdatesPG() { Scene scene = new Scene(new Group(), 300, 200); Camera cam = new ParallelCamera(); stage.setScene(scene); scene.setCamera(cam); Toolkit.getToolkit().firePulse(); // verify it has correct owner cam.setNearClip(20); Toolkit.getToolkit().firePulse(); NGCamera ngCamera = ((StubScene) scene.impl_getPeer()).getCamera(); assertEquals(20, ngCamera.getNearClip(), 0.00001); scene.setCamera(null); Toolkit.getToolkit().firePulse(); // verify owner was removed cam.setNearClip(30); Toolkit.getToolkit().firePulse(); assertEquals(20, ngCamera.getNearClip(), 0.00001); scene.setCamera(cam); Toolkit.getToolkit().firePulse(); // verify it has correct owner cam.setNearClip(40); Toolkit.getToolkit().firePulse(); assertEquals(40, ngCamera.getNearClip(), 0.00001); NGCamera oldCam = ngCamera; scene.setCamera(new ParallelCamera()); Toolkit.getToolkit().firePulse(); // verify owner was removed cam.setNearClip(50); Toolkit.getToolkit().firePulse(); ngCamera = scene.getCamera().impl_getPeer(); assertEquals(40, oldCam.getNearClip(), 0.00001); assertEquals(0.1, ngCamera.getNearClip(), 0.00001); }
@Before public void setup() { // This step is not needed (Just to make sure StubToolkit is loaded into VM) tk = (StubToolkit) Toolkit.getToolkit(); }