Skip to content

Commit 4601c53

Browse files
author
taylor.smock
committed
ShortcutTest: Determine if HTML is supported before asserting against an HTML string
This does a few things: * Ensures that the test will work properly if the default LaF is *not* Aqua (the default macOS LaF) * If Aqua ever supports HTML in menu tooltips, we will only have to change one location * Fewer locations to worry about in unit tests if we change the default LaF for mac to something else git-svn-id: https://josm.openstreetmap.de/svn/trunk@19231 0c6e7542-c601-0410-84e7-c038aed88b3b
1 parent cfeeaf8 commit 4601c53

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/unit/org/openstreetmap/josm/tools/ShortcutTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ class ShortcutTest {
2020
@Test
2121
void testMakeTooltip() {
2222
final String tooltip = Shortcut.makeTooltip("Foo Bar", KeyStroke.getKeyStroke(KeyEvent.VK_J, InputEvent.SHIFT_DOWN_MASK));
23-
if (Platform.determinePlatform() == Platform.OSX) {
24-
assertEquals("Foo Bar (⇧+J)", tooltip);
23+
final String shift = Platform.determinePlatform() == Platform.OSX ? "⇧" : "Shift";
24+
if (PlatformManager.getPlatform().isHtmlSupportedInMenuTooltips()) {
25+
assertEquals("<html>Foo Bar <font size='-2'>(" + shift + "+J)</font>&nbsp;</html>", tooltip);
2526
} else {
26-
assertEquals("<html>Foo Bar <font size='-2'>(Shift+J)</font>&nbsp;</html>", tooltip);
27+
assertEquals("Foo Bar (" + shift + "+J)", tooltip);
2728
}
2829
}
2930

0 commit comments

Comments
 (0)