当前位置: 首页>>代码示例>>Java>>正文


Java WaitForAsyncUtils类代码示例

本文整理汇总了Java中org.testfx.util.WaitForAsyncUtils的典型用法代码示例。如果您正苦于以下问题:Java WaitForAsyncUtils类的具体用法?Java WaitForAsyncUtils怎么用?Java WaitForAsyncUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WaitForAsyncUtils类属于org.testfx.util包,在下文中一共展示了WaitForAsyncUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testNetworkTableSourceContextMenu

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
@Tag("NonHeadlessTests")
public void testNetworkTableSourceContextMenu() {
  NetworkTableInstance inst = NetworkTableInstance.getDefault();
  inst.getEntry("/testSourceContextMenu").setString("value");
  inst.waitForEntryListenerQueue(-1.0);
  WaitForAsyncUtils.waitForFxEvents();

  rightClickOn(NodeMatchers.hasText("testSourceContextMenu"));
  Node showAsText = lookup(NodeMatchers.hasText("Show as: Text View")).query();
  assertNotNull(showAsText);
  clickOn(showAsText);

  WidgetTile tile = lookup(".tile").query();
  assertNotNull(tile);
  Widget widget = tile.getContent();
  DataSource source = widget.getSources().get(0);
  assertTrue(source.isActive());
  assertEquals("testSourceContextMenu", source.getName());
  assertEquals("value",source.getData());
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:22,代码来源:MainWindowControllerTest.java

示例2: testShouldCreateNewOperationInPipelineView

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
public void testShouldCreateNewOperationInPipelineView() {
  // Given:
  clickOn(addOperation.getDescription().name());

  WaitForAsyncUtils.waitForFxEvents();

  // Then:
  final String cssSelector = "." + StyleClassNameUtility.classNameForStepHolding(addOperation
      .getDescription());
  verifyThat(cssSelector, NodeMatchers.isNotNull());
  verifyThat(cssSelector, NodeMatchers.isVisible());

  assertEquals(STEP_NOT_ADDED_MSG, 1, pipeline.getSteps().size());
  assertEquals("Step added was not this addOperation", AddOperation.DESCRIPTION, pipeline
      .getSteps().get(0).getOperationDescription());
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:18,代码来源:MainWindowTest.java

示例3: testDragOperationFromPaletteToPipeline

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
public void testDragOperationFromPaletteToPipeline() {
  // Given:
  drag(addOperation.getDescription().name())
      .dropTo(".steps");

  WaitForAsyncUtils.waitForFxEvents();

  // Then:
  final String cssSelector = "." + StyleClassNameUtility.classNameForStepHolding(addOperation
      .getDescription());
  verifyThat(cssSelector, NodeMatchers.isNotNull());
  verifyThat(cssSelector, NodeMatchers.isVisible());

  assertEquals(STEP_NOT_ADDED_MSG, 1, pipeline.getSteps().size());
  assertEquals("Step added was not this addOperation", AddOperation.DESCRIPTION, pipeline
      .getSteps().get(0).getOperationDescription());
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:19,代码来源:MainWindowTest.java

示例4: testDragOperationFromPaletteToLeftOfExistingStep

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
public void testDragOperationFromPaletteToLeftOfExistingStep() {
  // Run the same test as before
  testDragOperationFromPaletteToPipeline();

  // Now add a second step before it
  drag(additionOperation.getDescription().name())
      // We drag to the input socket hint handle because this will always be on the left side
      // of the
      // step. This should cause the UI to put the new step on the left side
      .dropTo(StyleClassNameUtility.cssSelectorForInputSocketHandleOnStepHolding(addOperation
          .getDescription()));

  WaitForAsyncUtils.waitForFxEvents();

  // Then:
  final String cssSelector = "." + StyleClassNameUtility
      .classNameForStepHolding(additionOperation.getDescription());
  verifyThat(cssSelector, NodeMatchers.isNotNull());
  verifyThat(cssSelector, NodeMatchers.isVisible());

  assertEquals(STEP_NOT_ADDED_MSG, 2, pipeline.getSteps().size());
  assertEquals("Step added was not added in the right place in the pipeline",
      AdditionOperation.DESCRIPTION, pipeline.getSteps().get(0).getOperationDescription());
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:26,代码来源:MainWindowTest.java

示例5: testDragOperationFromPaletteToRightOfExistingStep

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
public void testDragOperationFromPaletteToRightOfExistingStep() {
  // Run the same test as before
  testDragOperationFromPaletteToPipeline();

  // Now add a second step after it
  drag(additionOperation.getDescription().name())
      // We drag to the output socket hint handle because this will always be on the right side
      // of the
      // step. This should cause the UI to put the new step on the right side
      .dropTo(StyleClassNameUtility.cssSelectorForOutputSocketHandleOnStepHolding(addOperation
          .getDescription()));

  WaitForAsyncUtils.waitForFxEvents();

  // Then:
  final String cssSelector = "." + StyleClassNameUtility
      .classNameForStepHolding(additionOperation.getDescription());
  verifyThat(cssSelector, NodeMatchers.isNotNull());
  verifyThat(cssSelector, NodeMatchers.isVisible());

  assertEquals(STEP_NOT_ADDED_MSG, 2, pipeline.getSteps().size());
  assertEquals("Step added was not added in the right place in the pipeline",
      AdditionOperation.DESCRIPTION, pipeline.getSteps().get(1).getOperationDescription());
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:26,代码来源:MainWindowTest.java

示例6: testCreatesSourceStarted

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
public void testCreatesSourceStarted() throws Exception {
  // When
  Platform.runLater(() -> addSourceView.getWebcamButton().fire());
  WaitForAsyncUtils.waitForFxEvents();
  verifyThat("." + AddSourceButton.SOURCE_DIALOG_STYLE_CLASS, NodeMatchers.isVisible());

  clickOn("OK");
  WaitForAsyncUtils.waitForFxEvents();

  // Then
  Optional<CameraSource> cameraSource = mockCameraSourceFactory.lastSourceCreated;
  assertTrue("A source was not constructed", cameraSource.isPresent());
  assertTrue("A source was not created started", cameraSource.get().isRunning());
  verifyThat("." + AddSourceButton.SOURCE_DIALOG_STYLE_CLASS, NodeMatchers.isNull());
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:17,代码来源:AddSourceButtonTest.java

示例7: testCreatesSourceStartedFails

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
public void testCreatesSourceStartedFails() throws Exception {
  // When
  Platform.runLater(() -> addSourceView.getWebcamButton().fire());
  WaitForAsyncUtils.waitForFxEvents();
  verifyThat("." + AddSourceButton.SOURCE_DIALOG_STYLE_CLASS, NodeMatchers.isVisible());

  clickOn("OK");
  WaitForAsyncUtils.waitForFxEvents();

  // Then
  Optional<CameraSource> cameraSource = mockCameraSourceFactory.lastSourceCreated;
  assertTrue("A source was not constructed", cameraSource.isPresent());
  assertFalse("A source was not created but should not have been started", cameraSource.get()
      .isRunning());
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:17,代码来源:AddSourceButtonTest.java

示例8: listenerAddedTwiceIsCalledTest

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
public void listenerAddedTwiceIsCalledTest() {
  AsyncProperty<String> asyncProperty = new AsyncProperty<>();
  CompletableFuture<Boolean> listenerFired = new CompletableFuture<>();
  ChangeListener<String> listener = (observable, oldValue, newValue) -> listenerFired.complete(true);

  asyncProperty.addListener(listener);
  asyncProperty.addListener(listener);
  asyncProperty.set("Value");
  WaitForAsyncUtils.waitForFxEvents();

  assertTrue(listenerFired.getNow(false));
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:14,代码来源:AsyncPropertyTest.java

示例9: removeListenerTest

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
public void removeListenerTest() {
  AsyncProperty<String> asyncProperty = new AsyncProperty<>();
  CompletableFuture<Boolean> listenerFired = new CompletableFuture<>();
  ChangeListener<String> listener = (observable, oldValue, newValue) -> listenerFired.complete(true);

  asyncProperty.addListener(listener);
  asyncProperty.removeListener(listener);
  asyncProperty.set("Value");
  WaitForAsyncUtils.waitForFxEvents();

  assertThrows(TimeoutException.class, () -> listenerFired.get(1, TimeUnit.SECONDS));
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:14,代码来源:AsyncPropertyTest.java

示例10: setRunsOnFxThreadTest

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
public void setRunsOnFxThreadTest() throws Throwable {
  AsyncProperty<String> property = new AsyncProperty<>();
  Platform.runLater(() -> label.textProperty().bind(property));
  WaitForAsyncUtils.waitForFxEvents();

  property.set("Test");
  WaitForAsyncUtils.waitForFxEvents();

  assertFalse(exceptionThrown.isDone(), exceptionThrown.getNow(new Throwable()).getMessage());
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:12,代码来源:AsyncPropertyTest.java

示例11: testDragSingleNetworkTableSourceToWidgetPane

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
public void testDragSingleNetworkTableSourceToWidgetPane() {
  NetworkTableInstance inst = NetworkTableInstance.getDefault();
  inst.getEntry("/a string source").setString("foo");
  inst.waitForEntryListenerQueue(-1.0);
  WaitForAsyncUtils.waitForFxEvents();

  drag(NodeMatchers.hasText("a string source"), MouseButton.PRIMARY)
      .dropTo(".widget-pane");

  WidgetTile tile = lookup(".widget-pane .tile").query();
  assertNotNull(tile);
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:14,代码来源:MainWindowControllerTest.java

示例12: testChangeTrueColor

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
@Disabled
public void testChangeTrueColor() {
  final Color color = Color.WHITE;
  widget.getSource().setData(true);
  widget.setTrueColor(color);
  WaitForAsyncUtils.waitForFxEvents();
  assertEquals(color, getBackground(), "Background was the wrong color");
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:10,代码来源:BooleanBoxWidgetTest.java

示例13: testChangeFalseColor

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
@Disabled
public void testChangeFalseColor() {
  widget.getSource().setData(false);
  widget.setFalseColor(Color.BLACK);
  WaitForAsyncUtils.waitForFxEvents();
  assertEquals(widget.getFalseColor(), getBackground(), "Background was the wrong color");
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:9,代码来源:BooleanBoxWidgetTest.java

示例14: testOptions

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
public void testOptions() {
  final String[] options = {"Foo", "Bar", "Baz"};
  SendableChooserData data = source.getData().withOptions(options);
  source.setData(data);
  WaitForAsyncUtils.waitForFxEvents();
  assertEquals(FXCollections.observableArrayList(options), widget.comboBox.getItems());
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:9,代码来源:ComboBoxChooserWidgetTest.java

示例15: testSelectDefaultWhenNotSelected

import org.testfx.util.WaitForAsyncUtils; //导入依赖的package包/类
@Test
public void testSelectDefaultWhenNotSelected() {
  widget.comboBox.getSelectionModel().select(null);
  WaitForAsyncUtils.waitForFxEvents();
  SendableChooserData data = source.getData().withDefaultOption("B");
  source.setData(data);
  WaitForAsyncUtils.waitForFxEvents();
  assertEquals("B", widget.comboBox.getSelectionModel().getSelectedItem());
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:10,代码来源:ComboBoxChooserWidgetTest.java


注:本文中的org.testfx.util.WaitForAsyncUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。