1 /* 2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package test.javafx.scene.input; 27 28 import static javafx.scene.input.KeyCombination.ALT_ANY; 29 import static javafx.scene.input.KeyCombination.CONTROL_DOWN; 30 import static javafx.scene.input.KeyCombination.META_DOWN; 31 import static javafx.scene.input.KeyCombination.SHIFT_ANY; 32 import static javafx.scene.input.KeyCombination.SHORTCUT_ANY; 33 import static javafx.scene.input.KeyCombination.SHORTCUT_DOWN; 34 35 import java.util.Arrays; 36 import java.util.Collection; 37 import javafx.scene.input.KeyCharacterCombination; 38 import javafx.scene.input.KeyCode; 39 import javafx.scene.input.KeyCodeCombination; 40 import javafx.scene.input.KeyCombination; 41 42 import javafx.scene.input.KeyCombination.ModifierValue; 43 44 import org.junit.runner.RunWith; 45 import org.junit.runners.Parameterized; 46 import org.junit.runners.Parameterized.Parameters; 47 48 import test.com.sun.javafx.test.ObjectMethodsTestBase; 49 50 @RunWith(Parameterized.class) 51 public final class KeyCombination_objectMethods_Test 52 extends ObjectMethodsTestBase { 53 @Parameters 54 public static Collection data() { 55 return Arrays.asList(new Object[] { 56 equalObjects( 57 new KeyCodeCombination(KeyCode.R, 58 ModifierValue.ANY, 59 ModifierValue.DOWN, 60 ModifierValue.UP, 61 ModifierValue.UP, 62 ModifierValue.ANY), 63 new KeyCodeCombination(KeyCode.R, 64 CONTROL_DOWN, 65 SHIFT_ANY, 66 SHORTCUT_ANY), 67 KeyCombination.keyCombination( 68 "Ignore Shortcut + Ctrl + Ignore Shift + R")), 69 equalObjects( 70 new KeyCodeCombination(KeyCode.C, 71 ModifierValue.UP, 72 ModifierValue.UP, 73 ModifierValue.UP, 74 ModifierValue.UP, 75 ModifierValue.DOWN), 76 new KeyCodeCombination(KeyCode.C, 77 SHORTCUT_DOWN), 78 KeyCombination.keyCombination("Shortcut + C")), 79 equalObjects( 80 new KeyCharacterCombination("x", 81 ModifierValue.UP, 82 ModifierValue.UP, 83 ModifierValue.ANY, 84 ModifierValue.DOWN, 85 ModifierValue.UP), 86 new KeyCharacterCombination( 87 "x", 88 ALT_ANY, 89 META_DOWN), 90 KeyCombination.keyCombination( 91 "Ignore Alt + Meta + 'x'")), 92 differentObjects( 93 new KeyCodeCombination(KeyCode.R, 94 ModifierValue.ANY, 95 ModifierValue.DOWN, 96 ModifierValue.UP, 97 ModifierValue.UP, 98 ModifierValue.UP), 99 new KeyCodeCombination(KeyCode.A, 100 CONTROL_DOWN, 101 SHIFT_ANY), 102 new KeyCodeCombination(KeyCode.R, 103 CONTROL_DOWN, 104 SHIFT_ANY, 105 ALT_ANY), 106 KeyCombination.keyCombination( 107 "Ctrl + Shift + R"), 108 KeyCombination.keyCombination( 109 "Ignore Shift + R"), 110 KeyCombination.keyCombination( 111 "Ctrl + Ignore Shift + K")), 112 differentObjects( 113 new KeyCharacterCombination("x", 114 ModifierValue.UP, 115 ModifierValue.UP, 116 ModifierValue.ANY, 117 ModifierValue.DOWN, 118 ModifierValue.UP), 119 new KeyCharacterCombination("X", 120 ModifierValue.UP, 121 ModifierValue.UP, 122 ModifierValue.ANY, 123 ModifierValue.DOWN, 124 ModifierValue.UP), 125 new KeyCharacterCombination( 126 "y", 127 ALT_ANY, 128 META_DOWN), 129 new KeyCharacterCombination( 130 "x", 131 ALT_ANY, 132 META_DOWN, 133 SHORTCUT_DOWN), 134 new KeyCharacterCombination( 135 "x", 136 ALT_ANY), 137 KeyCombination.keyCombination( 138 "Alt + Meta + 'x'"), 139 KeyCombination.keyCombination( 140 "Ignore Alt + Meta + Ctrl + 'x'"), 141 KeyCombination.keyCombination( 142 "Ignore Alt + Meta + 'z'")), 143 differentObjectsMediumHashcode( 144 new KeyCodeCombination(KeyCode.Q, 145 ModifierValue.UP, 146 ModifierValue.UP, 147 ModifierValue.ANY, 148 ModifierValue.DOWN, 149 ModifierValue.UP), 150 new KeyCharacterCombination("Q", 151 ModifierValue.UP, 152 ModifierValue.UP, 153 ModifierValue.ANY, 154 ModifierValue.DOWN, 155 ModifierValue.UP), 156 KeyCombination.keyCombination("Ctrl + Alt + 'X'"), 157 KeyCombination.keyCombination("Ctrl + Alt + X"), 158 new KeyCombination() { 159 }, 160 new Object()) 161 }); 162 } 163 164 public KeyCombination_objectMethods_Test( 165 final Configuration configuration) { 166 super(configuration); 167 } 168 }