/* * Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javafx.scene.control.test.dialog; import com.sun.glass.ui.Application; import com.sun.glass.ui.Robot; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ButtonBar; import javafx.scene.control.ButtonType; import javafx.scene.control.CheckBox; import javafx.scene.control.Hyperlink; import javafx.scene.control.TextField; import javafx.scene.control.ToggleButton; import javafx.scene.control.test.ControlsTestBase; import javafx.scene.control.test.dialog.DialogApp; import static javafx.scene.control.test.dialog.DialogApp.DialogScene.*; import javafx.stage.StageStyle; import javafx.stage.Window; import org.jemmy.action.GetAction; import org.jemmy.control.Wrap; import org.jemmy.fx.ByID; import org.jemmy.fx.ByText; import org.jemmy.fx.ByWindowType; import org.jemmy.fx.Root; import org.jemmy.fx.SceneDock; import org.jemmy.image.Image; import org.jemmy.interfaces.Keyboard.KeyboardButtons; import org.jemmy.interfaces.Parent; import org.jemmy.resources.StringComparePolicy; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import test.javaclient.shared.FilteredTestRunner; import test.javaclient.shared.TestUtil; import test.javaclient.shared.screenshots.GoldenImageManager; /** * * @author Alexander Vorobyev */ @RunWith(FilteredTestRunner.class) public class DialogTest extends ControlsTestBase { private static final int DEFAULT_DELAY = 1000; public DialogTest() { } public static ButtonType[] types = {ButtonType.APPLY, ButtonType.CANCEL, ButtonType.CLOSE, ButtonType.FINISH, ButtonType.NEXT, ButtonType.NO, ButtonType.OK, ButtonType.PREVIOUS, ButtonType.YES}; public static String[] content = {TOGGLE_BUTTON_TEXT, TOGGLE_LABEL_TEXT, TOGGLE_INPUT_TEXT}; public static enum InputType { MOUSE, SPACE, ENTER } Wrap scene = null; Parent parent = null; Wrap clear = null; static boolean isRemote; @BeforeClass public static void setUpClass() throws Exception { DialogApp.main(null); isRemote = (test.javaclient.shared.AppLauncher.getInstance().getMode() == test.javaclient.shared.AppLauncher.Mode.REMOTE); } @AfterClass public static void tearDownClass() throws Exception { } @Before public void setUp() { scene = TestUtil.getScene(); parent = scene.as(Parent.class, Node.class); scene.mouse().click(); } @After public void tearDown() { } private void deselectButtons() { for (ButtonType b : types) { Wrap addButton = parent.lookup(ToggleButton.class, new ByText(b.getText(), StringComparePolicy.EXACT)).wrap(); click(addButton, InputType.MOUSE); } } private void addButton(String button) { Wrap addButton = parent.lookup(ToggleButton.class, new ByText(button, StringComparePolicy.EXACT)).wrap(); click(addButton, InputType.MOUSE); } @Test(timeout = 300000) public void informationAlertBasicTest() throws Throwable { Wrap button = parent.lookup(Button.class, new ByText