本文整理汇总了Java中org.testfx.api.FxToolkit类的典型用法代码示例。如果您正苦于以下问题:Java FxToolkit类的具体用法?Java FxToolkit怎么用?Java FxToolkit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FxToolkit类属于org.testfx.api包,在下文中一共展示了FxToolkit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import org.testfx.api.FxToolkit; //导入依赖的package包/类
@Before
public void setup() throws Exception {
if (Platform.isFxApplicationThread()) throw new AssertionError("Invalid test state");
Thread.setDefaultUncaughtExceptionHandler(HANDLER);
FxToolkit.registerPrimaryStage();
// FxToolkit.registerStage(() -> new Stage(StageStyle.TRANSPARENT));
FxToolkit.setupSceneRoot(() -> {
if (!Platform.isFxApplicationThread()) throw new AssertionError("Invalid test state");
Thread.currentThread().setUncaughtExceptionHandler(HANDLER);
pane = target.createPane();
pane.setId(ID);
return pane;
});
FxToolkit.setupStage(Window::sizeToScene);
FxToolkit.showStage();
}
示例2: setup
import org.testfx.api.FxToolkit; //导入依赖的package包/类
@Before
public void setup() throws Exception {
FxToolkit.toolkitContext().setSetupTimeoutInMillis(60000);
FxToolkit.toolkitContext().setLaunchTimeoutInMillis(60000);
ApplicationTest.launch(FarmSimLauncher.class);
}
示例3: basicBeforeEach
import org.testfx.api.FxToolkit; //导入依赖的package包/类
/**
* Set up application before each test.
* Afterwards, calls the {@link #beforeEach()} method.
*
* @throws TimeoutException if unable to set up application
* @throws UIInitialisationException if ui was not properly initialized
* @see FxToolkit#setupApplication(Class, String...)
*/
@BeforeEach
public final void basicBeforeEach() throws TimeoutException, UIInitialisationException {
this.primaryStage = FxToolkit.registerPrimaryStage();
this.application = (Hygene) FxToolkit.setupApplication(Hygene.class);
this.context = Hygene.getInstance().getContext();
FxToolkit.showStage();
beforeEach();
}
示例4: basicAfterEach
import org.testfx.api.FxToolkit; //导入依赖的package包/类
/**
* Hide the application after each test.
* Afterwards, calls the {@link #afterEach()} method.
*
* @throws TimeoutException if unable to hide application
*/
@AfterEach
public final void basicAfterEach() throws TimeoutException, UIInitialisationException {
FxToolkit.cleanupApplication(Hygene.getInstance());
FxToolkit.cleanupStages();
afterEach();
}
示例5: afterEachTest
import org.testfx.api.FxToolkit; //导入依赖的package包/类
@After
public void afterEachTest() throws TimeoutException
{
FxToolkit.hideStage();
release(new KeyCode[]{});
release(new MouseButton[]{});
}
示例6: setUp
import org.testfx.api.FxToolkit; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
FxToolkit.registerPrimaryStage();
/* Retrieve the tested widgets from the GUI. */
incompleteBox = find("#incompleteBox");
overdueBox = find("#overdueBox");
upcomingBox = find("#upcomingBox");
allBox = find("#allBox");
completedBox = find("#completedBox");
searchBox = find("#searchBox");
surpriseBox = find("#surpriseBox");
helpBox = find("#helpBox");
incompleteTab = find("#incompleteTab");
overdueTab = find("#overdueTab");
upcomingTab = find("#upcomingTab");
allTab = find("#allTab");
completedTab = find("#completedTab");
searchTab = find("#searchTab");
surpriseTab = find("#surpriseTab");
helpTab = find("#helpTab");
incompleteCount = find("#incompleteCount");
overdueCount = find("#overdueCount");
upcomingCount = find("#upcomingCount");
dayDisplayer = find("#dayDisplayer");
listMain = find("#listMain");
fbArea = find("#fbArea");
cmdArea = find("#cmdArea");
helpContent = find("#helpContent");
surpriseOverlay = find("#surpriseOverlay");
surpriseTitle = find("#surpriseTitle");
taskDesc = find("#taskDesc");
taskTime = find("#taskTime");
surpriseBottom = find("#surpriseBottom");
noSurpriseOverlay = find("#noSurpriseOverlay");
}
示例7: tearDown
import org.testfx.api.FxToolkit; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
/* Close the window. It will be re-opened at the next test. */
FxToolkit.cleanupStages();
FxToolkit.hideStage();
release(new KeyCode[] {});
release(new MouseButton[] {});
MainStorage.getInstance().use(originalStorageDirectory);
}
示例8: setup
import org.testfx.api.FxToolkit; //导入依赖的package包/类
private void setup() throws Exception {
clientInjector = Guice.createInjector(new AppModule());
serverInjector = Guice.createInjector(new ServerModule());
FxToolkit.registerPrimaryStage();
FxToolkit.setupApplication(() -> new ApplicationAdapter(this));
}
示例9: setup
import org.testfx.api.FxToolkit; //导入依赖的package包/类
@Before
public void setup() throws Exception {
FxToolkit.registerPrimaryStage();
app = new TestApp();
app.savedInitialView = AnnotatedView.class;
app.splashScreen = new SplashScreen();
FxToolkit.setupApplication(() -> app);
}
示例10: setupApplication
import org.testfx.api.FxToolkit; //导入依赖的package包/类
/**
* Sets up a new {@code TestApp} and returns it.
*/
public TestApp setupApplication(Supplier<ReadOnlyAddressBook> addressBook, String saveFileLocation) {
try {
FxToolkit.registerStage(Stage::new);
FxToolkit.setupApplication(() -> testApp = new TestApp(addressBook, saveFileLocation));
} catch (TimeoutException te) {
throw new AssertionError("Application takes too long to set up.");
}
return testApp;
}
示例11: initialize
import org.testfx.api.FxToolkit; //导入依赖的package包/类
/**
* Initializes TestFX.
*/
public static void initialize() {
try {
FxToolkit.registerPrimaryStage();
FxToolkit.hideStage();
} catch (TimeoutException e) {
throw new AssertionError(e);
}
}
示例12: setupMainWindowHandle
import org.testfx.api.FxToolkit; //导入依赖的package包/类
/**
* Encapsulates the primary stage of {@code TestApp} in a {@code MainWindowHandle} and returns it.
*/
public MainWindowHandle setupMainWindowHandle() {
try {
FxToolkit.setupStage((stage) -> {
mainWindowHandle = new MainWindowHandle(stage);
mainWindowHandle.focus();
});
FxToolkit.showStage();
} catch (TimeoutException te) {
throw new AssertionError("Stage takes too long to set up.");
}
return mainWindowHandle;
}
示例13: tearDownStage
import org.testfx.api.FxToolkit; //导入依赖的package包/类
/**
* Tears down existing stages.
*/
public void tearDownStage() {
try {
FxToolkit.cleanupStages();
} catch (TimeoutException te) {
throw new AssertionError("Stage takes too long to tear down.");
}
}
示例14: setUp
import org.testfx.api.FxToolkit; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
guiRobot.interact(() -> helpWindow = new HelpWindow());
Stage helpWindowStage = FxToolkit.setupStage((stage) -> stage.setScene(helpWindow.getRoot().getScene()));
FxToolkit.showStage();
helpWindowHandle = new HelpWindowHandle(helpWindowStage);
}
示例15: setUiPart
import org.testfx.api.FxToolkit; //导入依赖的package包/类
public void setUiPart(final UiPart<? extends Parent> uiPart) {
try {
FxToolkit.setupScene(() -> {
Scene scene = new Scene(uiPart.getRoot());
scene.getStylesheets().setAll(CSS_FILES);
return scene;
});
FxToolkit.showStage();
} catch (TimeoutException te) {
throw new AssertionError("Timeout should not happen.", te);
}
}