Changeset 14308 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2018-10-08T20:33:25+02:00 (6 years ago)
Author:
Don-vip
Message:

see #16819 - should fix KeyboardUtilsTest on macOS

File:
1 edited

Legend:

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

    r14289 r14308  
    55
    66import java.awt.event.KeyEvent;
     7import java.util.ArrayList;
    78import java.util.Arrays;
    89import java.util.LinkedHashMap;
     10import java.util.List;
    911import java.util.Locale;
    1012import java.util.Map;
     
    5557    public void testGetCharactersForKeyE00() {
    5658        char deadCircumflex = (char) KeyEvent.VK_DEAD_CIRCUMFLEX;
    57         char deadGrave = (char) KeyEvent.VK_DEAD_GRAVE;
    5859        char deadCaron = (char) KeyEvent.VK_DEAD_CARON;
    5960        char deadCircumflex2 = 0x2C6;
    60         char deadGrave2 = 0x2CB;
    6161        char deadCaron2 = 0x2C7;
    62         testgetCharactersForKeyE00("ar", 'ذ', '>', '`', deadGrave, deadGrave2);
     62        testgetCharactersForKeyE00("ar", 'ذ', '>');
    6363        if (PlatformManager.isPlatformUnixoid()) {
    64             testgetCharactersForKeyE00("fr_FR", '²', '$', 'œ', '`', deadGrave, deadGrave2);
    65             testgetCharactersForKeyE00("fr_CA", '#', '$', 'œ', '/', '`', deadGrave, deadGrave2);
     64            testgetCharactersForKeyE00("fr_FR", '²', '$', 'œ');
     65            testgetCharactersForKeyE00("fr_CA", '#', '$', 'œ', '/');
    6666        } else {
    67             testgetCharactersForKeyE00("fr_FR", '²', '$', '`', deadGrave, deadGrave2);
    68             testgetCharactersForKeyE00("fr_CA", '#', '$', '/', '`', deadGrave, deadGrave2);
     67            testgetCharactersForKeyE00("fr_FR", '²', '$');
     68            testgetCharactersForKeyE00("fr_CA", '#', '$', '/');
    6969        }
    70         testgetCharactersForKeyE00("sq", '\\', '`', deadGrave, deadGrave2);
    71         testgetCharactersForKeyE00("it", '\\', '`', deadGrave, deadGrave2);
    72         testgetCharactersForKeyE00("pt", '\\', '`', deadGrave, deadGrave2);
    73         testgetCharactersForKeyE00("pt_BR", '\'', '`', deadGrave, deadGrave2);
    74         testgetCharactersForKeyE00("de", deadCircumflex, deadCircumflex2, '`', deadGrave, deadGrave2);
    75         testgetCharactersForKeyE00("cs", ';', '`', deadGrave, deadGrave2);
    76         testgetCharactersForKeyE00("he", '`', deadGrave, deadGrave2);
    77         testgetCharactersForKeyE00("hu", '0', '`', deadGrave, deadGrave2);
    78         testgetCharactersForKeyE00("pl", '`', deadGrave, deadGrave2);
    79         testgetCharactersForKeyE00("bs", '¸', '`', deadGrave, deadGrave2);
    80         testgetCharactersForKeyE00("hr", '¸', '`', deadGrave, deadGrave2);
    81         testgetCharactersForKeyE00("sl", '¸', '`', deadGrave, deadGrave2);
    82         testgetCharactersForKeyE00("sr", '¸', '`', deadGrave, deadGrave2);
    83         testgetCharactersForKeyE00("ro", ']', '`', deadGrave, deadGrave2);
    84         testgetCharactersForKeyE00("da", '½', '`', deadGrave, deadGrave2);
    85         testgetCharactersForKeyE00("fo", '½', '`', deadGrave, deadGrave2);
    86         testgetCharactersForKeyE00("nl", '@', '`', deadGrave, deadGrave2);
    87         testgetCharactersForKeyE00("et", deadCaron, deadCaron2, '`', deadGrave, deadGrave2);
    88         testgetCharactersForKeyE00("is", '°', '`', deadGrave, deadGrave2);
    89         testgetCharactersForKeyE00("es", '|', '`', deadGrave, deadGrave2);
    90         testgetCharactersForKeyE00("es_ES", 'º', '`', deadGrave, deadGrave2);
    91         testgetCharactersForKeyE00("tr", '"', '*', '`', deadGrave, deadGrave2);
    92         testgetCharactersForKeyE00("de_LU", deadCircumflex, deadCircumflex2, '²', '§', '`', deadGrave, deadGrave2);
     70        testgetCharactersForKeyE00("sq", '\\');
     71        testgetCharactersForKeyE00("it", '\\');
     72        testgetCharactersForKeyE00("pt", '\\');
     73        testgetCharactersForKeyE00("pt_BR", '\'');
     74        testgetCharactersForKeyE00("de", deadCircumflex, deadCircumflex2);
     75        testgetCharactersForKeyE00("cs", ';');
     76        testgetCharactersForKeyE00("he");
     77        testgetCharactersForKeyE00("hu", '0');
     78        testgetCharactersForKeyE00("pl");
     79        testgetCharactersForKeyE00("bs", '¸');
     80        testgetCharactersForKeyE00("hr", '¸');
     81        testgetCharactersForKeyE00("sl", '¸');
     82        testgetCharactersForKeyE00("sr", '¸');
     83        testgetCharactersForKeyE00("ro", ']');
     84        testgetCharactersForKeyE00("da", '½');
     85        testgetCharactersForKeyE00("fo", '½');
     86        testgetCharactersForKeyE00("nl", '@');
     87        testgetCharactersForKeyE00("et", deadCaron, deadCaron2);
     88        testgetCharactersForKeyE00("is", '°');
     89        testgetCharactersForKeyE00("es", '|');
     90        testgetCharactersForKeyE00("es_ES", 'º');
     91        testgetCharactersForKeyE00("tr", '"', '*');
     92        testgetCharactersForKeyE00("de_LU", deadCircumflex, deadCircumflex2, '²', '§');
    9393        if (PlatformManager.isPlatformUnixoid()) {
    94             testgetCharactersForKeyE00("fr_LU", '$', 'œ', '²', '§', '`', deadGrave, deadGrave2);
    95             testgetCharactersForKeyE00("fr_CH", '²', '$', 'œ', '§', '`', deadGrave, deadGrave2);
     94            testgetCharactersForKeyE00("fr_LU", '$', 'œ', '²', '§');
     95            testgetCharactersForKeyE00("fr_CH", '²', '$', 'œ', '§');
    9696        } else {
    97             testgetCharactersForKeyE00("fr_LU", '$', '²', '§', '`', deadGrave, deadGrave2);
    98             testgetCharactersForKeyE00("fr_CH", '²', '$', '§', '`', deadGrave, deadGrave2);
     97            testgetCharactersForKeyE00("fr_LU", '$', '²', '§');
     98            testgetCharactersForKeyE00("fr_CH", '²', '$', '§');
    9999        }
    100         testgetCharactersForKeyE00("de_CH", deadCircumflex, deadCircumflex2, '§', '`', deadGrave, deadGrave2);
    101         testgetCharactersForKeyE00("de_LI", deadCircumflex, deadCircumflex2, '§', '`', deadGrave, deadGrave2);
    102         testgetCharactersForKeyE00("fi_FI", '§', '`', deadGrave, deadGrave2);
    103         testgetCharactersForKeyE00("sv_SE", '§', '`', deadGrave, deadGrave2);
    104         testgetCharactersForKeyE00("no_NO", '|', '`', deadGrave, deadGrave2);
    105         testgetCharactersForKeyE00("sv_NO", '|', '`', deadGrave, deadGrave2);
     100        testgetCharactersForKeyE00("de_CH", deadCircumflex, deadCircumflex2, '§');
     101        testgetCharactersForKeyE00("de_LI", deadCircumflex, deadCircumflex2, '§');
     102        testgetCharactersForKeyE00("fi_FI", '§');
     103        testgetCharactersForKeyE00("sv_SE", '§');
     104        testgetCharactersForKeyE00("no_NO", '|');
     105        testgetCharactersForKeyE00("sv_NO", '|');
    106106    }
    107107
     
    116116
    117117    private static void testgetCharactersForKeyE00(Locale locale, Character... expected) {
    118         assertEquals(Arrays.asList(expected), KeyboardUtils.getCharactersForKey('E', 0, locale));
     118        List<Character> realExpected = new ArrayList<>(Arrays.asList(expected));
     119        // Add characters common to all cases
     120        if (PlatformManager.isPlatformOsx()) {
     121            realExpected.add('§');
     122        }
     123        char deadGrave = (char) KeyEvent.VK_DEAD_GRAVE;
     124        char deadGrave2 = 0x2CB;
     125        realExpected.addAll(Arrays.asList('`', deadGrave, deadGrave2));
     126        assertEquals(realExpected, KeyboardUtils.getCharactersForKey('E', 0, locale));
    119127    }
    120128}
Note: See TracChangeset for help on using the changeset viewer.