aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/.prev_CMakeLists.txt7
-rw-r--r--tests/auto/CMakeLists.txt10
-rw-r--r--tests/auto/auto.pro8
-rw-r--r--tests/auto/cmake/CMakeLists.txt12
-rw-r--r--tests/auto/cmake/cmake.pro6
-rw-r--r--tests/auto/dictionarymanager/CMakeLists.txt29
-rw-r--r--tests/auto/dictionarymanager/tst_dictionarymanager.cpp69
-rw-r--r--tests/auto/inputpanel/BLACKLIST1
-rw-r--r--tests/auto/inputpanel/CMakeLists.txt11
-rw-r--r--tests/auto/inputpanel/data/inputpanel/handwriting.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml36
-rw-r--r--tests/auto/inputpanel/data/inputpanel/inputpanel.qml246
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_arabic.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_cyrillic.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_greek.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_hebrew.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_japanese.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_simp_chinese.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_thai.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_trad_chinese.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/utils.js46
-rw-r--r--tests/auto/inputpanel/data/tst_inputpanel.qml396
-rw-r--r--tests/auto/inputpanel/hwr_test_data/README.txt4
-rwxr-xr-xtests/auto/inputpanel/hwr_test_data/build_unipen_data.py62
-rw-r--r--tests/auto/inputpanel/inputpanel.pro19
-rw-r--r--tests/auto/inputpanel/tst_inputpanel.cpp61
-rw-r--r--tests/auto/inputpanelcontrols/CMakeLists.txt17
-rw-r--r--tests/auto/inputpanelcontrols/data/inputpanel/inputpanel.qml15
-rw-r--r--tests/auto/inputpanelcontrols/data/tst_inputpanelcontrols.qml98
-rw-r--r--tests/auto/inputpanelcontrols/tst_inputpanelcontrols.cpp31
-rw-r--r--tests/auto/layoutfilesystem/BLACKLIST3
-rw-r--r--tests/auto/layoutfilesystem/CMakeLists.txt13
-rw-r--r--tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml35
-rw-r--r--tests/auto/layoutfilesystem/layoutfilesystem.pro20
-rw-r--r--tests/auto/layoutfilesystem/tst_layoutfilesystem.cpp30
-rw-r--r--tests/auto/layoutresources/CMakeLists.txt17
-rw-r--r--tests/auto/layoutresources/data/layouts/en_GB/main.qml35
-rw-r--r--tests/auto/layoutresources/data/resourceslayout.qrc5
-rw-r--r--tests/auto/layoutresources/layoutresources.pro20
-rw-r--r--tests/auto/layoutresources/tst_layoutresources.cpp30
-rw-r--r--tests/auto/shadowinput/CMakeLists.txt17
-rw-r--r--tests/auto/shadowinput/data/inputpanel/inputpanel.qml24
-rw-r--r--tests/auto/shadowinput/data/tst_shadowinput.qml92
-rw-r--r--tests/auto/shadowinput/tst_shadowinput.cpp23
-rw-r--r--tests/auto/shared/layouttest.pri5
-rw-r--r--tests/auto/shared/layouttesthelper.cpp33
-rw-r--r--tests/auto/shared/layouttesthelper.h30
-rw-r--r--tests/auto/styles/BLACKLIST3
-rw-r--r--tests/auto/styles/CMakeLists.txt31
-rw-r--r--tests/auto/styles/data/QtQuick/VirtualKeyboard/Styles/test/style.qml36
-rw-r--r--tests/auto/styles/data/tst_styles.qml41
-rw-r--r--tests/auto/styles/styles.pro23
-rw-r--r--tests/auto/styles/tst_styles.cpp30
-rw-r--r--tests/auto/virtualkeyboardattached/CMakeLists.txt17
-rw-r--r--tests/auto/virtualkeyboardattached/data/inputpanel/inputpanel.qml16
-rw-r--r--tests/auto/virtualkeyboardattached/data/tst_virtualkeyboardattached.qml99
-rw-r--r--tests/auto/virtualkeyboardattached/tst_virtualkeyboardattached.cpp12
60 files changed, 1127 insertions, 1157 deletions
diff --git a/tests/auto/.prev_CMakeLists.txt b/tests/auto/.prev_CMakeLists.txt
deleted file mode 100644
index 57ca438e..00000000
--- a/tests/auto/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# Generated from auto.pro.
-
-add_subdirectory(inputpanel)
-add_subdirectory(styles)
-add_subdirectory(layoutfilesystem)
-add_subdirectory(layoutresources)
-add_subdirectory(cmake)
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
index 3777778c..1c0b3c51 100644
--- a/tests/auto/CMakeLists.txt
+++ b/tests/auto/CMakeLists.txt
@@ -1,7 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from auto.pro.
+if(NOT ANDROID) # QTBUG-102756
add_subdirectory(inputpanel)
+endif()
+add_subdirectory(inputpanelcontrols)
add_subdirectory(styles)
add_subdirectory(layoutfilesystem)
add_subdirectory(layoutresources)
-# add_subdirectory(cmake) # special case
+add_subdirectory(dictionarymanager)
+add_subdirectory(shadowinput)
+add_subdirectory(virtualkeyboardattached)
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
deleted file mode 100644
index 15685d5f..00000000
--- a/tests/auto/auto.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- inputpanel \
- styles \
- layoutfilesystem \
- layoutresources \
- cmake \
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
deleted file mode 100644
index 3d77b9e5..00000000
--- a/tests/auto/cmake/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-project(qmake_cmake_files)
-
-enable_testing()
-
-find_package(Qt5Core REQUIRED)
-
-include("${_Qt5CTestMacros}")
-
-test_module_includes(
-)
diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro
deleted file mode 100644
index f8635657..00000000
--- a/tests/auto/cmake/cmake.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-# Cause make to do nothing.
-TEMPLATE = subdirs
-
-CMAKE_QT_MODULES_UNDER_TEST = virtualkeyboard
-
-CONFIG += ctest_testcase
diff --git a/tests/auto/dictionarymanager/CMakeLists.txt b/tests/auto/dictionarymanager/CMakeLists.txt
new file mode 100644
index 00000000..f0e7857e
--- /dev/null
+++ b/tests/auto/dictionarymanager/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from dictionarymanager.pro.
+
+#####################################################################
+## tst_dictionarymanager Test:
+#####################################################################
+
+qt_internal_add_test(tst_dictionarymanager
+ SOURCES
+ tst_dictionarymanager.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+ Qt::VirtualKeyboard
+)
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(tst_dictionarymanager CONDITION NOT QT_BUILD_SHARED_LIBS
+ LIBRARIES
+ Qt::Svg
+)
+
+#### Keys ignored in scope 3:.:.:dictionarymanager.pro:static:
+# QTPLUGIN = "qtvirtualkeyboardplugin"
diff --git a/tests/auto/dictionarymanager/tst_dictionarymanager.cpp b/tests/auto/dictionarymanager/tst_dictionarymanager.cpp
new file mode 100644
index 00000000..8c7c4c06
--- /dev/null
+++ b/tests/auto/dictionarymanager/tst_dictionarymanager.cpp
@@ -0,0 +1,69 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/qtest.h>
+#include <QtTest/QSignalSpy>
+#include <QtVirtualKeyboard/QVirtualKeyboardDictionary>
+#include <QtVirtualKeyboard/QVirtualKeyboardDictionaryManager>
+
+static bool moduleEnv = qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
+
+class tst_dictionarymanager : public QObject
+{
+ Q_OBJECT
+
+public:
+
+private slots:
+ void testCreateDictionary();
+ void testDictionarySets();
+};
+
+void tst_dictionarymanager::testCreateDictionary()
+{
+ QVirtualKeyboardDictionaryManager *dictionaryManager = QVirtualKeyboardDictionaryManager::instance();
+ QVERIFY(dictionaryManager != nullptr);
+
+ QVirtualKeyboardDictionary *dictionary = dictionaryManager->createDictionary("custom");
+ QSignalSpy dictionarySpy(dictionary, SIGNAL(contentsChanged()));
+ QVERIFY(dictionarySpy.isValid());
+ QStringList wordList = QStringList() << "myword";
+ dictionary->setContents(wordList);
+ QCOMPARE(dictionarySpy.size(), 1);
+
+ QVERIFY(dictionaryManager->availableDictionaries().contains("custom"));
+}
+
+void tst_dictionarymanager::testDictionarySets()
+{
+ QVirtualKeyboardDictionaryManager *dictionaryManager = QVirtualKeyboardDictionaryManager::instance();
+ QVERIFY(dictionaryManager != nullptr);
+
+ dictionaryManager->setBaseDictionaries(QStringList() << "non-existent");
+ QVERIFY(dictionaryManager->baseDictionaries().isEmpty());
+
+ dictionaryManager->setExtraDictionaries(QStringList() << "non-existent");
+ QVERIFY(dictionaryManager->extraDictionaries().isEmpty());
+
+ dictionaryManager->createDictionary("custom1");
+ dictionaryManager->createDictionary("custom2");
+ dictionaryManager->setBaseDictionaries(QStringList() << "custom1");
+ dictionaryManager->setExtraDictionaries(QStringList() << "custom2");
+ QCOMPARE(dictionaryManager->baseDictionaries(), QStringList() << "custom1");
+ QCOMPARE(dictionaryManager->extraDictionaries(), QStringList() << "custom2");
+ QVERIFY(dictionaryManager->activeDictionaries().contains("custom1"));
+ QVERIFY(dictionaryManager->activeDictionaries().contains("custom2"));
+
+ dictionaryManager->setBaseDictionaries(QStringList() << "custom1" << "custom2");
+ dictionaryManager->setExtraDictionaries(QStringList() << "custom2" << "custom1");
+ QVERIFY(dictionaryManager->baseDictionaries().contains("custom1"));
+ QVERIFY(dictionaryManager->baseDictionaries().contains("custom2"));
+ QVERIFY(dictionaryManager->extraDictionaries().contains("custom1"));
+ QVERIFY(dictionaryManager->extraDictionaries().contains("custom2"));
+ QVERIFY(dictionaryManager->activeDictionaries().contains("custom1"));
+ QVERIFY(dictionaryManager->activeDictionaries().contains("custom2"));
+}
+
+QTEST_MAIN(tst_dictionarymanager)
+
+#include "tst_dictionarymanager.moc"
diff --git a/tests/auto/inputpanel/BLACKLIST b/tests/auto/inputpanel/BLACKLIST
new file mode 100644
index 00000000..ac88f44e
--- /dev/null
+++ b/tests/auto/inputpanel/BLACKLIST
@@ -0,0 +1 @@
+# See qtbase/src/testlib/qtestblacklist.cpp for format
diff --git a/tests/auto/inputpanel/CMakeLists.txt b/tests/auto/inputpanel/CMakeLists.txt
index 1e9184a7..2dd636ed 100644
--- a/tests/auto/inputpanel/CMakeLists.txt
+++ b/tests/auto/inputpanel/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from inputpanel.pro.
#####################################################################
@@ -10,11 +13,11 @@ file(GLOB_RECURSE test_data_glob
${CMAKE_CURRENT_SOURCE_DIR}/data/*)
list(APPEND test_data ${test_data_glob})
-qt_add_test(tst_inputpanel
+qt_internal_add_test(tst_inputpanel
QMLTEST
SOURCES
tst_inputpanel.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
TESTDATA ${test_data}
)
@@ -26,8 +29,8 @@ qt_add_test(tst_inputpanel
## Scopes:
#####################################################################
-qt_extend_target(tst_inputpanel CONDITION NOT QT_BUILD_SHARED_LIBS
- PUBLIC_LIBRARIES
+qt_internal_extend_target(tst_inputpanel CONDITION NOT QT_BUILD_SHARED_LIBS
+ LIBRARIES
Qt::Svg
)
diff --git a/tests/auto/inputpanel/data/inputpanel/handwriting.js b/tests/auto/inputpanel/data/inputpanel/handwriting.js
index e289fb60..20b615e1 100644
--- a/tests/auto/inputpanel/data/inputpanel/handwriting.js
+++ b/tests/auto/inputpanel/data/inputpanel/handwriting.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
.pragma library
diff --git a/tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml b/tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml
index f3dc4ace..7b81a42f 100644
--- a/tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml
+++ b/tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml
@@ -1,35 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtTest 1.0
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
+import QtTest
+import QtQuick
+import QtQuick.VirtualKeyboard
import "handwriting.js" as Handwriting
import "utils.js" as Utils
diff --git a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
index dd46a5b9..5204c5b7 100644
--- a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
+++ b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
@@ -1,36 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtTest 1.0
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-import QtQuick.VirtualKeyboard.Settings 2.2
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Settings
import "handwriting.js" as Handwriting
import "utils.js" as Utils
@@ -55,25 +29,20 @@ InputPanel {
readonly property var activeLocales: VirtualKeyboardSettings.activeLocales
readonly property int inputMode: InputContext.inputEngine.inputMode
readonly property var inputMethod: InputContext.inputEngine.inputMethod
- readonly property var keyboard: Utils.findChildByProperty(inputPanel, "objectName", "keyboard", null)
readonly property bool handwritingMode: keyboard.handwritingMode
- readonly property var keyboardLayoutLoader: Utils.findChildByProperty(keyboard, "objectName", "keyboardLayoutLoader", null)
- readonly property var keyboardInputArea: Utils.findChildByProperty(keyboard, "objectName", "keyboardInputArea", null)
- readonly property var characterPreviewBubble: Utils.findChildByProperty(keyboard, "objectName", "characterPreviewBubble", null)
- readonly property var alternativeKeys: Utils.findChildByProperty(keyboard, "objectName", "alternativeKeys", null)
- readonly property var naviationHighlight: Utils.findChildByProperty(keyboard, "objectName", "naviationHighlight", null)
- readonly property bool naviationHighlightAnimating: naviationHighlight.xAnimation.running ||
- naviationHighlight.yAnimation.running ||
- naviationHighlight.widthAnimation.running ||
- naviationHighlight.heightAnimation.running
- readonly property var wordCandidateView: Utils.findChildByProperty(keyboard, "objectName", "wordCandidateView", null)
- readonly property var wordCandidateContextMenu: Utils.findChildByProperty(keyboard, "objectName", "wordCandidateContextMenu", null)
- readonly property var shadowInputControl: Utils.findChildByProperty(keyboard, "objectName", "shadowInputControl", null)
- readonly property var shadowInput: Utils.findChildByProperty(keyboard, "objectName", "shadowInput", null)
- readonly property var selectionControl: Utils.findChildByProperty(inputPanel, "objectName", "selectionControl", null)
+ readonly property Loader keyboardLayoutLoader: keyboard.keyboardLayoutLoader
+ readonly property MultiPointTouchArea keyboardInputArea: keyboard.keyboardInputArea
+ readonly property CharacterPreviewBubble characterPreviewBubble: keyboard.characterPreview
+ readonly property AlternativeKeys alternativeKeys: keyboard.alternativeKeys
+ readonly property Loader naviationHighlight: keyboard.naviationHighlight
+ readonly property ListView wordCandidateView: keyboard.wordCandidateView
+ readonly property Item wordCandidateContextMenu: keyboard.wordCandidateContextMenu
+ readonly property ShadowInputControl shadowInputControl: keyboard.shadowInputControl
+ readonly property TextInput shadowInput: keyboard.shadowInputControl.textEdit
+ readonly property SelectionControl selectionControl: Utils.findChildByProperty(inputPanel, "objectName", "selectionControl", null)
readonly property var anchorHandle: selectionControl.children[0]
readonly property var cursorHandle: selectionControl.children[1]
- readonly property var fullScreenModeSelectionControl: Utils.findChildByProperty(inputPanel, "objectName", "fullScreenModeSelectionControl", null)
+ readonly property SelectionControl fullScreenModeSelectionControl: keyboard.fullScreenModeSelectionControl
readonly property var fullScreenModeAnchorHandle: fullScreenModeSelectionControl.children[0]
readonly property var fullScreenModeCursorHandle: fullScreenModeSelectionControl.children[1]
readonly property bool wordCandidateListVisibleHint: InputContext.inputEngine.wordCandidateListVisibleHint
@@ -89,8 +58,10 @@ InputPanel {
property alias soundEffectSpy: soundEffectSpy
property alias inputMethodResultSpy: inputMethodResultSpy
property alias wordCandidateListChangedSpy: wordCandidateListChangedSpy
+ property alias wordCandidateListItemSelectedSpy: wordCandidateListItemSelectedSpy
property alias inputMethodSelectionListChangedSpy: inputMethodSelectionListChangedSpy
property alias wordCandidateListVisibleSpy: wordCandidateListVisibleSpy
+ property alias wordCandidateListCurrentIndexSpy: wordCandidateListCurrentIndexSpy
property alias shiftStateSpy: shiftStateSpy
property alias shadowInputControlVisibleSpy: shadowInputControlVisibleSpy
property alias externalLanguageSwitchSpy: externalLanguageSwitchSpy
@@ -179,6 +150,12 @@ InputPanel {
}
SignalSpy {
+ id: wordCandidateListItemSelectedSpy
+ target: wordCandidateView.model
+ signalName: "itemSelected"
+ }
+
+ SignalSpy {
id: inputMethodSelectionListChangedSpy
target: InputContext.inputEngine.inputMethod
signalName: "selectionListChanged"
@@ -191,6 +168,12 @@ InputPanel {
}
SignalSpy {
+ id: wordCandidateListCurrentIndexSpy
+ target: wordCandidateView
+ signalName: "onCurrentIndexChanged"
+ }
+
+ SignalSpy {
id: wordCandidateContextMenuActiveSpy
target: wordCandidateContextMenu
signalName: "onActiveChanged"
@@ -214,26 +197,18 @@ InputPanel {
signalName: "onExternalLanguageSwitch"
}
- function findChildByProperty(parent, propertyName, propertyValue, compareCb) {
- var obj = null
- if (parent === null)
- return null
- var children = parent.children
- for (var i = 0; i < children.length; i++) {
- obj = children[i]
- if (obj.hasOwnProperty(propertyName)) {
- if (compareCb !== null) {
- if (compareCb(obj[propertyName], propertyValue))
- break
- } else if (obj[propertyName] === propertyValue) {
- break
- }
- }
- obj = findChildByProperty(obj, propertyName, propertyValue, compareCb)
- if (obj)
- break
- }
- return obj
+ // Disable all animations during tests
+ Binding {
+ target: keyboard
+ property: "noAnimations"
+ value: true
+ }
+
+ // Reduce press and hold delay to avoid unnecessary wait during tests
+ Binding {
+ target: keyboard
+ property: "pressAndHoldDelay"
+ value: 50
}
function isLocaleSupported(inputLocale) {
@@ -252,6 +227,42 @@ InputPanel {
VirtualKeyboardSettings.activeLocales = activeLocales
}
+ function mapKeyboardFunction(keyboardFunctionName) {
+ if (keyboardFunctionName === "HideInputPanel")
+ return QtVirtualKeyboard.KeyboardFunction.HideInputPanel
+ if (keyboardFunctionName === "ChangeLanguage")
+ return QtVirtualKeyboard.KeyboardFunction.ChangeLanguage
+ if (keyboardFunctionName === "ToggleHandwritingMode")
+ return QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode
+ return -1
+ }
+
+ function doKeyboardFunction(keyboardFunctionName) {
+ const keyboardFunction = mapKeyboardFunction(keyboardFunctionName)
+ testcase.verify(keyboardFunction !== -1)
+ keyboard.doKeyboardFunction(keyboardFunction)
+ }
+
+ function mapKeyboardFunctionKey(functionKeyName) {
+ if (functionKeyName === "None")
+ return QtVirtualKeyboard.KeyboardFunctionKeys.None
+ if (functionKeyName === "Hide")
+ return QtVirtualKeyboard.KeyboardFunctionKeys.Hide
+ if (functionKeyName === "Language")
+ return QtVirtualKeyboard.KeyboardFunctionKeys.Language
+ if (functionKeyName === "All")
+ return QtVirtualKeyboard.KeyboardFunctionKeys.All
+ testcase.fail("Invalid function key '%1'".arg(functionKeyName))
+ }
+
+ function setVisibleFunctionKeys(functionKeyNames) {
+ let functionKeys = QtVirtualKeyboard.KeyboardFunctionKeys.None
+ for (const functionKeyName of functionKeyNames) {
+ functionKeys |= mapKeyboardFunctionKey(functionKeyName)
+ }
+ VirtualKeyboardSettings.visibleFunctionKeys = functionKeys
+ }
+
function setWclAutoHideDelay(wclAutoHideDelay) {
VirtualKeyboardSettings.wordCandidateList.autoHideDelay = wclAutoHideDelay
}
@@ -305,6 +316,10 @@ InputPanel {
return InputEngine.InputMode.KoreanHandwriting
else if (inputModeName === "Thai")
return InputEngine.InputMode.Thai
+ else if (inputModeName === "Stroke")
+ return InputEngine.InputMode.Stroke
+ else if (inputModeName === "Romaji")
+ return InputEngine.InputMode.Romaji
else
return -1
}
@@ -343,6 +358,8 @@ InputPanel {
testcase.verify(InputEngine.InputMode.JapaneseHandwriting !== undefined)
testcase.verify(InputEngine.InputMode.KoreanHandwriting !== undefined)
testcase.verify(InputEngine.InputMode.Thai !== undefined)
+ testcase.verify(InputEngine.InputMode.Stroke !== undefined)
+ testcase.verify(InputEngine.InputMode.Romaji !== undefined)
testcase.verify(InputEngine.PatternRecognitionMode.None !== undefined)
testcase.verify(InputEngine.PatternRecognitionMode.PatternRecognitionDisabled !== undefined)
testcase.verify(InputEngine.PatternRecognitionMode.Handwriting !== undefined)
@@ -356,40 +373,6 @@ InputPanel {
testcase.verify(SelectionListModel.Role.Dictionary !== undefined)
testcase.verify(SelectionListModel.DictionaryType.Default !== undefined)
testcase.verify(SelectionListModel.DictionaryType.User !== undefined)
- // Unscoped
- testcase.verify(InputEngine.Lower !== undefined)
- testcase.verify(InputEngine.Upper !== undefined)
- testcase.verify(InputEngine.Latin !== undefined)
- testcase.verify(InputEngine.Numeric !== undefined)
- testcase.verify(InputEngine.Dialable !== undefined)
- testcase.verify(InputEngine.Pinyin !== undefined)
- testcase.verify(InputEngine.Cangjie !== undefined)
- testcase.verify(InputEngine.Zhuyin !== undefined)
- testcase.verify(InputEngine.Hangul !== undefined)
- testcase.verify(InputEngine.Hiragana !== undefined)
- testcase.verify(InputEngine.Katakana !== undefined)
- testcase.verify(InputEngine.FullwidthLatin !== undefined)
- testcase.verify(InputEngine.Greek !== undefined)
- testcase.verify(InputEngine.Cyrillic !== undefined)
- testcase.verify(InputEngine.Arabic !== undefined)
- testcase.verify(InputEngine.Hebrew !== undefined)
- testcase.verify(InputEngine.ChineseHandwriting !== undefined)
- testcase.verify(InputEngine.JapaneseHandwriting !== undefined)
- testcase.verify(InputEngine.KoreanHandwriting !== undefined)
- testcase.verify(InputEngine.Thai !== undefined)
- testcase.verify(InputEngine.None !== undefined)
- testcase.verify(InputEngine.PatternRecognitionDisabled !== undefined)
- testcase.verify(InputEngine.Handwriting !== undefined)
- testcase.verify(InputEngine.HandwritingRecoginition !== undefined)
- testcase.verify(InputEngine.WordBeforeCursor !== undefined)
- testcase.verify(InputEngine.WordAfterCursor !== undefined)
- testcase.verify(InputEngine.WordAtCursor !== undefined)
- testcase.verify(SelectionListModel.WordCandidateList !== undefined)
- testcase.verify(SelectionListModel.DisplayRole !== undefined)
- testcase.verify(SelectionListModel.WordCompletionLengthRole !== undefined)
- testcase.verify(SelectionListModel.DictionaryType !== undefined)
- testcase.verify(SelectionListModel.Default !== undefined)
- testcase.verify(SelectionListModel.User !== undefined)
}
function setExternalLanguageSwitchEnabled(enabled) {
@@ -425,6 +408,19 @@ InputPanel {
return Utils.findChildByProperty(keyboard, "objectName", objectName, null)
}
+ function mapKeyboardKeyType(keyTypeName) {
+ if (keyTypeName === "ChangeLanguageKey")
+ return QtVirtualKeyboard.KeyType.ChangeLanguageKey
+ if (keyTypeName === "HideKeyboardKey")
+ return QtVirtualKeyboard.KeyType.HideKeyboardKey
+ testcase.fail("Invalid key type '%1'".arg(keyTypeName))
+ }
+
+ function findKeyByKeyType(keyTypeName) {
+ const keyType = mapKeyboardKeyType(keyTypeName)
+ return Utils.findChildByProperty(keyboard, "keyType", keyType, null)
+ }
+
function virtualKeyPressOnCurrentLayout(key) {
var keyObj = typeof key == "object" && key.hasOwnProperty("key") ? key : findVirtualKey(key)
var alternativeKey = false
@@ -437,14 +433,14 @@ InputPanel {
if (keyObj) {
virtualKeyPressPoint = inputPanel.mapFromItem(keyObj, keyObj.width / 2, keyObj.height / 2)
testcase.mousePress(inputPanel, virtualKeyPressPoint.x, virtualKeyPressPoint.y)
- testcase.wait(20)
+ testcase.wait(1)
if (alternativeKey) {
alternativeKeysSpy.wait()
var keyIndex = keyObj.effectiveAlternativeKeys.indexOf(key.toLowerCase())
var itemX = keyIndex * keyboard.style.alternateKeysListItemWidth + keyboard.style.alternateKeysListItemWidth / 2
virtualKeyPressPoint.x = inputPanel.mapFromItem(alternativeKeys.listView, itemX, 0).x
testcase.mouseMove(inputPanel, virtualKeyPressPoint.x, virtualKeyPressPoint.y)
- testcase.waitForRendering(inputPanel)
+ testcase.wait(1)
}
return true
}
@@ -453,7 +449,7 @@ InputPanel {
function multiLayoutKeyActionHelper(key, keyActionOnCurrentLayoutCb) {
if (!keyboardLayoutLoader.item) {
- console.warn("Key not found \\u%1 (keyboard layout not loaded)".arg(key.charCodeAt(0).toString(16)))
+ console.warn("Key not found \\u%1 (keyboard layout not loaded)".arg(typeof key == "string" ? key.charCodeAt(0).toString(16) : key.toString(16)))
return false
}
var success = keyActionOnCurrentLayoutCb(key)
@@ -496,7 +492,7 @@ InputPanel {
success = keyActionOnCurrentLayoutCb(key)
}
if (!success)
- console.warn("Key not found \\u%1".arg(key.charCodeAt(0).toString(16)))
+ console.warn("Key not found \\u%1".arg(typeof key == "string" ? key.charCodeAt(0).toString(16) : key.toString(16)))
return success
}
@@ -531,7 +527,6 @@ InputPanel {
function virtualKeyClick(key) {
if (virtualKeyPress(key)) {
virtualKeyRelease()
- testcase.waitForRendering(inputPanel)
return true
}
return false
@@ -539,13 +534,7 @@ InputPanel {
function emulateNavigationKeyClick(navigationKey) {
testcase.keyClick(navigationKey)
- while (inputPanel.naviationHighlightAnimating)
- testcase.wait(inputPanel.naviationHighlight.moveDuration / 2)
- }
-
- function navigationHighlightContains(point) {
- var navigationPoint = inputPanel.mapToItem(inputPanel.naviationHighlight, point.x, point.y)
- return inputPanel.naviationHighlight.contains(Qt.point(navigationPoint.x, navigationPoint.y))
+ testcase.wait(50)
}
function navigateToKeyOnPoint(point) {
@@ -553,7 +542,7 @@ InputPanel {
if (inputPanel.naviationHighlight.visible) {
while (true) {
var navigationPoint = inputPanel.mapToItem(inputPanel.naviationHighlight, point.x, point.y)
- if (navigationHighlightContains(point))
+ if (inputPanel.naviationHighlight.contains(Qt.point(navigationPoint.x, navigationPoint.y)))
return true
if (inputPanel.naviationHighlight.y > point.y)
emulateNavigationKeyClick(Qt.Key_Up)
@@ -613,12 +602,9 @@ InputPanel {
function activateNavigationKeyMode() {
if (!inputPanel.naviationHighlight.visible) {
- inputPanel.naviationHighlight.moveDuration = 0
- inputPanel.naviationHighlight.resizeDuration = 0
emulateNavigationKeyClick(Qt.Key_Right)
if (inputPanel.naviationHighlight.visible) {
- while (inputPanel.naviationHighlightAnimating)
- testcase.wait(inputPanel.naviationHighlight.moveDuration / 2)
+ testcase.wait(1)
}
}
return inputPanel.naviationHighlight.visible
@@ -658,6 +644,9 @@ InputPanel {
origIndex = inputPanel.wordCandidateView.currentIndex
}
if (origIndex !== -1) {
+ while (inputPanel.wordCandidateView.currentIndex > 0) {
+ inputPanel.wordCandidateView.decrementCurrentIndex()
+ }
while (true) {
if (inputPanel.wordCandidateView.model.dataAt(inputPanel.wordCandidateView.currentIndex) === suggestion) {
suggestionFound = true
@@ -672,7 +661,6 @@ InputPanel {
inputPanel.wordCandidateView.decrementCurrentIndex()
}
}
- testcase.waitForRendering(inputPanel)
}
return suggestionFound
}
@@ -680,7 +668,6 @@ InputPanel {
function selectionListSelectCurrentItem() {
if (!inputPanel.wordCandidateView.currentItem)
return false
- testcase.wait(200)
testcase.verify(inputPanel.wordCandidateView.currentItem,
"Expected wordCandidateView to have a currentItem, but it's null."
+ " Its property values at the time of failure are:"
@@ -696,7 +683,6 @@ InputPanel {
inputPanel.wordCandidateView.currentItem.width / 2,
inputPanel.wordCandidateView.currentItem.height / 2)
testcase.mouseClick(inputPanel, itemPos.x, itemPos.y, Qt.LeftButton, 0, 20)
- testcase.waitForRendering(inputPanel)
return true
}
@@ -730,7 +716,6 @@ InputPanel {
var wordCandidateContextMenuList = Utils.findChildByProperty(keyboard, "objectName", "wordCandidateContextMenuList", null)
if (wordCandidateContextMenuList.currentIndex !== index) {
wordCandidateContextMenuList.currentIndex = index
- testcase.waitForRendering(inputPanel)
}
if (!wordCandidateContextMenuList.currentItem)
return false
@@ -738,10 +723,13 @@ InputPanel {
wordCandidateContextMenuList.currentItem.width / 2,
wordCandidateContextMenuList.currentItem.height / 2)
testcase.mouseClick(inputPanel, itemPos.x, itemPos.y, Qt.LeftButton, 0, 20)
- testcase.waitForRendering(inputPanel)
return true
}
+ function isHandwritingFeatureAvailable() {
+ return VirtualKeyboardFeatures.Handwriting
+ }
+
function setHandwritingMode(enabled) {
if (inputPanel.keyboard.handwritingMode !== enabled) {
if (!enabled || inputPanel.keyboard.isHandwritingAvailable())
@@ -773,4 +761,12 @@ InputPanel {
return false
return inputMethod != null && inputMethod.hasOwnProperty("superimposed") && inputMethod.superimposed
}
+
+ function closeOnReturn() {
+ return VirtualKeyboardSettings.closeOnReturn
+ }
+
+ function setCloseOnReturn(enabled) {
+ VirtualKeyboardSettings.closeOnReturn = enabled
+ }
}
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data.js b/tests/auto/inputpanel/data/inputpanel/unipen_data.js
index 83ad1a2c..8c56733b 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x0020": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_arabic.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_arabic.js
index da810919..17a62c1a 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_arabic.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_arabic.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x0627": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_cyrillic.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_cyrillic.js
index 3f336427..c05ce2cd 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_cyrillic.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_cyrillic.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x0430": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_greek.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_greek.js
index 54db858b..56c630f2 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_greek.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_greek.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x0395": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_hebrew.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_hebrew.js
index 29c9d3eb..1d061e14 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_hebrew.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_hebrew.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x05d0": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_japanese.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_japanese.js
index bef4fc56..fce71d6e 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_japanese.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_japanese.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x65e5": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js
index db30adda..4eea1c5e 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0xad6d": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_simp_chinese.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_simp_chinese.js
index b5942e6b..0b9c3c59 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_simp_chinese.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_simp_chinese.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x4e2d": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_thai.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_thai.js
index 525df258..4486fe58 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_thai.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_thai.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x0e14": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_trad_chinese.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_trad_chinese.js
index 5e0c5c3f..77d9ba08 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_trad_chinese.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_trad_chinese.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x570b": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js
index 09d2fae6..73ed8e9b 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x0067": {
diff --git a/tests/auto/inputpanel/data/inputpanel/utils.js b/tests/auto/inputpanel/data/inputpanel/utils.js
index de5117b1..1f1a6299 100644
--- a/tests/auto/inputpanel/data/inputpanel/utils.js
+++ b/tests/auto/inputpanel/data/inputpanel/utils.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
.pragma library
@@ -34,8 +8,7 @@ function findChildByProperty(parent, propertyName, propertyValue, compareCb) {
if (parent === null)
return null
var children = parent.children
- for (var i = 0; i < children.length; i++) {
- obj = children[i]
+ for (obj of children) {
if (obj.hasOwnProperty(propertyName)) {
if (compareCb !== null) {
if (compareCb(obj[propertyName], propertyValue))
@@ -56,8 +29,7 @@ function findChild(parent, param, matchCb) {
if (parent === null)
return null
var children = parent.children
- for (var i = 0; i < children.length; i++) {
- obj = children[i]
+ for (obj of children) {
if (matchCb(obj, param))
break
obj = findChild(obj, param, matchCb)
@@ -66,3 +38,13 @@ function findChild(parent, param, matchCb) {
}
return obj
}
+
+function toUnicodeHex(str) {
+ var result = ''
+ for (var i = 0; i < str.length; i++) {
+ if (result.length > 0)
+ result += ", "
+ result += "U+" + ("000" + str.charCodeAt(i).toString(16)).slice(-4)
+ }
+ return result
+}
diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml
index ec1dbd97..026ed751 100644
--- a/tests/auto/inputpanel/data/tst_inputpanel.qml
+++ b/tests/auto/inputpanel/data/tst_inputpanel.qml
@@ -1,40 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtTest 1.0
-import QtQuick 2.0
-import QtQuick.Window 2.3
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.Window
+import QtQuick.Controls
+import "inputpanel/utils.js" as Utils
Rectangle {
id: container
- width: 400
- height: 400
+ width: 800
+ height: 640
color: "blue"
Component {
@@ -47,6 +23,14 @@ Rectangle {
}
}
+ Component {
+ id: textFieldComp
+ TextField {
+ property int enterKeyType: Qt.EnterKeyDefault
+ EnterKey.type: enterKeyType
+ }
+ }
+
TestCase {
id: testcase
name: "tst_plugin"
@@ -79,12 +63,21 @@ Rectangle {
}
function prepareTest(data, skipIfFail) {
+ // Skip hwr tests early if handwriting feature is not available
+ if (data !== undefined && data.hasOwnProperty("initHwrMode") && data.initHwrMode) {
+ if (!inputPanel.isHandwritingFeatureAvailable())
+ skip("Handwriting feature not available")
+ }
+
inputPanel.setWclAutoHideDelay(data !== undefined && data.hasOwnProperty("wclAutoHideDelay") ? data.wclAutoHideDelay : 5000)
inputPanel.setWclAlwaysVisible(data !== undefined && data.hasOwnProperty("wclAlwaysVisible") && data.wclAlwaysVisible)
inputPanel.setWclAutoCommitWord(data !== undefined && data.hasOwnProperty("wclAutoCommitWord") && data.wclAutoCommitWord)
inputPanel.setFullScreenMode(data !== undefined && data.hasOwnProperty("fullScreenMode") && data.fullScreenMode)
inputPanel.setExternalLanguageSwitchEnabled(data !== undefined && data.hasOwnProperty("externalLanguageSwitchEnabled") && data.externalLanguageSwitchEnabled)
inputPanel.setLayoutMirroring(data !== undefined && data.hasOwnProperty("layoutMirroring") && data.layoutMirroring)
+ inputPanel.setVisibleFunctionKeys(data !== undefined && data.hasOwnProperty("visibleFunctionKeys") ? data.visibleFunctionKeys : ["All"])
+ inputPanel.setCloseOnReturn(data !== undefined && data.hasOwnProperty("closeOnReturn") && data.closeOnReturn)
+
var window = container.Window.window
verify(window)
@@ -93,7 +86,6 @@ Rectangle {
tryCompare(window, "active", true)
container.forceActiveFocus()
- waitForRendering(container)
if (data !== undefined && data.hasOwnProperty("initText")) {
textInput.text = data.initText
textInput.cursorPosition = data.hasOwnProperty("initCursorPosition") ? data.initCursorPosition : textInput.text.length
@@ -108,7 +100,6 @@ Rectangle {
handwritingInputPanel.available = false
inputPanel.setHandwritingMode(false)
textInput.forceActiveFocus()
- waitForRendering(inputPanel)
var activeLocales = data !== undefined && data.hasOwnProperty("activeLocales") ? data.activeLocales : []
inputPanel.setActiveLocales(activeLocales)
var locale = data !== undefined && data.hasOwnProperty("initLocale") ? data.initLocale : "en_GB"
@@ -138,6 +129,7 @@ Rectangle {
}
verify(inputPanel.setInputMode(inputMode))
}
+ waitForRendering(inputPanel)
verify(inputPanel.visible === true)
verify(textInput.activeFocus === true)
}
@@ -212,6 +204,20 @@ Rectangle {
property var wclAlwaysVisible: VirtualKeyboardSettings.wordCandidateList.alwaysVisible; \
property var wclAutoCommitWord: VirtualKeyboardSettings.wordCandidateList.autoCommitWord; \
property var fullScreenMode: VirtualKeyboardSettings.fullScreenMode; }" },
+ // without versions
+ { qml: "import QtQuick; \
+ import QtQuick.VirtualKeyboard; \
+ import QtQuick.VirtualKeyboard.Styles; \
+ import QtQuick.VirtualKeyboard.Settings; \
+ import QtQuick.VirtualKeyboard.Plugins; \
+ Item {}" },
+ // virtual keyboard 5.15
+ { qml: "import QtQuick 2.7; \
+ import QtQuick.VirtualKeyboard 2.3; \
+ import QtQuick.VirtualKeyboard.Styles 2.1; \
+ import QtQuick.VirtualKeyboard.Settings 2.2; \
+ import QtQuick.VirtualKeyboard.Plugins 2.3; \
+ Item {}" },
]
}
@@ -251,8 +257,14 @@ Rectangle {
Qt.inputMethod.hide()
verify(inputPanel.visible === false)
+ // Should not become visible because the active focus is set to container
Qt.inputMethod.show()
waitForRendering(inputPanel)
+ verify(inputPanel.visible === false)
+
+ // Should become visible because of previously called show() and focus set to input control
+ textInput.forceActiveFocus()
+ waitForRendering(inputPanel)
verify(inputPanel.visible === true)
Qt.inputMethod.hide()
@@ -321,6 +333,31 @@ Rectangle {
compare(textInput.text, "A")
}
+ function test_hardKeyBackspaceClearsInput_data() {
+ return [
+ { initLocale: "en_GB", initText: "12345", initCursorPosition: 1, inputSequence: "hello", outputText: "12345", expectedCursorPosition: 1 },
+ { initLocale: "ja_JP", initText: "12345", initCursorPosition: 1, inputSequence: "watashi", outputText: "12345", expectedCursorPosition: 1 },
+ ]
+ }
+
+ function test_hardKeyBackspaceClearsInput(data) {
+ prepareTest(data)
+
+ if (!inputPanel.wordCandidateListVisibleHint)
+ skip("Prediction/spell correction not enabled")
+
+ compare(Qt.inputMethod.locale.name, Qt.locale(data.initLocale).name)
+ for (var inputIndex in data.inputSequence) {
+ verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
+ }
+
+ keyClick(Qt.Key_Backspace)
+ waitForRendering(textInput)
+
+ compare(textInput.text, data.outputText)
+ compare(textInput.cursorPosition, data.expectedCursorPosition)
+ }
+
function test_hardKeyInput() {
prepareTest()
@@ -366,7 +403,6 @@ Rectangle {
{ initLocale: "pt_BR", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "ol\u00E1", outputText: "Ol\u00E1" },
{ initLocale: "pt_PT", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "ol\u00E1", outputText: "Ol\u00E1" },
{ initLocale: "ru_RU", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "\u043F\u0440\u0438\u0432\u0435\u0442", outputText: "\u041F\u0440\u0438\u0432\u0435\u0442" },
- { initLocale: "ru_RU", initInputMethodHints: Qt.ImhNoPredictiveText, initInputMode: "Latin", inputSequence: "hello", outputText: "Hello" },
{ initLocale: "sr_SP", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "\u0437\u0434\u0440\u0430\u0432\u043E", outputText: "\u0417\u0434\u0440\u0430\u0432\u043E" },
{ initLocale: "sv_SE", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "hall\u00E5", outputText: "Hall\u00E5" },
{ initLocale: "sq_AL", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "përshëndetje", outputText: "Përshëndetje" },
@@ -387,7 +423,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -416,7 +451,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -448,7 +482,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -494,7 +527,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -599,16 +631,13 @@ Rectangle {
inputPanel.setStyle("retro")
inputPanel.styleSpy.wait()
- waitForRendering(inputPanel)
inputPanel.setStyle("default")
inputPanel.styleSpy.wait()
- waitForRendering(inputPanel)
compare(inputPanel.styleSpy.count, 2)
inputPanel.setStyle(origStyle)
- waitForRendering(inputPanel)
}
function test_soundEffects() {
@@ -628,9 +657,9 @@ Rectangle {
function test_navigationKeyInputSequence_data() {
return [
- { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputSequence: "\u00E1\u017C", outputText: "\u00E1\u017C" },
- { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputSequence: "~123qwe", outputText: "~123qwe" },
- { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputSequence: [ Qt.Key_Shift, Qt.Key_V, Qt.Key_K, Qt.Key_B, Qt.Key_Return ], outputText: "VKB\n" },
+ { initialKey: Qt.Key_Space, initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputSequence: "\u00E1\u017C", outputText: "\u00E1\u017C" },
+ { initialKey: Qt.Key_Space, initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputSequence: "~123qwe", outputText: "~123qwe" },
+ { initialKey: Qt.Key_Space, initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputSequence: [ Qt.Key_Shift, Qt.Key_Shift, Qt.Key_V, Qt.Key_K, Qt.Key_B, Qt.Key_Return ], outputText: "VKB\n" },
]
}
@@ -641,20 +670,20 @@ Rectangle {
skip("Arrow key navigation not enabled")
verify(inputPanel.naviationHighlight.visible)
+ verify(inputPanel.navigateToKey(data.initialKey))
for (var inputIndex in data.inputSequence) {
verify(inputPanel.navigationKeyClick(data.inputSequence[inputIndex]))
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
function test_navigationCursorWrap_data() {
return [
- { initialKey: Qt.Key_Q, navigationKey: Qt.Key_Up, navigationKeyRepeat: 4 },
- { initialKey: Qt.Key_Q, navigationKey: Qt.Key_Down, navigationKeyRepeat: 4 },
+ { initialKey: Qt.Key_W, navigationKey: Qt.Key_Up, navigationKeyRepeat: 4 },
+ { initialKey: Qt.Key_W, navigationKey: Qt.Key_Down, navigationKeyRepeat: 4 },
{ initialKey: Qt.Key_T, navigationKey: Qt.Key_Up, navigationKeyRepeat: 4 },
{ initialKey: Qt.Key_T, navigationKey: Qt.Key_Down, navigationKeyRepeat: 4 },
{ initialKey: Qt.Key_Backspace, navigationKey: Qt.Key_Up, navigationKeyRepeat: 4 },
@@ -687,7 +716,7 @@ Rectangle {
}
}
- verify(inputPanel.keyboardInputArea.initialKey === initialKeyObj)
+ compare(inputPanel.keyboardInputArea.initialKey, initialKeyObj)
}
function test_navigationCursorAndWordCandidateView() {
@@ -727,7 +756,10 @@ Rectangle {
// Move focus to the next item in the list
var previousHighlightIndex = inputPanel.wordCandidateView.currentIndex
+ inputPanel.wordCandidateListCurrentIndexSpy.clear()
inputPanel.emulateNavigationKeyClick(Qt.Key_Right)
+ inputPanel.wordCandidateListCurrentIndexSpy.wait()
+ compare(inputPanel.wordCandidateListCurrentIndexSpy.count, 1)
compare(inputPanel.wordCandidateView.currentIndex, previousHighlightIndex + 1)
// Move focus to previously focused key on keyboard and back
@@ -743,7 +775,10 @@ Rectangle {
for (previousHighlightIndex = inputPanel.wordCandidateView.currentIndex;
previousHighlightIndex < inputPanel.wordCandidateView.count - 1;
previousHighlightIndex++) {
+ inputPanel.wordCandidateListCurrentIndexSpy.clear()
inputPanel.emulateNavigationKeyClick(Qt.Key_Right)
+ inputPanel.wordCandidateListCurrentIndexSpy.wait()
+ compare(inputPanel.wordCandidateListCurrentIndexSpy.count, 1)
compare(inputPanel.wordCandidateView.currentIndex, previousHighlightIndex + 1)
}
@@ -803,7 +838,7 @@ Rectangle {
var keysTraversed = []
do {
- verify(keysTraversed.indexOf(inputPanel.keyboardInputArea.initialKey) === -1)
+ compare(keysTraversed.indexOf(inputPanel.keyboardInputArea.initialKey), -1)
var currentKey = inputPanel.keyboardInputArea.initialKey
keysTraversed.push(currentKey)
inputPanel.emulateNavigationKeyClick(Qt.Key_Right)
@@ -838,7 +873,6 @@ Rectangle {
for (var inputIndex in data.inputSequence) {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
}
- waitForRendering(inputPanel)
if (inputPanel.wordCandidateListVisibleHint) {
if (data.hasOwnProperty("expectedSuggestion")) {
@@ -860,16 +894,13 @@ Rectangle {
function test_spellCorrectionAutomaticSpaceInsertion_data() {
return [
{ inputSequence: ['h','e','l','l','o',Qt.Key_Select,'w','o','r','l','d'], outputText: "Hello world" },
- { inputSequence: ['h','e','l','l','o','\'','s',Qt.Key_Select,'w','o','r','l','d'], outputText: "Hello's world" },
+ { inputSequence: ['k','e','l','l','y','\'','s',Qt.Key_Select,'w','o','r','l','d'], outputText: "Kelly's world" },
{ inputSequence: ['h','e','l','l','o','s','\'',Qt.Key_Select,'w','o','r','l','d'], outputText: "Hellos' world" },
{ inputSequence: ['h','e','l','l','o','-','w','o','r','l','d'], outputText: "Hello-world" },
{ inputSequence: ['h','e','l','l','o',Qt.Key_Select,'.','w','o','r','l','d'], outputText: "Hello. World" },
{ inputSequence: ['h','e','l','l','o',Qt.Key_Select,',','w','o','r','l','d'], outputText: "Hello, world" },
{ inputSequence: ['h','e','l','l','o','.',Qt.Key_Backspace,'w','o','r','l','d'], outputText: "Helloworld" },
{ inputSequence: ['h','e','l','l','o',' ',Qt.Key_Backspace,'w','o','r','l','d'], outputText: "Helloworld" },
- { inputSequence: ['h','e','l','l','o',Qt.Key_Select,'w','o','r','l','d',':-)'], outputText: "Hello world :-)" },
- { inputSequence: ['h','e','l','l','o',Qt.Key_Select,'w','o','r','l','d',':-)',':-)'], outputText: "Hello world :-) :-)" },
- { inputSequence: ['h','e','l','l','o',Qt.Key_Select,':-)'], outputText: "Hello :-)" },
{ initText: "Hekko world", selectionStart: 2, selectionEnd: 4, inputSequence: ['l','l'], outputText: "Hello world" },
]
}
@@ -887,7 +918,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
if (!inputPanel.wordCandidateListVisibleHint && textInput.text !== data.outputText)
expectFail("", "Prediction/spell correction not enabled")
compare(textInput.text, data.outputText)
@@ -915,9 +945,13 @@ Rectangle {
{ initInputMethodHints: Qt.ImhNone, initLocale: "zh_CN", inputSequence: "bailou", expectedCandidates: [ "\u5457", "\u5A04" ], outputText: "\u5457\u5A04" },
// Select phrase from the user dictinary
{ initInputMethodHints: Qt.ImhNone, initLocale: "zh_CN", inputSequence: "bailou", expectedCandidates: [ "\u5457\u5A04" ], outputText: "\u5457\u5A04" },
+ // Suggest phrases according to the last selected word
+ { initInputMethodHints: Qt.ImhNone, initLocale: "zh_CN", inputSequence: "da", expectedCandidates: [ "\u5927", "\u5bb6", "\u5ead" ], outputText: "\u5927\u5bb6\u5ead" },
// Add an apostrophe before joined syllables in cases of ambiguity, disable the user dictionary (Qt.ImhSensitiveData) so it does not affect to the results
{ initInputMethodHints: Qt.ImhNone | Qt.ImhSensitiveData, initLocale: "zh_CN", inputSequence: "zhangang", expectedCandidates: [ "\u5360", "\u94A2" ], outputText: "\u5360\u94A2" },
{ initInputMethodHints: Qt.ImhNone | Qt.ImhSensitiveData, initLocale: "zh_CN", inputSequence: "zhang'ang", expectedCandidates: [ "\u7AE0", "\u6602" ], outputText: "\u7AE0\u6602" },
+ // Invalid pinyin sequence
+ { initInputMethodHints: Qt.ImhNone, initLocale: "zh_CN", inputSequence: "fi", expectedCandidates: [ "\u53D1", "i" ], outputText: "\u53D1i" },
]
}
@@ -927,14 +961,13 @@ Rectangle {
for (var inputIndex in data.inputSequence) {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
}
- waitForRendering(inputPanel)
for (var candidateIndex in data.expectedCandidates) {
verify(inputPanel.selectionListSearchSuggestion(data.expectedCandidates[candidateIndex]))
verify(inputPanel.selectionListSelectCurrentItem())
}
- compare(textInput.text, data.outputText)
+ compare(Utils.toUnicodeHex(textInput.text), Utils.toUnicodeHex(data.outputText))
}
function test_cangjieInputMethod_data() {
@@ -973,6 +1006,9 @@ Rectangle {
function test_cangjieInputMethod(data) {
prepareTest(data, true)
+ if (!inputPanel.inputMethod.hasOwnProperty("simplified"))
+ skip("Input method does not support simplified mode")
+
if (data.hasOwnProperty("initSimplified")) {
if (inputPanel.inputMethod.simplified !== data.initSimplified)
verify(inputPanel.virtualKeyClick(Qt.Key_Mode_switch))
@@ -986,7 +1022,6 @@ Rectangle {
else
verify(inputPanel.virtualKeyClick(key))
}
- waitForRendering(inputPanel)
if (data.expectedCandidates) {
for (var candidateIndex in data.expectedCandidates) {
@@ -1055,8 +1090,6 @@ Rectangle {
}
function test_zhuyinInputMethod(data) {
- skip("The test is broken, see QTBUG-80663. Skipping rather than blacklisting to avoid crashes.")
-
prepareTest(data, true)
for (var inputIndex in data.inputSequence) {
@@ -1066,8 +1099,6 @@ Rectangle {
verify(inputPanel.virtualKeyClick(inputSequence[charIndex]))
}
- waitForRendering(inputPanel)
-
if (data.expectedCandidates && inputIndex < data.expectedCandidates.length && data.expectedCandidates[inputIndex].length > 0) {
verify(inputPanel.selectionListSearchSuggestion(data.expectedCandidates[inputIndex]))
verify(inputPanel.selectionListSelectCurrentItem())
@@ -1076,7 +1107,6 @@ Rectangle {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
}
}
- waitForRendering(inputPanel)
if (!Array.isArray(data.inputSequence) && data.expectedCandidates) {
verify(inputPanel.selectionListSearchSuggestion(data.expectedCandidates))
@@ -1114,7 +1144,7 @@ Rectangle {
{ initLocale: "ko_KR", inputSequence: "\u3131\u314F\u3139\u314D", outputText: "\uAC0E" },
{ initLocale: "ko_KR", inputSequence: "\u3131\u314F\u3139\u314E", outputText: "\uAC0F" },
{ initLocale: "ko_KR", inputSequence: "\u3131\u314F\u3142\u3145", outputText: "\uAC12" },
- { initLocale: "ko_KR", inputSequence: "\u3131\u314F\u3145\u3145", outputText: "\uAC14" },
+ //{ initLocale: "ko_KR", inputSequence: "\u3131\u314F\u3145\u3145", outputText: "\uAC14" }, // Actually not standard
// Test using the final Jamo of the first syllable as an initial
// Jamo of the following syllable
{ initLocale: "ko_KR", inputSequence: "\u3131\u314F\u3131\u314F", outputText: "\uAC00\uAC00" },
@@ -1131,24 +1161,30 @@ Rectangle {
compare(Qt.inputMethod.locale.name, Qt.locale(data.initLocale).name)
+ function textInputContents() {
+ return textInput.text.substring(0, textInput.cursorPosition) +
+ textInput.preeditText +
+ textInput.text.substring(textInput.cursorPosition)
+ }
+
// Add Jamos one by one
var intermediateResult = []
for (var inputIndex in data.inputSequence) {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
- intermediateResult.push(textInput.text)
+ intermediateResult.push(textInputContents())
}
- compare(textInput.text, data.outputText)
+ compare(Utils.toUnicodeHex(textInputContents()), Utils.toUnicodeHex(data.outputText))
// Remove Jamos one by one.
// The number of removed characters must match to the number of Jamos entered.
for (inputIndex = data.inputSequence.length - 1; inputIndex >= 0; inputIndex--) {
- compare(textInput.text, intermediateResult.pop())
+ compare(Utils.toUnicodeHex(textInputContents()), Utils.toUnicodeHex(intermediateResult.pop()))
inputPanel.virtualKeyClick(Qt.Key_Backspace)
}
- waitForRendering(inputPanel)
- compare(textInput.text, data.initText !== undefined ? data.initText : "")
+ compare(Utils.toUnicodeHex(textInputContents()),
+ Utils.toUnicodeHex(data.initText !== undefined ? data.initText : ""))
}
function test_japaneseInputModes_data() {
@@ -1157,8 +1193,6 @@ Rectangle {
{ initLocale: "ja_JP", initInputMode: "Hiragana", inputSequence: ["n","i","h","o","n","g","o",Qt.Key_Return], outputText: "\u306B\u307B\u3093\u3054" },
// Hiragana to Kanjie conversion
{ initLocale: "ja_JP", initInputMode: "Hiragana", inputSequence: ["n","i","h","o","n","g","o",Qt.Key_Space,Qt.Key_Return], outputText: "\u65E5\u672C\u8A9E" },
- // Hiragana to Kanjie conversion plus a smiley
- { initLocale: "ja_JP", initInputMode: "Hiragana", inputSequence: ["n","i","h","o","n","g","o",0xE000,Qt.Key_Space,Qt.Key_Return,Qt.Key_Return], outputText: "\u65E5\u672C\u8A9E\uFF1A\u30FC\uFF09" },
// Correction to Hiragana sequence using exact match mode
{ initLocale: "ja_JP", initInputMode: "Hiragana", inputSequence: [
// Write part of the text leaving out "ni" from the beginning
@@ -1193,7 +1227,6 @@ Rectangle {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
}
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
if (data.hasOwnProperty("expectedCursorPosition"))
@@ -1223,7 +1256,6 @@ Rectangle {
for (var inputIndex in data.inputSequence) {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
}
- waitForRendering(inputPanel)
for (var candidateIndex in data.expectedCandidates) {
verify(inputPanel.selectionListSearchSuggestion(data.expectedCandidates[candidateIndex]))
@@ -1233,10 +1265,25 @@ Rectangle {
compare(textInput.cursorPosition, data.expectedCursorPosition)
}
+ function test_japaneseSelectCurrentItemResetsIndex() {
+ prepareTest({ initLocale: "ja_JP" }, true)
+
+ verify(inputPanel.virtualKeyClick("a"))
+ verify(inputPanel.virtualKeyClick("a"))
+ verify(inputPanel.virtualKeyClick("a"))
+
+ compare(inputPanel.wordCandidateView.currentIndex, -1)
+ inputPanel.wordCandidateView.currentIndex = 0
+ inputPanel.selectionListSelectCurrentItem()
+ compare(inputPanel.wordCandidateView.currentIndex, -1, "QTBUG-94560")
+ }
+
function test_baseKeyNoModifier() {
// The Japanese keyboard uses the BaseKey.noModifier flag for the arrow keys.
// Without this flag the arrow key + shift would extend the text selection.
prepareTest({ initLocale: "ja_JP", initInputMethodHints: Qt.ImhLatinOnly })
+ if (!inputPanel.findVirtualKey(Qt.Key_Left) || inputPanel.virtualKeyClick(Qt.Key_Right))
+ skip("Custom layout detected")
verify(inputPanel.virtualKeyClick("a"))
verify(inputPanel.virtualKeyClick(Qt.Key_Left))
compare(textInput.cursorPosition, 0)
@@ -1263,7 +1310,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -1307,7 +1353,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -1353,7 +1398,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -1387,12 +1431,10 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
var inputMode = inputPanel.inputMode
verify(inputPanel.virtualKeyClick(Qt.Key_Mode_switch))
- waitForRendering(inputPanel)
compare(inputPanel.inputMode !== inputMode, data.modeSwitchAllowed)
}
@@ -1416,7 +1458,6 @@ Rectangle {
for (var inputIndex in data.inputSequence) {
verify(inputPanel.emulateHandwriting(data.inputSequence.charAt(inputIndex), true))
}
- waitForRendering(inputPanel)
if (inputPanel.wordCandidateListVisibleHint) {
if (data.hasOwnProperty("expectedSuggestion")) {
@@ -1595,7 +1636,6 @@ Rectangle {
for (var inputIndex in data.inputSequence) {
verify(handwritingInputPanel.emulateHandwriting(data.inputSequence.charAt(inputIndex), true))
}
- waitForRendering(handwritingInputPanel)
if (data.popupFlipped) {
verify(handwritingInputPanel.wordCandidatePopupList.y + handwritingInputPanel.wordCandidatePopupList.height <= Qt.inputMethod.cursorRectangle.y)
@@ -1628,7 +1668,6 @@ Rectangle {
else
expectedResult = (inputPanel.activeLocales.length === 0 || inputPanel.activeLocales.indexOf(locale) !== -1) && inputPanel.availableLocales.indexOf(locale) !== -1
inputPanel.setLocale(locale)
- waitForRendering(inputPanel)
compare(inputPanel.locale === locale, expectedResult, "Test locale %1".arg(locale))
}
}
@@ -1662,6 +1701,9 @@ Rectangle {
{ initText: "aa http://www.example.com bb", initInputMethodHints: Qt.ImhUrlCharactersOnly, clickPositions: [4], expectedPreeditText: "http://www.example.com", expectedCursorPosition: 3, expectedText: "aa bb" },
{ initText: "aa username@example.com bb", clickPositions: [4], expectedPreeditText: "username", expectedCursorPosition: 3, expectedText: "aa @example.com bb" },
{ initText: "aa username@example.com bb", initInputMethodHints: Qt.ImhEmailCharactersOnly, clickPositions: [4], expectedPreeditText: "username@example.com", expectedCursorPosition: 3, expectedText: "aa bb" },
+ // 23
+ // Verify that word reselect is not activated during initial focus
+ { initText: "hello", clickPositions: [], initCursorPosition: 2, expectedPreeditText: "", expectedCursorPosition: 2, expectedText: "hello" },
]
}
@@ -1676,7 +1718,6 @@ Rectangle {
var cursorRect = cursorRects[i]
mousePress(textInput, cursorRect.x, cursorRect.y + cursorRect.height / 2, Qt.LeftButton, Qt.NoModifier, 20)
mouseRelease(textInput, cursorRect.x, cursorRect.y + cursorRect.height / 2, Qt.LeftButton, Qt.NoModifier, 20)
- waitForRendering(textInput)
}
if (!inputPanel.wordCandidateListVisibleHint && inputPanel.preeditText !== data.expectedPreeditText)
@@ -1738,7 +1779,6 @@ Rectangle {
var cursorRect = cursorRects[i]
mousePress(textInput, cursorRect.x, cursorRect.y + cursorRect.height / 2, Qt.LeftButton, Qt.NoModifier, 20)
mouseRelease(textInput, cursorRect.x, cursorRect.y + cursorRect.height / 2, Qt.LeftButton, Qt.NoModifier, 20)
- waitForRendering(textInput)
}
if (!inputPanel.wordCandidateListVisibleHint && inputPanel.preeditText !== data.expectedPreeditText)
@@ -1764,7 +1804,6 @@ Rectangle {
}
function test_selection(data) {
- waitForRendering(textInput)
prepareTest(data)
compare(inputPanel.cursorHandle.visible, data.expectHandlesToBeVisible)
compare(inputPanel.anchorHandle.visible, data.expectHandlesToBeVisible)
@@ -1793,13 +1832,12 @@ Rectangle {
prepareTest(data)
if (inputPanel.availableLocales.length < 2)
skip("Input language can not be changed")
- var changeLanguageKey = inputPanel.findObjectByName("changeLanguageKey")
var languagePopupList = inputPanel.findObjectByName("languagePopupList")
inputPanel.externalLanguageSwitchSpy.clear()
- inputPanel.virtualKeyClick(changeLanguageKey)
+ inputPanel.doKeyboardFunction("ChangeLanguage")
compare(languagePopupList.visible, !data.externalLanguageSwitchEnabled)
compare(inputPanel.externalLanguageSwitchSpy.count, data.externalLanguageSwitchEnabled ? 1 : 0)
- inputPanel.virtualKeyClick(changeLanguageKey)
+ inputPanel.doKeyboardFunction("ChangeLanguage")
compare(languagePopupList.visible, false)
}
@@ -1807,9 +1845,8 @@ Rectangle {
prepareTest()
if (inputPanel.availableLocales.length < 2)
skip("Input language can not be changed")
- var changeLanguageKey = inputPanel.findObjectByName("changeLanguageKey")
var languagePopupList = inputPanel.findObjectByName("languagePopupList")
- inputPanel.virtualKeyClick(changeLanguageKey)
+ inputPanel.doKeyboardFunction("ChangeLanguage")
compare(languagePopupList.visible, true)
container.forceActiveFocus()
textInput.forceActiveFocus()
@@ -1820,9 +1857,8 @@ Rectangle {
prepareTest()
if (inputPanel.availableLocales.length < 2)
skip("Input language can not be changed")
- var changeLanguageKey = inputPanel.findObjectByName("changeLanguageKey")
var languagePopupList = inputPanel.findObjectByName("languagePopupList")
- inputPanel.virtualKeyClick(changeLanguageKey)
+ inputPanel.doKeyboardFunction("ChangeLanguage")
compare(languagePopupList.visible, true)
Qt.inputMethod.hide()
Qt.inputMethod.show()
@@ -1846,9 +1882,8 @@ Rectangle {
}
}
- var changeLanguageKey = inputPanel.findObjectByName("changeLanguageKey")
var languagePopupList = inputPanel.findObjectByName("languagePopupList")
- inputPanel.virtualKeyClick(changeLanguageKey)
+ inputPanel.doKeyboardFunction("ChangeLanguage")
compare(languagePopupList.visible, data.languagePopupVisible)
if (!data.languagePopupVisible)
@@ -1870,12 +1905,35 @@ Rectangle {
}
compare(inputPanel.locale, data.selectLocale, "Language popup select %1".arg(data.selectLocale))
} else {
- inputPanel.virtualKeyClick(changeLanguageKey)
+ inputPanel.doKeyboardFunction("ChangeLanguage")
}
compare(languagePopupList.visible, false)
}
+ function test_languagePopupListSortOrder_data() {
+ return [
+ { activeLocales: ["fi_FI", "foo", "en_GB", "bar", "ar_AR", "baz"] },
+ ]
+ }
+
+ function test_languagePopupListSortOrder(data) {
+ prepareTest(data)
+
+ if (!inputPanel.keyboard.style.languagePopupListEnabled)
+ skip("The language popup is disabled (!style.languagePopupListEnabled)")
+
+ var languagePopupList = inputPanel.findObjectByName("languagePopupList")
+ inputPanel.doKeyboardFunction("ChangeLanguage")
+
+ var previousIndex = -1
+ for (var i = 0; i < languagePopupList.model.count; ++i) {
+ var currentIndex = data.activeLocales.indexOf(languagePopupList.model.get(i).localeName)
+ verify(currentIndex > previousIndex)
+ previousIndex = currentIndex
+ }
+ }
+
function test_wclAutoHide_data() {
return [
{ wclAutoHideDelay: 100, wclAlwaysVisible: false },
@@ -1888,13 +1946,11 @@ Rectangle {
prepareTest(data)
inputPanel.wordCandidateListChangedSpy.clear()
Qt.inputMethod.show()
- waitForRendering(inputPanel)
compare(inputPanel.wordCandidateView.visibleCondition, data.wclAlwaysVisible)
inputPanel.virtualKeyClick("a")
inputPanel.virtualKeyClick("u")
inputPanel.virtualKeyClick("t")
inputPanel.virtualKeyClick("o")
- waitForRendering(inputPanel)
if (!inputPanel.wordCandidateListVisibleHint)
skip("Prediction/spell correction not enabled")
inputPanel.wordCandidateListChangedSpy.wait(1000)
@@ -1905,7 +1961,6 @@ Rectangle {
wait(data.wclAutoHideDelay + 250)
else
inputPanel.wordCandidateListVisibleSpy.wait(data.wclAutoHideDelay + 500)
- waitForRendering(inputPanel)
compare(inputPanel.wordCandidateView.visibleCondition, data.wclAlwaysVisible)
}
@@ -1922,20 +1977,19 @@ Rectangle {
if (!inputPanel.wordCandidateListVisibleHint)
skip("Prediction/spell correction not enabled")
+ inputPanel.wordCandidateListItemSelectedSpy.clear()
for (var len = 1; len <= 5; ++len) {
inputPanel.virtualKeyClick("z")
- if (len >= 2) {
- inputPanel.inputMethodSelectionListChangedSpy.clear()
- inputPanel.inputMethodSelectionListChangedSpy.wait()
- if (inputPanel.wordCandidateView.model.count <= 1)
- break
+ wait(200)
+ if (inputPanel.wordCandidateListItemSelectedSpy.count > 0) {
+ break
}
}
if (data.wclAutoCommitWord)
- compare(inputPanel.wordCandidateView.model.count, 0)
+ compare(inputPanel.wordCandidateListItemSelectedSpy.count, 1)
else
- verify(inputPanel.wordCandidateView.model.count >= 1)
+ compare(inputPanel.wordCandidateListItemSelectedSpy.count, 0)
}
function test_fullScreenModeActivation() {
@@ -1945,14 +1999,12 @@ Rectangle {
inputPanel.shadowInputControlVisibleSpy.clear()
inputPanel.setFullScreenMode(true)
- waitForRendering(inputPanel)
inputPanel.shadowInputControlVisibleSpy.wait()
compare(inputPanel.shadowInput.text, textInput.text)
inputPanel.shadowInputControlVisibleSpy.clear()
inputPanel.setFullScreenMode(false)
- waitForRendering(inputPanel)
inputPanel.shadowInputControlVisibleSpy.wait()
}
@@ -1974,7 +2026,6 @@ Rectangle {
compare(inputPanel.shadowInput.preeditText, textInput.preeditText)
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
compare(inputPanel.shadowInput.text, textInput.text)
compare(inputPanel.shadowInput.cursorPosition, textInput.cursorPosition)
@@ -1993,7 +2044,6 @@ Rectangle {
prepareTest(data)
data.select()
- waitForRendering(textInput)
compare(inputPanel.shadowInput.text, textInput.text)
compare(inputPanel.shadowInput.cursorPosition, textInput.cursorPosition)
compare(inputPanel.shadowInput.selectedText, textInput.selectedText)
@@ -2030,6 +2080,7 @@ Rectangle {
{ initText: "aa http://www.example.com bb", initInputMethodHints: Qt.ImhUrlCharactersOnly, clickPositions: [4], expectedPreeditText: "http://www.example.com", expectedCursorPosition: 3, expectedText: "aa bb" },
{ initText: "aa username@example.com bb", clickPositions: [4], expectedPreeditText: "username", expectedCursorPosition: 3, expectedText: "aa @example.com bb" },
{ initText: "aa username@example.com bb", initInputMethodHints: Qt.ImhEmailCharactersOnly, clickPositions: [4], expectedPreeditText: "username@example.com", expectedCursorPosition: 3, expectedText: "aa bb" },
+ { initText: "hello world", clickPositions: [1], expectedPreeditText: "hello", expectedCursorPosition: 0, expectedText: " world" },
]
}
@@ -2049,7 +2100,6 @@ Rectangle {
var cursorRect = cursorRects[i]
mousePress(inputPanel.shadowInput, cursorRect.x, cursorRect.y + cursorRect.height / 2, Qt.LeftButton, Qt.NoModifier, 20)
mouseRelease(inputPanel.shadowInput, cursorRect.x, cursorRect.y + cursorRect.height / 2, Qt.LeftButton, Qt.NoModifier, 20)
- waitForRendering(inputPanel.shadowInput)
}
if (!inputPanel.wordCandidateListVisibleHint && inputPanel.preeditText !== data.expectedPreeditText)
@@ -2134,21 +2184,21 @@ Rectangle {
{ inputSequence: ['a','s','d'], initShift: false, expectedSuggestion: "asdf", suggestionIsFromUserDictionary: true },
{ inputSequence: ['a','s','d'], initShift: true, expectedSuggestion: "Asdf", suggestionIsFromUserDictionary: true },
//
- { inputSequence: ['s','d','f','a'], initShift: true },
- { inputSequence: ['s','d','f'], initShift: true, expectedSuggestion: "Sdfa", suggestionIsFromUserDictionary: true },
+ { inputSequence: ['S','d','f','a'], initShift: true },
+ { inputSequence: ['S','d','f'], initShift: true, expectedSuggestion: "Sdfa", suggestionIsFromUserDictionary: true },
{ inputSequence: ['s','d','f'], initShift: false, expectedSuggestion: "sdfa", suggestionIsFromUserDictionary: true, removeSuggestion: true },
//
- { inputSequence: ['d','f','a','s'], initCapsLock: true },
- { inputSequence: ['d','f','a'], initCapsLock: true, expectedSuggestion: "DFAS", suggestionIsFromUserDictionary: true },
+ { inputSequence: ['D','F','A','S'], initCapsLock: true },
+ { inputSequence: ['D','F','A'], initCapsLock: true, expectedSuggestion: "DFAS", suggestionIsFromUserDictionary: true },
{ inputSequence: ['d','f','a'], initShift: false, unexpectedSuggestion: "dfas", suggestionIsFromUserDictionary: true },
//
{ inputSequence: ['f','a','s','d'], initShift: false, initInputMethodHints: Qt.ImhSensitiveData },
{ inputSequence: ['f','a','s'], initShift: false, unexpectedSuggestion: "fasd" },
- { inputSequence: ['f','a','s'], initShift: true, unexpectedSuggestion: "Fasd"},
+ { inputSequence: ['F','a','s'], initShift: true, unexpectedSuggestion: "Fasd"},
//
- { initLocale: "en_GB", inputSequence: "windo", expectedSuggestion: "Window", suggestionIsFromUserDictionary: false, removeSuggestion: true },
- { initLocale: "en_GB", inputSequence: "window", },
- { initLocale: "en_GB", inputSequence: "windo", expectedSuggestion: "Window", suggestionIsFromUserDictionary: false },
+ { initLocale: "en_GB", inputSequence: "windo", initShift: false, expectedSuggestion: "window", suggestionIsFromUserDictionary: false, removeSuggestion: true },
+ { initLocale: "en_GB", inputSequence: "window",initShift: false, },
+ { initLocale: "en_GB", inputSequence: "windo", initShift: false, expectedSuggestion: "window", suggestionIsFromUserDictionary: false },
]
}
@@ -2163,11 +2213,14 @@ Rectangle {
if (data.hasOwnProperty("initCapsLock"))
inputPanel.setCapsLockActive(data.initCapsLock)
- for (var inputIndex in data.inputSequence)
+ var exactWord = ""
+ for (var inputIndex in data.inputSequence) {
inputPanel.virtualKeyClick(data.inputSequence[inputIndex])
+ exactWord += data.inputSequence[inputIndex]
+ }
if (data.hasOwnProperty("expectedSuggestion")) {
- tryVerify(function() {return inputPanel.selectionListSearchSuggestion(data.expectedSuggestion)}, 1000, "The expected spell correction suggestion \"%1\" was not found".arg(data.expectedSuggestion))
+ tryVerify(function() {return inputPanel.selectionListSearchSuggestion(data.expectedSuggestion)}, 10000, "The expected spell correction suggestion \"%1\" was not found".arg(data.expectedSuggestion))
verify(inputPanel.selectionListCurrentIndex() > 0)
if (data.hasOwnProperty("suggestionIsFromUserDictionary"))
compare(inputPanel.selectionListSuggestionIsFromUserDictionary(), data.suggestionIsFromUserDictionary)
@@ -2176,19 +2229,114 @@ Rectangle {
inputPanel.wordCandidateListChangedSpy.clear()
verify(inputPanel.selectItemFromWordCandidateContextMenu(0))
inputPanel.wordCandidateListChangedSpy.wait()
- tryVerify(function() {return !inputPanel.selectionListSearchSuggestion(data.expectedSuggestion)}, 1000, "An unexpected spell correction suggestion \"%1\" was found".arg(data.unexpectedSuggestion))
+ tryVerify(function() {return !inputPanel.selectionListSearchSuggestion(data.expectedSuggestion)}, 10000, "An unexpected spell correction suggestion \"%1\" was found".arg(data.unexpectedSuggestion))
} else {
inputPanel.selectionListSelectCurrentItem()
}
} else if (data.hasOwnProperty("unexpectedSuggestion")) {
var oldIndex = inputPanel.selectionListCurrentIndex()
- tryVerify(function() {return !inputPanel.selectionListSearchSuggestion(data.unexpectedSuggestion)}, 1000, "An unexpected spell correction suggestion \"%1\" was found".arg(data.unexpectedSuggestion))
+ tryVerify(function() {return !inputPanel.selectionListSearchSuggestion(data.unexpectedSuggestion)}, 10000, "An unexpected spell correction suggestion \"%1\" was found".arg(data.unexpectedSuggestion))
compare(inputPanel.selectionListCurrentIndex(), oldIndex)
} else {
+ tryVerify(function() {return inputPanel.selectionListSearchSuggestion(exactWord)}, 1000, "The exact word \"%1\" was not found".arg(exactWord))
inputPanel.selectionListSelectCurrentItem()
}
Qt.inputMethod.reset()
}
+
+ function test_visibleFunctionKey_data() {
+ return [
+ { initLocale: "en_GB", functionKeysAlwaysVisible: false },
+ // Number and digits layouts must always have the function keys, because otherwise the layout design looks bad
+ { initLocale: "en_GB", functionKeysAlwaysVisible: true, initInputMethodHints: Qt.ImhFormattedNumbersOnly },
+ { initLocale: "en_GB", functionKeysAlwaysVisible: true, initInputMethodHints: Qt.ImhDigitsOnly },
+ // Symbol layout follow the main layout
+ { initLocale: "en_GB", functionKeysAlwaysVisible: false, initInputMethodHints: Qt.ImhPreferNumbers },
+ ]
+ }
+
+ function test_visibleFunctionKey(data) {
+ prepareTest(data, true)
+
+ const changeLanguageKey = inputPanel.findKeyByKeyType("ChangeLanguageKey")
+ verify(!!changeLanguageKey)
+ const hideKeyboardKey = inputPanel.findKeyByKeyType("HideKeyboardKey")
+ verify(!!hideKeyboardKey)
+
+ for (const functionKeyName of [
+ "None",
+ "Hide",
+ "Language",
+ "All"
+ ]) {
+ inputPanel.setVisibleFunctionKeys([functionKeyName])
+ if (data.functionKeysAlwaysVisible) {
+ compare(changeLanguageKey.visible, true)
+ compare(hideKeyboardKey.visible, true)
+ } else if (functionKeyName === "None") {
+ compare(changeLanguageKey.visible, false)
+ compare(hideKeyboardKey.visible, false)
+ } else if (functionKeyName === "Hide") {
+ compare(changeLanguageKey.visible, false)
+ compare(hideKeyboardKey.visible, true)
+ } else if (functionKeyName === "Language") {
+ compare(changeLanguageKey.visible, true)
+ compare(hideKeyboardKey.visible, false)
+ } else if (functionKeyName === "All") {
+ compare(changeLanguageKey.visible, true)
+ compare(hideKeyboardKey.visible, true)
+ }
+ }
+ }
+
+ function test_closeOnReturnSingleLine_data() {
+ return [
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyDefault, expectedVisibleAfterReturn: false },
+ { closeOnReturn: false, enterKeyType: Qt.EnterKeyDefault, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyReturn, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyDone, expectedVisibleAfterReturn: false },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyGo, expectedVisibleAfterReturn: false },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeySend, expectedVisibleAfterReturn: false },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeySearch, expectedVisibleAfterReturn: false },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyNext, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyPrevious, expectedVisibleAfterReturn: true },
+ ]
+ }
+
+ function test_closeOnReturnSingleLine(data) {
+ prepareTest(data)
+ let testObj = textFieldComp.createObject(container, {enterKeyType: data.enterKeyType})
+ testObj.forceActiveFocus()
+ compare(inputPanel.closeOnReturn(), data.closeOnReturn)
+ verify(inputPanel.visible === true)
+ keyClick(Qt.Key_Return)
+ waitForRendering(inputPanel)
+ verify(inputPanel.visible === data.expectedVisibleAfterReturn)
+ testObj.destroy()
+ }
+
+ function test_closeOnReturnMultiline_data() {
+ return [
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyDefault, expectedVisibleAfterReturn: true },
+ { closeOnReturn: false, enterKeyType: Qt.EnterKeyDefault, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyReturn, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyDone, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyGo, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeySend, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeySearch, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyNext, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyPrevious, expectedVisibleAfterReturn: true },
+ ]
+ }
+
+ function test_closeOnReturnMultiline(data) {
+ prepareTest(data)
+ compare(inputPanel.closeOnReturn(), data.closeOnReturn)
+ verify(inputPanel.visible === true)
+ keyClick(Qt.Key_Return)
+ waitForRendering(inputPanel)
+ verify(inputPanel.visible === data.expectedVisibleAfterReturn)
+ }
}
}
diff --git a/tests/auto/inputpanel/hwr_test_data/README.txt b/tests/auto/inputpanel/hwr_test_data/README.txt
index ec2903c8..9dd2adca 100644
--- a/tests/auto/inputpanel/hwr_test_data/README.txt
+++ b/tests/auto/inputpanel/hwr_test_data/README.txt
@@ -12,9 +12,9 @@ characters.
The Unipen data can be collected using the virtual keyboard.
To enable the data collection mode, the virtual keyboard must
-be compiled with a special qmake parameters:
+be compiled with a special parameters:
-CONFIG+=lipi-toolkit CONFIG+=record-trace-input
+INPUT_vkb_handwriting FEATURE_vkb_record_trace_input
The first option enables the handwriting recognition engine and
the second option enables the data collection mode.
diff --git a/tests/auto/inputpanel/hwr_test_data/build_unipen_data.py b/tests/auto/inputpanel/hwr_test_data/build_unipen_data.py
index eb4231c3..a7758eb8 100755
--- a/tests/auto/inputpanel/hwr_test_data/build_unipen_data.py
+++ b/tests/auto/inputpanel/hwr_test_data/build_unipen_data.py
@@ -1,33 +1,7 @@
#!/usr/bin/env python
-#############################################################################
-##
-## Copyright (C) 2017 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:GPL$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 or (at your option) any later version
-## approved by the KDE Free Qt Foundation. The licenses are as published by
-## the Free Software Foundation and appearing in the file LICENSE.GPL3
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2017 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -39,34 +13,10 @@ import re
unipen_file_pattern = re.compile(r'(^[0-9]{2,9}).*\.txt')
def print_header():
- print """/****************************************************************************
-**
-** Copyright (C) %s The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/""" % datetime.datetime.now().year
+ print """
+// Copyright (C) %s The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+""" % datetime.datetime.now().year
def scan_unipen_files(path):
file_list = []
diff --git a/tests/auto/inputpanel/inputpanel.pro b/tests/auto/inputpanel/inputpanel.pro
deleted file mode 100644
index 053ad1cf..00000000
--- a/tests/auto/inputpanel/inputpanel.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-TARGET = tst_inputpanel
-
-QT += testlib
-CONFIG += qmltestcase console
-
-contains(CONFIG, static) {
- QT += svg
- QTPLUGIN += qtvirtualkeyboardplugin
-}
-
-SOURCES += $$PWD/tst_inputpanel.cpp
-
-TESTDATA = $$PWD/data/*
-
-OTHER_FILES += \
- $$PWD/data/inputpanel/inputpanel.qml \
- $$PWD/data/inputpanel/handwritinginputpanel.qml \
- $$PWD/data/tst_inputpanel.qml \
diff --git a/tests/auto/inputpanel/tst_inputpanel.cpp b/tests/auto/inputpanel/tst_inputpanel.cpp
index 409383c7..41a3f967 100644
--- a/tests/auto/inputpanel/tst_inputpanel.cpp
+++ b/tests/auto/inputpanel/tst_inputpanel.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtQuickTest/quicktest.h>
#include <QByteArray>
@@ -33,18 +7,25 @@
#include <QFileInfo>
#include <QDir>
-static bool s_configEnv = qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
-static bool initStandardPaths() {
- QStandardPaths::setTestModeEnabled(true);
- auto configLocations = QStringList()
- << QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/qtvirtualkeyboard"
- << QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/qtvirtualkeyboard";
- for (const QString &configLocation : configLocations) {
- if (configLocation != "/qtvirtualkeyboard")
- QDir(configLocation).removeRecursively();
+namespace
+{
+
+struct VirtualKeyboardSetup : QObject
+{
+ VirtualKeyboardSetup()
+ {
+ qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
+ QStandardPaths::setTestModeEnabled(true);
+ auto configLocations = QStringList()
+ << QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/qtvirtualkeyboard"
+ << QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/qtvirtualkeyboard";
+ for (const QString &configLocation : configLocations) {
+ if (configLocation != "/qtvirtualkeyboard")
+ QDir(configLocation).removeRecursively();
+ }
}
- return true;
+};
+
}
-static bool s_initStandardPaths = initStandardPaths();
-QUICK_TEST_MAIN(inputpanel)
+QUICK_TEST_MAIN_WITH_SETUP(inputpanel, VirtualKeyboardSetup)
diff --git a/tests/auto/inputpanelcontrols/CMakeLists.txt b/tests/auto/inputpanelcontrols/CMakeLists.txt
new file mode 100644
index 00000000..665f97d9
--- /dev/null
+++ b/tests/auto/inputpanelcontrols/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/data/*)
+list(APPEND test_data ${test_data_glob})
+
+qt_internal_add_test(tst_inputpanelcontrols
+ QMLTEST
+ SOURCES
+ tst_inputpanelcontrols.cpp
+ LIBRARIES
+ Qt::Gui
+ TESTDATA ${test_data}
+)
diff --git a/tests/auto/inputpanelcontrols/data/inputpanel/inputpanel.qml b/tests/auto/inputpanelcontrols/data/inputpanel/inputpanel.qml
new file mode 100644
index 00000000..582e7ea4
--- /dev/null
+++ b/tests/auto/inputpanelcontrols/data/inputpanel/inputpanel.qml
@@ -0,0 +1,15 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+InputPanel {
+ id: inputPanel
+ z: 99
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ visible: active
+}
diff --git a/tests/auto/inputpanelcontrols/data/tst_inputpanelcontrols.qml b/tests/auto/inputpanelcontrols/data/tst_inputpanelcontrols.qml
new file mode 100644
index 00000000..a244e752
--- /dev/null
+++ b/tests/auto/inputpanelcontrols/data/tst_inputpanelcontrols.qml
@@ -0,0 +1,98 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.Window
+import QtQuick.Controls
+
+Rectangle {
+ id: container
+ width: 800
+ height: 640
+ color: "blue"
+
+ Component {
+ id: textInputComp
+ TextEdit {
+ anchors.fill: parent
+ visible: true
+ focus: true
+ color: "white"
+ }
+ }
+
+ TestCase {
+ id: testcase
+ name: "tst_inputpanelcontrols"
+ when: windowShown
+
+ property var inputPanel: null
+ property var textInput: null
+
+ function initTestCase() {
+ var inputPanelComp = Qt.createComponent("inputpanel/inputpanel.qml")
+ compare(inputPanelComp.status, Component.Ready, "Failed to create component: "+inputPanelComp.errorString())
+ inputPanel = inputPanelComp.createObject(container)
+
+ textInput = textInputComp.createObject(container)
+ }
+
+ function cleanupTestCase() {
+ if (inputPanel)
+ inputPanel.destroy()
+ }
+
+ function prepareTest() {
+ var window = container.Window.window
+ verify(window)
+ window.raise()
+ window.requestActivate()
+ tryCompare(window, "active", true)
+
+ container.forceActiveFocus()
+ waitForRendering(container)
+ textInput.forceActiveFocus()
+ waitForRendering(inputPanel)
+
+ textInput.text = ""
+ verify(inputPanel.visible === true)
+ verify(textInput.activeFocus === true)
+ }
+
+ Component {
+ id: modalDialogComp
+ Dialog {
+ id: dialog
+ modal: true
+ anchors.centerIn: parent
+ width: 200
+ height: 150
+ property alias textEdit: textEdit
+ TextEdit {
+ id: textEdit
+ visible: true
+ focus: true
+ color: "red"
+ }
+ }
+ }
+
+ function test_worksWithModal() {
+ prepareTest()
+ var modalDialog = modalDialogComp.createObject(container)
+ modalDialog.open()
+ modalDialog.forceActiveFocus()
+
+ verify(modalDialog.textEdit.activeFocus === true)
+ compare(modalDialog.textEdit.text, "")
+ verify(inputPanel.visible === true)
+ waitForRendering(inputPanel)
+
+ mousePress(inputPanel, 10, 10, Qt.LeftButton, Qt.NoModifier, 20)
+ verify(modalDialog.visible === true)
+ mouseRelease(inputPanel, 10, 10, Qt.LeftButton, Qt.NoModifier, 20)
+ compare(modalDialog.textEdit.text, "Q")
+ }
+ }
+}
diff --git a/tests/auto/inputpanelcontrols/tst_inputpanelcontrols.cpp b/tests/auto/inputpanelcontrols/tst_inputpanelcontrols.cpp
new file mode 100644
index 00000000..d06b2410
--- /dev/null
+++ b/tests/auto/inputpanelcontrols/tst_inputpanelcontrols.cpp
@@ -0,0 +1,31 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtQuickTest/quicktest.h>
+#include <QByteArray>
+#include <QStandardPaths>
+#include <QFileInfo>
+#include <QDir>
+
+namespace
+{
+
+struct VirtualKeyboardSetup : QObject
+{
+ VirtualKeyboardSetup()
+ {
+ qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
+ QStandardPaths::setTestModeEnabled(true);
+ auto configLocations = QStringList()
+ << QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/qtvirtualkeyboard"
+ << QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/qtvirtualkeyboard";
+ for (const QString &configLocation : configLocations) {
+ if (configLocation != "/qtvirtualkeyboard")
+ QDir(configLocation).removeRecursively();
+ }
+ }
+};
+
+}
+
+QUICK_TEST_MAIN_WITH_SETUP(inputpanelcontrols, VirtualKeyboardSetup)
diff --git a/tests/auto/layoutfilesystem/BLACKLIST b/tests/auto/layoutfilesystem/BLACKLIST
new file mode 100644
index 00000000..0ab84b92
--- /dev/null
+++ b/tests/auto/layoutfilesystem/BLACKLIST
@@ -0,0 +1,3 @@
+# QTBUG-102756
+[layouts]
+android
diff --git a/tests/auto/layoutfilesystem/CMakeLists.txt b/tests/auto/layoutfilesystem/CMakeLists.txt
index b0f9d70e..0232b449 100644
--- a/tests/auto/layoutfilesystem/CMakeLists.txt
+++ b/tests/auto/layoutfilesystem/CMakeLists.txt
@@ -1,18 +1,21 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from layoutfilesystem.pro.
#####################################################################
## tst_layoutfilesystem Test:
#####################################################################
-qt_add_test(tst_layoutfilesystem
+qt_internal_add_test(tst_layoutfilesystem
SOURCES
../shared/layouttesthelper.cpp ../shared/layouttesthelper.h
tst_layoutfilesystem.cpp
DEFINES
- SRC_DIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}\\\"
+ SRC_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
INCLUDE_DIRECTORIES
../shared
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Qml
Qt::Quick
@@ -24,8 +27,8 @@ qt_add_test(tst_layoutfilesystem
## Scopes:
#####################################################################
-qt_extend_target(tst_layoutfilesystem CONDITION static
- PUBLIC_LIBRARIES
+qt_internal_extend_target(tst_layoutfilesystem CONDITION NOT QT_BUILD_SHARED_LIBS
+ LIBRARIES
Qt::Svg
)
diff --git a/tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml b/tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml
index e58b8d66..787afd3d 100644
--- a/tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml
+++ b/tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml
@@ -1,34 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pelagicore AB
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pelagicore AB
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
KeyboardLayout {
objectName: "en_GB"
diff --git a/tests/auto/layoutfilesystem/layoutfilesystem.pro b/tests/auto/layoutfilesystem/layoutfilesystem.pro
deleted file mode 100644
index 6be71fd5..00000000
--- a/tests/auto/layoutfilesystem/layoutfilesystem.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-CONFIG += testcase
-TARGET = tst_layoutfilesystem
-
-macos:CONFIG -= app_bundle
-
-QT += testlib qml quick
-
-static {
- QT += svg
- QTPLUGIN += qtvirtualkeyboardplugin
-}
-
-include(../shared/layouttest.pri)
-
-SOURCES += $$PWD/tst_layoutfilesystem.cpp
-
-OTHER_FILES += \
- data/layouts/en_GB/main.qml \
-
-DEFINES += SRC_DIR=\\\"$$PWD\\\"
diff --git a/tests/auto/layoutfilesystem/tst_layoutfilesystem.cpp b/tests/auto/layoutfilesystem/tst_layoutfilesystem.cpp
index 1d906712..a18fbea6 100644
--- a/tests/auto/layoutfilesystem/tst_layoutfilesystem.cpp
+++ b/tests/auto/layoutfilesystem/tst_layoutfilesystem.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pelagicore AB
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pelagicore AB
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "layouttesthelper.h"
diff --git a/tests/auto/layoutresources/CMakeLists.txt b/tests/auto/layoutresources/CMakeLists.txt
index b7c14247..42c26bf5 100644
--- a/tests/auto/layoutresources/CMakeLists.txt
+++ b/tests/auto/layoutresources/CMakeLists.txt
@@ -1,18 +1,21 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from layoutresources.pro.
#####################################################################
## tst_layoutresources Test:
#####################################################################
-qt_add_test(tst_layoutresources
+qt_internal_add_test(tst_layoutresources
SOURCES
../shared/layouttesthelper.cpp ../shared/layouttesthelper.h
tst_layoutresources.cpp
DEFINES
- SRC_DIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}\\\"
+ SRC_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
INCLUDE_DIRECTORIES
../shared
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Qml
Qt::Quick
@@ -20,10 +23,10 @@ qt_add_test(tst_layoutresources
# Resources:
set(resourceslayout_resource_files
- "layouts/en_GB/main.qml"
+ "data/layouts/en_GB/main.qml"
)
-qt_add_resource(tst_layoutresources "resourceslayout"
+qt_internal_add_resource(tst_layoutresources "resourceslayout"
PREFIX
"/resource"
BASE
@@ -36,8 +39,8 @@ qt_add_resource(tst_layoutresources "resourceslayout"
## Scopes:
#####################################################################
-qt_extend_target(tst_layoutresources CONDITION static
- PUBLIC_LIBRARIES
+qt_internal_extend_target(tst_layoutresources CONDITION NOT QT_BUILD_SHARED_LIBS
+ LIBRARIES
Qt::Svg
)
diff --git a/tests/auto/layoutresources/data/layouts/en_GB/main.qml b/tests/auto/layoutresources/data/layouts/en_GB/main.qml
index e58b8d66..787afd3d 100644
--- a/tests/auto/layoutresources/data/layouts/en_GB/main.qml
+++ b/tests/auto/layoutresources/data/layouts/en_GB/main.qml
@@ -1,34 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pelagicore AB
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pelagicore AB
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
KeyboardLayout {
objectName: "en_GB"
diff --git a/tests/auto/layoutresources/data/resourceslayout.qrc b/tests/auto/layoutresources/data/resourceslayout.qrc
deleted file mode 100644
index b95db56a..00000000
--- a/tests/auto/layoutresources/data/resourceslayout.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="resource">
- <file>layouts/en_GB/main.qml</file>
- </qresource>
-</RCC>
diff --git a/tests/auto/layoutresources/layoutresources.pro b/tests/auto/layoutresources/layoutresources.pro
deleted file mode 100644
index edf608df..00000000
--- a/tests/auto/layoutresources/layoutresources.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-CONFIG += testcase
-TARGET = tst_layoutresources
-
-macos:CONFIG -= app_bundle
-
-QT += testlib qml quick
-
-static {
- QT += svg
- QTPLUGIN += qtvirtualkeyboardplugin
-}
-
-include(../shared/layouttest.pri)
-
-SOURCES += $$PWD/tst_layoutresources.cpp
-
-RESOURCES += \
- $$PWD/data/resourceslayout.qrc
-
-DEFINES += SRC_DIR=\\\"$$PWD\\\"
diff --git a/tests/auto/layoutresources/tst_layoutresources.cpp b/tests/auto/layoutresources/tst_layoutresources.cpp
index e9509ed2..a3fa48e6 100644
--- a/tests/auto/layoutresources/tst_layoutresources.cpp
+++ b/tests/auto/layoutresources/tst_layoutresources.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pelagicore AB
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pelagicore AB
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "layouttesthelper.h"
diff --git a/tests/auto/shadowinput/CMakeLists.txt b/tests/auto/shadowinput/CMakeLists.txt
new file mode 100644
index 00000000..e7668ba8
--- /dev/null
+++ b/tests/auto/shadowinput/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/data/*)
+list(APPEND test_data ${test_data_glob})
+
+qt_internal_add_test(tst_shadowinput
+ QMLTEST
+ SOURCES
+ tst_shadowinput.cpp
+ LIBRARIES
+ Qt::Gui
+ TESTDATA ${test_data}
+)
diff --git a/tests/auto/shadowinput/data/inputpanel/inputpanel.qml b/tests/auto/shadowinput/data/inputpanel/inputpanel.qml
new file mode 100644
index 00000000..9879c40f
--- /dev/null
+++ b/tests/auto/shadowinput/data/inputpanel/inputpanel.qml
@@ -0,0 +1,24 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Settings
+
+InputPanel {
+ id: inputPanel
+ z: 99
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ visible: active
+ property bool fullScreenMode: true
+ property bool shadowInputVisible: keyboard.shadowInputControl.visible
+ property string shadowInputText: keyboard.shadowInputControl.textEdit.text
+ Binding {
+ target: VirtualKeyboardSettings
+ property: "fullScreenMode"
+ value: inputPanel.fullScreenMode
+ }
+}
diff --git a/tests/auto/shadowinput/data/tst_shadowinput.qml b/tests/auto/shadowinput/data/tst_shadowinput.qml
new file mode 100644
index 00000000..fbe79c82
--- /dev/null
+++ b/tests/auto/shadowinput/data/tst_shadowinput.qml
@@ -0,0 +1,92 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.Window
+
+Rectangle {
+ id: container
+ width: 800
+ height: 640
+ color: "blue"
+
+ Component {
+ id: textInputComp
+ TextEdit {
+ anchors.fill: parent
+ visible: true
+ focus: true
+ color: "white"
+ }
+ }
+
+ TestCase {
+ id: testcase
+ name: "tst_inputpanelcontrols"
+ when: windowShown
+
+ property var inputPanel: null
+ property var textInput: null
+
+ function initTestCase() {
+ var inputPanelComp = Qt.createComponent("inputpanel/inputpanel.qml")
+ compare(inputPanelComp.status, Component.Ready, "Failed to create component: "+inputPanelComp.errorString())
+ inputPanel = inputPanelComp.createObject(container)
+
+ textInput = textEditComp.createObject(container)
+ }
+
+ function cleanupTestCase() {
+ if (inputPanel)
+ inputPanel.destroy()
+ }
+
+ function prepareTest() {
+ var window = container.Window.window
+ verify(window)
+ window.raise()
+ window.requestActivate()
+ tryCompare(window, "active", true)
+
+ container.forceActiveFocus()
+ waitForRendering(container)
+ textInput.forceActiveFocus()
+ waitForRendering(inputPanel)
+
+ textInput.text = ""
+ verify(inputPanel.visible === true)
+ verify(textInput.activeFocus === true)
+ }
+
+ Component {
+ id: textEditComp
+ TextEdit {
+ id: textEdit
+ visible: true
+ focus: true
+ color: "white"
+ }
+ }
+
+ function test_fullScreenModeBindingWorks() {
+ prepareTest()
+
+ verify(inputPanel.visible === true)
+ waitForRendering(inputPanel)
+
+ // VirtualKeyboardSettings.fullScreeenMode is initially true
+ // Verity that shadow input is visible and the content match with the edit field
+ verify(inputPanel.shadowInputVisible)
+ textInput.text = "hello"
+ compare(inputPanel.shadowInputText, textInput.text)
+
+ // Disable fullScreenMode and verify
+ inputPanel.fullScreenMode = false
+ waitForRendering(inputPanel)
+ verify(!inputPanel.shadowInputVisible)
+ textInput.text = "world"
+ compare(inputPanel.shadowInputText, "")
+ }
+ }
+}
diff --git a/tests/auto/shadowinput/tst_shadowinput.cpp b/tests/auto/shadowinput/tst_shadowinput.cpp
new file mode 100644
index 00000000..afa0bb28
--- /dev/null
+++ b/tests/auto/shadowinput/tst_shadowinput.cpp
@@ -0,0 +1,23 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtQuickTest/quicktest.h>
+#include <QByteArray>
+#include <QStandardPaths>
+#include <QFileInfo>
+#include <QDir>
+
+namespace
+{
+
+struct VirtualKeyboardSetup : QObject
+{
+ VirtualKeyboardSetup()
+ {
+ qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
+ }
+};
+
+}
+
+QUICK_TEST_MAIN_WITH_SETUP(shadowinput, VirtualKeyboardSetup)
diff --git a/tests/auto/shared/layouttest.pri b/tests/auto/shared/layouttest.pri
deleted file mode 100644
index 3cb9a575..00000000
--- a/tests/auto/shared/layouttest.pri
+++ /dev/null
@@ -1,5 +0,0 @@
-INCLUDEPATH += $$PWD
-DEPENDPATH += $$PWD
-
-SOURCES += $$PWD/layouttesthelper.cpp
-HEADERS += $$PWD/layouttesthelper.h
diff --git a/tests/auto/shared/layouttesthelper.cpp b/tests/auto/shared/layouttesthelper.cpp
index 54acf9c5..266906fe 100644
--- a/tests/auto/shared/layouttesthelper.cpp
+++ b/tests/auto/shared/layouttesthelper.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pelagicore AB
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pelagicore AB
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "layouttesthelper.h"
@@ -42,7 +16,8 @@ LayoutTestHelper::LayoutTestHelper()
Window { \
property var settings: VirtualKeyboardSettings; \
InputPanel { \
- id: inputPanel \
+ id: inputPanel; \
+ width: parent.width; \
} \
}", QUrl());
window.reset(qobject_cast<QQuickWindow*>(component->create()));
diff --git a/tests/auto/shared/layouttesthelper.h b/tests/auto/shared/layouttesthelper.h
index 93ddb6e2..c61fa75c 100644
--- a/tests/auto/shared/layouttesthelper.h
+++ b/tests/auto/shared/layouttesthelper.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pelagicore AB
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pelagicore AB
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/qscopedpointer.h>
#include <QtCore/QString>
diff --git a/tests/auto/styles/BLACKLIST b/tests/auto/styles/BLACKLIST
new file mode 100644
index 00000000..9e519abd
--- /dev/null
+++ b/tests/auto/styles/BLACKLIST
@@ -0,0 +1,3 @@
+# QTBUG-102756
+[tst_styles::test_style]
+android
diff --git a/tests/auto/styles/CMakeLists.txt b/tests/auto/styles/CMakeLists.txt
index 48240152..92f77c18 100644
--- a/tests/auto/styles/CMakeLists.txt
+++ b/tests/auto/styles/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from styles.pro.
#####################################################################
@@ -10,17 +13,35 @@ file(GLOB_RECURSE test_data_glob
${CMAKE_CURRENT_SOURCE_DIR}/data/*)
list(APPEND test_data ${test_data_glob})
-qt_add_test(tst_styles
+qt_internal_add_test(tst_styles
QMLTEST
SOURCES
tst_styles.cpp
DEFINES
- TESTDATA_DIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\"
- PUBLIC_LIBRARIES
+ TESTDATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data"
+ LIBRARIES
Qt::Gui
TESTDATA ${test_data}
)
+qt_internal_add_resource(tst_styles "test_res"
+ PREFIX
+ "/qt/qml/QtQuick/VirtualKeyboard/Styles/test_res"
+ BASE
+ "data/QtQuick/VirtualKeyboard/Styles/test"
+ FILES
+ "data/QtQuick/VirtualKeyboard/Styles/test/style.qml"
+)
+
+qt_internal_add_resource(tst_styles "test_res_compat"
+ PREFIX
+ "/QtQuick/VirtualKeyboard/content/styles/test_res_compat"
+ BASE
+ "data/QtQuick/VirtualKeyboard/Styles/test"
+ FILES
+ "data/QtQuick/VirtualKeyboard/Styles/test/style.qml"
+)
+
#### Keys ignored in scope 1:.:.:styles.pro:<TRUE>:
# DISTFILES = "data/tst_styles.qml" "data/QtQuick/VirtualKeyboard/Styles/test/style.qml"
# OTHER_FILES = "$$PWD/data/tst_styles.qml"
@@ -29,8 +50,8 @@ qt_add_test(tst_styles
## Scopes:
#####################################################################
-qt_extend_target(tst_styles CONDITION static
- PUBLIC_LIBRARIES
+qt_internal_extend_target(tst_styles CONDITION NOT QT_BUILD_SHARED_LIBS
+ LIBRARIES
Qt::Svg
)
diff --git a/tests/auto/styles/data/QtQuick/VirtualKeyboard/Styles/test/style.qml b/tests/auto/styles/data/QtQuick/VirtualKeyboard/Styles/test/style.qml
index efb8e3bd..80ac843d 100644
--- a/tests/auto/styles/data/QtQuick/VirtualKeyboard/Styles/test/style.qml
+++ b/tests/auto/styles/data/QtQuick/VirtualKeyboard/Styles/test/style.qml
@@ -1,35 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jeremy Katz
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jeremy Katz
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-import QtQuick.VirtualKeyboard.Styles 2.1
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Styles
KeyboardStyle {
diff --git a/tests/auto/styles/data/tst_styles.qml b/tests/auto/styles/data/tst_styles.qml
index 0b4d3b37..f5661b07 100644
--- a/tests/auto/styles/data/tst_styles.qml
+++ b/tests/auto/styles/data/tst_styles.qml
@@ -1,35 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jeremy Katz
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jeremy Katz
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtTest 1.0
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard.Settings 2.0
+import QtTest
+import QtQuick
+import QtQuick.VirtualKeyboard.Settings
+import QtQuick.VirtualKeyboard.Styles
Item {
@@ -41,7 +16,9 @@ Item {
return [
{ tag: "default", result: "default"},
{ tag: "retro", result: "retro"}, // in-source alternate style
- { tag: "test", result: "test"} // out-of-source alternate style
+ { tag: "test", result: "test"}, // out-of-source alternate style
+ { tag: "test_res", result: "test_res"}, // default resource path
+ { tag: "test_res_compat", result: "test_res_compat"}, // compatibility resource path
];
}
diff --git a/tests/auto/styles/styles.pro b/tests/auto/styles/styles.pro
deleted file mode 100644
index eda24717..00000000
--- a/tests/auto/styles/styles.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-TEMPLATE = app
-TARGET = tst_styles
-
-QT += testlib
-CONFIG += qmltestcase console
-
-static {
- QT += svg
- QTPLUGIN += qtvirtualkeyboardplugin
-}
-
-SOURCES += $$PWD/tst_styles.cpp
-
-TESTDATA = $$PWD/data/*
-DEFINES += TESTDATA_DIR=\\\"$$_PRO_FILE_PWD_/data\\\"
-
-OTHER_FILES += \
- $$PWD/data/tst_styles.qml \
-
-DISTFILES += \
- data/tst_styles.qml \
- data/QtQuick/VirtualKeyboard/Styles/test/style.qml \
-
diff --git a/tests/auto/styles/tst_styles.cpp b/tests/auto/styles/tst_styles.cpp
index 3d2a329f..4f728955 100644
--- a/tests/auto/styles/tst_styles.cpp
+++ b/tests/auto/styles/tst_styles.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jeremy Katz
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jeremy Katz
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtQuickTest/quicktest.h>
#include <QByteArray>
diff --git a/tests/auto/virtualkeyboardattached/CMakeLists.txt b/tests/auto/virtualkeyboardattached/CMakeLists.txt
new file mode 100644
index 00000000..b3221bd2
--- /dev/null
+++ b/tests/auto/virtualkeyboardattached/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/data/*)
+list(APPEND test_data ${test_data_glob})
+
+qt_internal_add_test(tst_virtualkeyboardattached
+ QMLTEST
+ SOURCES
+ tst_virtualkeyboardattached.cpp
+ LIBRARIES
+ Qt::Gui
+ TESTDATA ${test_data}
+)
diff --git a/tests/auto/virtualkeyboardattached/data/inputpanel/inputpanel.qml b/tests/auto/virtualkeyboardattached/data/inputpanel/inputpanel.qml
new file mode 100644
index 00000000..80fe6265
--- /dev/null
+++ b/tests/auto/virtualkeyboardattached/data/inputpanel/inputpanel.qml
@@ -0,0 +1,16 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Settings
+
+InputPanel {
+ id: inputPanel
+ z: 99
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ visible: active
+}
diff --git a/tests/auto/virtualkeyboardattached/data/tst_virtualkeyboardattached.qml b/tests/auto/virtualkeyboardattached/data/tst_virtualkeyboardattached.qml
new file mode 100644
index 00000000..b158f603
--- /dev/null
+++ b/tests/auto/virtualkeyboardattached/data/tst_virtualkeyboardattached.qml
@@ -0,0 +1,99 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.Window
+import QtQuick.VirtualKeyboard
+
+Rectangle {
+ id: container
+ width: 800
+ height: 640
+ color: "blue"
+
+ TestCase {
+ id: testcase
+ name: "tst_virtualkeyboardattached"
+ when: windowShown
+
+ property var inputPanel: null
+
+ function initTestCase() {
+ var inputPanelComp = Qt.createComponent("inputpanel/inputpanel.qml")
+ compare(inputPanelComp.status, Component.Ready, "Failed to create component: "+inputPanelComp.errorString())
+ inputPanel = inputPanelComp.createObject(container)
+ }
+
+ function cleanupTestCase() {
+ if (inputPanel)
+ inputPanel.destroy()
+ }
+
+ function prepareTest() {
+ var window = container.Window.window
+ verify(window)
+ window.raise()
+ window.requestActivate()
+ tryCompare(window, "active", true)
+ }
+
+ Component {
+ id: textInputWithVirtualKeyboardAttachedComp
+ TextEdit {
+ anchors.fill: parent
+ visible: true
+ focus: true
+ color: "white"
+ VirtualKeyboard.extraDictionaries: ["example"]
+ }
+ }
+
+ function test_virtualKeyboardAttached() {
+ prepareTest()
+
+ container.forceActiveFocus()
+ waitForRendering(container)
+
+ let textInput = textInputWithVirtualKeyboardAttachedComp.createObject(container)
+
+ verify(textInput !== null)
+
+ textInput.forceActiveFocus()
+ waitForRendering(inputPanel)
+
+ verify(inputPanel.visible === true)
+ verify(textInput.activeFocus === true)
+ }
+
+ Component {
+ id: textInputWithEnterKeyActionAttachedComp
+ TextEdit {
+ anchors.fill: parent
+ visible: true
+ focus: true
+ color: "white"
+ EnterKeyAction.actionId: EnterKeyAction.Done
+ EnterKeyAction.label: "hello"
+ EnterKeyAction.enabled: true
+ }
+ }
+
+ function test_enterKeyActionAttached() {
+ prepareTest()
+
+ container.forceActiveFocus()
+ waitForRendering(container)
+
+ let textInput = textInputWithEnterKeyActionAttachedComp.createObject(container)
+
+ verify(textInput !== null)
+
+ textInput.forceActiveFocus()
+ waitForRendering(inputPanel)
+
+ verify(inputPanel.visible === true)
+ verify(textInput.activeFocus === true)
+ }
+ }
+}
diff --git a/tests/auto/virtualkeyboardattached/tst_virtualkeyboardattached.cpp b/tests/auto/virtualkeyboardattached/tst_virtualkeyboardattached.cpp
new file mode 100644
index 00000000..5bf71dfb
--- /dev/null
+++ b/tests/auto/virtualkeyboardattached/tst_virtualkeyboardattached.cpp
@@ -0,0 +1,12 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtQuickTest/quicktest.h>
+#include <QByteArray>
+#include <QStandardPaths>
+#include <QFileInfo>
+#include <QDir>
+
+static bool s_configEnv = qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
+
+QUICK_TEST_MAIN(virtualkeyboardattached)