Examples of Keys


Examples of org.zanata.webtrans.client.keys.Keys

        // esc should be first as it has no modifiers
        Set<Keys> firstShortcutKeys = shortcutList.get(0).getAllKeys();
        String firstShortcut = "first shortcut should be Esc with no modifiers";
        assertThat(firstShortcut, firstShortcutKeys.size(), is(1));
        Keys firstShortcutFirstKeys = firstShortcutKeys.iterator().next();
        assertThat(firstShortcut, firstShortcutFirstKeys.getModifiers(), is(0));
        assertThat(firstShortcut, firstShortcutFirstKeys.getKeyCode(),
                is(KeyCodes.KEY_ESCAPE));

        // Alt+X should be next
        Set<Keys> secondShortcutKeys = shortcutList.get(1).getAllKeys();
        String secondShortcut = "second shortcut should be Alt+X";
        assertThat(secondShortcut, secondShortcutKeys.size(), is(1));
        Keys secondShortcutFirstKeys = secondShortcutKeys.iterator().next();
        assertThat(secondShortcut, secondShortcutFirstKeys.getModifiers(),
                is(Keys.ALT_KEY));
        assertThat(secondShortcut, secondShortcutFirstKeys.getKeyCode(),
                is((int) 'X'));

        // Alt+Y should be last
        Set<Keys> thirdShortcutKeys = shortcutList.get(2).getAllKeys();
        String thirdShortcut = "third shortcut should be Alt+Y";
        assertThat(thirdShortcut, thirdShortcutKeys.size(), is(1));
        Keys thirdShortcutFirstKeys = thirdShortcutKeys.iterator().next();
        assertThat(thirdShortcut, thirdShortcutFirstKeys.getModifiers(),
                is(Keys.ALT_KEY));
        assertThat(thirdShortcut, thirdShortcutFirstKeys.getKeyCode(),
                is((int) 'Y'));
    }
View Full Code Here

Examples of org.zanata.webtrans.client.keys.Keys

    }

    @Test
    public void testRespondsToAltY() {
        NativePreviewEvent altYPressed =
                buildNativeKeyDownEvent(new Keys(Keys.ALT_KEY, KEY_CODE_Y));
        mockShortcutDisplayListInteractions();
        keyShortcutPresenter.bind();
        capturedNativePreviewHandler.getValue().onPreviewNativeEvent(
                altYPressed);
        verify(mockDisplay).showPanel();
View Full Code Here

Examples of org.zanata.webtrans.client.keys.Keys

    }

    @Test
    public void testAttentionModeTimesOut() {
        NativePreviewEvent altXPressed =
                buildNativeKeyDownEvent(new Keys(Keys.ALT_KEY, KEY_CODE_X));
        mockShortcutDisplayListInteractions();
        ArgumentCaptor<AttentionModeActivationEvent> eventBusCapture =
                ArgumentCaptor.forClass(AttentionModeActivationEvent.class);

        Timer mockTimer = mock(Timer.class);
View Full Code Here

Examples of org.zanata.webtrans.client.keys.Keys

        keyShortcuts.registerCopyTMKeys();

        verify(keyShortcutPresenter, times(4)).register(
                keyShortcutCaptor.capture());
        List<KeyShortcut> keys = keyShortcutCaptor.getAllValues();
        assertKeys(keys.get(0), "copy from tm 1", false, false, new Keys(
                Keys.CTRL_ALT_KEYS, Keys.KEY_1), new Keys(Keys.CTRL_ALT_KEYS,
                Keys.KEY_NUM_1));
        assertKeys(keys.get(1), "copy from tm 2", false, false, new Keys(
                Keys.CTRL_ALT_KEYS, Keys.KEY_2), new Keys(Keys.CTRL_ALT_KEYS,
                Keys.KEY_NUM_2));
        assertKeys(keys.get(2), "copy from tm 3", false, false, new Keys(
                Keys.CTRL_ALT_KEYS, Keys.KEY_3), new Keys(Keys.CTRL_ALT_KEYS,
                Keys.KEY_NUM_3));
        assertKeys(keys.get(3), "copy from tm 4", false, false, new Keys(
                Keys.CTRL_ALT_KEYS, Keys.KEY_4), new Keys(Keys.CTRL_ALT_KEYS,
                Keys.KEY_NUM_4));
    }
View Full Code Here

Examples of org.zanata.webtrans.client.keys.Keys

        keyShortcuts.registerNavigationKeys(targetContentsPresenter);

        verify(keyShortcutPresenter, times(4)).register(
                keyShortcutCaptor.capture());
        List<KeyShortcut> keys = keyShortcutCaptor.getAllValues();
        assertKeys(keys.get(0), "next entry", true, true, new Keys(
                Keys.ALT_KEY, KeyCodes.KEY_DOWN), new Keys(Keys.ALT_KEY, 'K'));
        assertKeys(keys.get(1), "previous entry", true, true, new Keys(
                Keys.ALT_KEY, KeyCodes.KEY_UP), new Keys(Keys.ALT_KEY, 'J'));
        assertKeys(keys.get(2), "next fuzzy or untranslated", true, true,
                new Keys(Keys.ALT_KEY, KeyCodes.KEY_PAGEDOWN));
        assertKeys(keys.get(3), "previous fuzzy or untranslated", true, true,
                new Keys(Keys.ALT_KEY, KeyCodes.KEY_PAGEUP));
    }
