summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-05-28 19:59:48 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-15 10:53:32 +0000
commite0979612a57d0a71c2b4f5d646547b5a5f6ab99c (patch)
tree4f01307f92341fb6e978773aef0998b9839fad90 /tests
parentad036413b1044c802253a5843568048d22523ebf (diff)
Add spellchecker support and qwebengine_covert_dict to cmake
Add spellchecker dictionary conversion tool. Change scope of gn object imported variables to function scope. Change-Id: Ice579a89e20b80034b675e7f767a774100478472 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 9451ceee24e832d32a86ae6a2f37eea781acaa2f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/CMakeLists.txt2
-rw-r--r--tests/auto/widgets/spellchecking/CMakeLists.txt49
-rw-r--r--tests/auto/widgets/spellchecking/tst_spellchecking.cpp4
3 files changed, 52 insertions, 3 deletions
diff --git a/tests/auto/widgets/CMakeLists.txt b/tests/auto/widgets/CMakeLists.txt
index f7955b1f8..a6e8d7c35 100644
--- a/tests/auto/widgets/CMakeLists.txt
+++ b/tests/auto/widgets/CMakeLists.txt
@@ -32,5 +32,5 @@ if(QT_FEATURE_ssl)
add_subdirectory(certificateerror)
endif()
if(QT_FEATURE_webengine_spellchecker AND NOT CMAKE_CROSSCOMPILING AND NOT QT_FEATURE_webengine_native_spellchecker)
-# add_subdirectory(spellchecking)
+ add_subdirectory(spellchecking)
endif()
diff --git a/tests/auto/widgets/spellchecking/CMakeLists.txt b/tests/auto/widgets/spellchecking/CMakeLists.txt
new file mode 100644
index 000000000..afed7e28b
--- /dev/null
+++ b/tests/auto/widgets/spellchecking/CMakeLists.txt
@@ -0,0 +1,49 @@
+include(../../util/util.cmake)
+
+qt_internal_add_test(tst_spellchecking
+ SOURCES
+ tst_spellchecking.cpp
+ LIBRARIES
+ Qt::WebEngineWidgets
+ Test::Util
+)
+
+qt_internal_add_resource(tst_spellchecking "tst_spellchecking"
+ PREFIX
+ "/"
+ FILES
+ "resources/index.html"
+)
+
+file(GLOB_RECURSE dicts
+ RELATIVE ${CMAKE_CURRENT_LIST_DIR}/dict
+ *.dic
+)
+
+if(QT_GENERATOR_IS_MULTI_CONFIG)
+ set(spellcheckerDir ${CMAKE_CURRENT_BINARY_DIR}/dict/qtwebengine_dictionaries)
+else()
+ set(spellcheckerDir ${CMAKE_CURRENT_BINARY_DIR}/qtwebengine_dictionaries)
+endif()
+
+foreach(dictFile ${dicts})
+ get_filename_component(dictName ${dictFile} NAME_WE)
+ add_custom_command(TARGET tst_spellchecking
+ PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${spellcheckerDir}
+ COMMAND $<TARGET_FILE:${QT_CMAKE_EXPORT_NAMESPACE}::qwebengine_convert_dict>
+ ${CMAKE_CURRENT_SOURCE_DIR}/dict/${dictFile}
+ ${spellcheckerDir}/${dictName}.bdic
+ COMMENT "Running qwebengine_convert_dict"
+ )
+endforeach()
+
+# copy dictionaries to $<CONFIG> build dir
+if(QT_GENERATOR_IS_MULTI_CONFIG)
+ add_custom_command(TARGET tst_spellchecking
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo Copying dictionares
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/dict
+ ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>
+ )
+endif()
diff --git a/tests/auto/widgets/spellchecking/tst_spellchecking.cpp b/tests/auto/widgets/spellchecking/tst_spellchecking.cpp
index 258071559..ab79ff6cb 100644
--- a/tests/auto/widgets/spellchecking/tst_spellchecking.cpp
+++ b/tests/auto/widgets/spellchecking/tst_spellchecking.cpp
@@ -26,12 +26,12 @@
**
****************************************************************************/
-#include "util.h"
+#include <util.h>
#include <QtTest/QtTest>
#include <QtWebEngineCore/qwebengineprofile.h>
#include <QtWebEngineCore/qwebenginepage.h>
+#include <QtWebEngineCore/qwebenginesettings.h>
#include <QtWebEngineWidgets/qwebengineview.h>
-#include <qwebenginesettings.h>
class WebView : public QWebEngineView
{