Browse Source

Validate shortcut keys in all languages(except default)
CURA-5642

Aleksei S 6 years ago
parent
commit
17d2316da3
1 changed files with 8 additions and 28 deletions
  1. 8 28
      tests/TestShortcutKeys.py

+ 8 - 28
tests/TestShortcutKeys.py

@@ -8,30 +8,12 @@ MSGCTXT = "msgctxt" # Scope of the text
 MSGID =  "msgid" # The id of the text, also English version
 MSGID =  "msgid" # The id of the text, also English version
 MSGTR = "msgstr" # The translation
 MSGTR = "msgstr" # The translation
 
 
-regex_patter = '(&[\w])' #"&[a-zA-Z0-9]" - Search char '&' and at least one character after it, the '+' returns one char after '&'
+COLOR_WARNING = '\033[93m'
+COLOR_ENDC = '\033[0m'
 
 
+regex_patter = '(&[\w])' #"&[a-zA-Z0-9]" - Search char '&' and at least one character after it, the '+' returns one char after '&'
 
 
-# class TestShortcutKeys(unittest.TestCase):
-#
-#     language_folder = [
-#         "en_7S",
-#         "de_DE",
-#         "en_US",
-#         "es_ES",
-#         "fi_FI",
-#         "fr_FR",
-#         "hu_HU",
-#         "it_IT",
-#         "ja_JP",
-#         "ko_KR",
-#         "nl_NL",
-#         "pl_PL",
-#         "pt_BR",
-#         "ru_RU",
-#         "tr_TR"
-#     ]
-
-@pytest.mark.parametrize("language_type", [("en_7S"),("de_DE"),("es_ES"),("fi_FI"),("fr_FR"),("hu_HU")])
+@pytest.mark.parametrize("language_type", [("de_DE"),("es_ES"),("fi_FI"),("fr_FR"),("hu_HU"),("it_IT"),("ja_JP"),("ko_KR"),("nl_NL"),("pl_PL"),("pt_BR"),("ru_RU"),("tr_TR")])
 def test_shortcut_keys(language_type):
 def test_shortcut_keys(language_type):
 
 
     language_folder = language_type
     language_folder = language_type
@@ -95,6 +77,7 @@ def test_shortcut_keys(language_type):
                 last_translation_id = ""
                 last_translation_id = ""
 
 
     not_valid_shortcut_keys = []
     not_valid_shortcut_keys = []
+
     #Validate all shortcut keys
     #Validate all shortcut keys
     for shortcut_key, scopes in shortcut_keys.items():
     for shortcut_key, scopes in shortcut_keys.items():
 
 
@@ -102,18 +85,15 @@ def test_shortcut_keys(language_type):
         for key, items in scopes.items():
         for key, items in scopes.items():
 
 
             if len (items) > 1:
             if len (items) > 1:
-                not_valid_shortcut_keys.append(items)
+                not_valid_shortcut_keys += items
 
 
     if len(not_valid_shortcut_keys) != 0:
     if len(not_valid_shortcut_keys) != 0:
         temp='%s' % ', '.join(map(str, not_valid_shortcut_keys))
         temp='%s' % ', '.join(map(str, not_valid_shortcut_keys))
-        print("NOT VALID KEYS: " + temp)
+        print(COLOR_WARNING + "NOT VALID KEYS: " + temp + COLOR_ENDC)
 
 
 
 
     assert len(not_valid_shortcut_keys) == 0
     assert len(not_valid_shortcut_keys) == 0
 
 
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":
-    suite = unittest.TestSuite()
-
-
-    unittest.main(suite)
+    unittest.main()