Changeset 19231 in josm for trunk/test


Ignore:
Timestamp:
2024-10-03T14:32:10+02:00 (2 months ago)
Author:
taylor.smock
Message:

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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/ShortcutTest.java

    r18853 r19231  
    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    }
Note: See TracChangeset for help on using the changeset viewer.