View Full Code Here

Examples of org.zanata.webtrans.client.keys.Keys

        keyShortcuts.registerEditorActionKeys(targetContentsPresenter);

        verify(keyShortcutPresenter, times(4)).register(
                keyShortcutCaptor.capture());
        List<KeyShortcut> keys = keyShortcutCaptor.getAllValues();
        assertKeys(keys.get(0), "save fuzzy", true, true, new Keys(
                Keys.CTRL_KEY, 'S'));
        assertKeys(keys.get(1), "save approved", true, true, new Keys(
                Keys.CTRL_KEY, KeyCodes.KEY_ENTER));
        assertKeys(keys.get(2), "copy from source", true, true, new Keys(
                Keys.ALT_KEY, 'G'));
        assertAttentionKeys(keys.get(2), new Keys('G'));
        assertKeys(keys.get(3), "switch editor", true, true, new Keys(
                Keys.CTRL_ALT_KEYS, 'H'));
    }
View Full Code Here

Examples of org.zanata.webtrans.client.keys.Keys

        keyShortcuts.registerEditorActionKeys(targetContentsPresenter);

        verify(keyShortcutPresenter, times(5)).register(
                keyShortcutCaptor.capture());
        List<KeyShortcut> keys = keyShortcutCaptor.getAllValues();
        assertKeys(keys.get(0), "save fuzzy", true, true, new Keys(
                Keys.CTRL_KEY, 'S'));
        assertKeys(keys.get(1), "save approved", true, true, new Keys(
                Keys.CTRL_KEY, KeyCodes.KEY_ENTER));
        assertKeys(keys.get(2), "save approved", true, true, new Keys(
                Keys.NO_MODIFIER, KeyCodes.KEY_ENTER));
        assertKeys(keys.get(3), "copy from source", true, true, new Keys(
                Keys.ALT_KEY, 'G'));
        assertAttentionKeys(keys.get(3), new Keys('G'));
        assertKeys(keys.get(4), "switch editor", true, true, new Keys(
                Keys.CTRL_ALT_KEYS, 'H'));
    }
View Full Code Here

Examples of org.zanata.webtrans.client.keys.Keys

        verify(keyShortcutPresenter, atLeastOnce()).register(
                keyShortcutCaptor.capture());
        List<KeyShortcut> allKeys = keyShortcutCaptor.getAllValues();
        KeyShortcut shortcut = allKeys.get(allKeys.size() - 1); // last key

        assertKeys(shortcut, "enter save as approved", true, true, new Keys(
                Keys.NO_MODIFIER, KeyCodes.KEY_ENTER));
    }
View Full Code Here

Examples of org.zanata.webtrans.client.keys.Keys

        List<KeyShortcut> shortcuts = keyShortcutCaptor.getAllValues();

        // testing keys
        KeyShortcut docListKey = shortcuts.get(0);
        assertThat(docListKey.getAllKeys(),
                Matchers.contains(new Keys(Keys.ALT_KEY, 'L')));
        assertThat(docListKey.getDescription(), Matchers.equalTo("doc list"));
        assertThat(docListKey.getContext(),
                Matchers.equalTo(ShortcutContext.Application));

        KeyShortcut editorKey = shortcuts.get(1);
        assertThat(editorKey.getAllKeys(),
                Matchers.contains(new Keys(Keys.ALT_KEY, 'O')));
        assertThat(editorKey.getDescription(), Matchers.equalTo("editor"));
        assertThat(editorKey.getContext(),
                Matchers.equalTo(ShortcutContext.Application));

        KeyShortcut searchKey = shortcuts.get(2);
        assertThat(searchKey.getAllKeys(),
                Matchers.contains(new Keys(Keys.ALT_KEY, 'P')));
        assertThat(searchKey.getDescription(),
                Matchers.equalTo("project wide search"));
        assertThat(searchKey.getContext(),
                Matchers.equalTo(ShortcutContext.Application));
    }
View Full Code Here

Examples of org.zanata.webtrans.client.keys.Keys

        verify(keyShortcutPresenter).register(keyShortcutCaptor.capture());

        // key is 'enter', context is Chat, description is publish chat
        KeyShortcut keyShortcut = keyShortcutCaptor.getValue();
        assertThat(keyShortcut.getAllKeys(), Matchers.hasSize(1));
        Keys keys = keyShortcut.getAllKeys().iterator().next();
        assertThat(keys.getModifiers(), Matchers.equalTo(Keys.NO_MODIFIER));
        assertThat(keys.getKeyCode(), Matchers.equalTo(KeyCodes.KEY_ENTER));
        assertThat(keyShortcut.getDescription(),
                Matchers.equalTo("publish chat"));
        assertThat(keyShortcut.getContext(),
                Matchers.equalTo(ShortcutContext.Chat));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.