コード例 #1
0
  @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);
  }
コード例 #2
0
 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();
 }
コード例 #4
0
 @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);
 }
コード例 #5
0
  @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());
  }
コード例 #6
0
  @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);
  }
コード例 #7
0
 @Before
 public void setup() {
   // This step is not needed (Just to make sure StubToolkit is loaded into VM)
   tk = (StubToolkit) Toolkit.getToolkit();
 }