summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-07-23 21:04:20 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-07-23 21:09:56 +0200
commit3c077e587d36170be53bad90bd5c87364295426c (patch)
treec55c9e4d65e132a8e1aafb68d6019f6641d23d4f /uitest
parentediteng: remove bogus copy ctor (diff)
downloadcore-3c077e587d36170be53bad90bd5c87364295426c.tar.gz
core-3c077e587d36170be53bad90bd5c87364295426c.zip
uitest: handle the case without dictionaries in the UI tests
Change-Id: Icc63deeb182f0c380780332793a3af1f7a51577b
Diffstat (limited to 'uitest')
-rw-r--r--uitest/libreoffice/linguistic/linguservice.py27
-rw-r--r--uitest/writer_tests/spellDialog.py20
2 files changed, 47 insertions, 0 deletions
diff --git a/uitest/libreoffice/linguistic/linguservice.py b/uitest/libreoffice/linguistic/linguservice.py
new file mode 100644
index 000000000000..7ff9c1ac6c62
--- /dev/null
+++ b/uitest/libreoffice/linguistic/linguservice.py
@@ -0,0 +1,27 @@
+# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+
+def get_lingu_service_manager(xContext):
+ """ Returns the com.sun.star.linguistic2.LinguServiceManager
+
+ Further information: https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1linguistic2_1_1LinguServiceManager.html
+ """
+ xServiceManager = xContext.getServiceManager()
+ xLinguServiceManager = xServiceManager.createInstanceWithContext("com.sun.star.linguistic2.LinguServiceManager", xContext)
+ return xLinguServiceManager
+
+
+def get_spellchecker(xContext):
+ """ Returns the com.sun.star.linguistic2.XSpellChecker through the
+ com.sun.star.linguistic2.LinguServiceManager
+
+ Further information: https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1linguistic2_1_1SpellChecker.html"""
+ xLinguServiceManager = get_lingu_service_manager(xContext)
+ return xLinguServiceManager.getSpellChecker()
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uitest/writer_tests/spellDialog.py b/uitest/writer_tests/spellDialog.py
index 9b36ea2a0aa6..41453fac2f33 100644
--- a/uitest/writer_tests/spellDialog.py
+++ b/uitest/writer_tests/spellDialog.py
@@ -6,8 +6,25 @@
from uitest.framework import UITestCase
+from libreoffice.linguistic.linguservice import get_spellchecker
+
class SpellingAndGrammarDialog(UITestCase):
+ def is_supported_locale(self, language, country):
+ xSpellChecker = get_spellchecker(self.ui_test._xContext)
+ locales = xSpellChecker.getLocales()
+ for locale in locales:
+ if language != None:
+ if locale.Language != language:
+ continue
+
+ if country != None:
+ if locale.Country != country:
+ continue
+
+ # we found the correct combination
+ return True
+
def launch_dialog(self):
self.ui_test.execute_modeless_dialog_through_command(
".uno:SpellingAndGrammarDialog")
@@ -33,6 +50,9 @@ dog tact
frog, dog, tact"""
def test_tdf46852(self):
+ supported_locale = self.is_supported_locale("en", "US")
+ if not supported_locale:
+ self.skipTest("no dictionary support for en_US available")
# This automates the steps described in the bug report tdf#46852
# Step 1: Create a document with repetitious misspelled words