Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.tools;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertEquals;
|
---|
5 |
|
---|
6 | import java.awt.event.InputEvent;
|
---|
7 | import java.awt.event.KeyEvent;
|
---|
8 |
|
---|
9 | import javax.swing.KeyStroke;
|
---|
10 |
|
---|
11 | import org.junit.BeforeClass;
|
---|
12 | import org.junit.Test;
|
---|
13 | import org.openstreetmap.josm.JOSMFixture;
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * Unit tests of {@link Shortcut} class.
|
---|
17 | */
|
---|
18 | public class ShortcutTest {
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Setup test.
|
---|
22 | */
|
---|
23 | @BeforeClass
|
---|
24 | public static void setUp() {
|
---|
25 | JOSMFixture.createUnitTestFixture().init();
|
---|
26 | }
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Test method for {@code Shortcut#makeTooltip}
|
---|
30 | */
|
---|
31 | @Test
|
---|
32 | public void testMakeTooltip() {
|
---|
33 | final String tooltip = Shortcut.makeTooltip("Foo Bar", KeyStroke.getKeyStroke(KeyEvent.VK_J, InputEvent.SHIFT_DOWN_MASK));
|
---|
34 | if (Platform.determinePlatform() == Platform.OSX) {
|
---|
35 | assertEquals("Foo Bar (⇧+J)", tooltip);
|
---|
36 | } else {
|
---|
37 | assertEquals("<html>Foo Bar <font size='-2'>(Shift+J)</font> </html>", tooltip);
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.