/* * Copyright (c) 2014, 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.Mnemonics; import client.test.Smoke; import javafx.scene.Node; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.Label; import static javafx.scene.control.test.Mnemonics.MnemonicsTestBase.scene; import org.jemmy.control.Wrap; import org.jemmy.env.Timeout; import org.jemmy.fx.ByID; import org.jemmy.fx.control.CheckBoxWrap; import org.jemmy.interfaces.Keyboard.KeyboardButton; import org.jemmy.interfaces.Keyboard.KeyboardButtons; import org.jemmy.interfaces.Selectable; import org.jemmy.interfaces.Selector; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import test.javaclient.shared.FilteredTestRunner; import test.javaclient.shared.Utils; /** * Class provides tests for mnemonics behavior. * According to the mnemonics spec, * mnemonics are platform specific. Therefore tests design is aimed to * consider the difference between platforms and to avoid boilerplate. * * If tests are run on Ubuntu with Unity the ALT key may invoke the HUD. * In that case you should change system keyboard mapping to avoid such behavior. * */ @RunWith(FilteredTestRunner.class) public class LabelsMnemonicsTest extends MnemonicsTestBase { @BeforeClass public static void setUpClass() throws Exception { LabelsMnemonicsApp.main(null); MnemonicsTestBase.setUpClass(); } @Smoke @Test(timeout = 300000) public void staticTest() throws Throwable { if (!Utils.isMacOS()) { staticSequence(KeyboardButtons.ALT); if (!Utils.isLinux()) { // current spec is unclear // staticSequence(KeyboardButtons.F10); } } } @Smoke @Test(timeout = 300000) public void dynamicTest() throws Throwable { if (!Utils.isMacOS()) { dynamicSequence(KeyboardButtons.ALT); if (!Utils.isLinux()) { // current spec is unclear // dynamicSequence(KeyboardButtons.F10); } } } public void staticSequence(KeyboardButton activate_button) throws Throwable { Wrap button1 = sceneAsParent.lookup(Button.class, new ByID