aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktextinput
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-23 13:06:38 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-26 16:57:00 +0100
commitd3423e2d20272809b9ba1263762819543446cbe9 (patch)
treec3bda6e4323bdfdbc06f60b6e4f5b630ddf9430c /tests/auto/quick/qquicktextinput
parente43a4854edbebf676c58d60716541ecc0493592f (diff)
Fix some compiler warnings in tests
Use char16_t instead of quint16 for arrays of 16bit strings. Use QKeyCombination API. As a drive-by, remove superfluous 0 from characters specified in hexadecimal. Change-Id: Ic52b1fdceaf3348a9b81c40814031e9c2e557dd9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicktextinput')
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index f95c2547a2..c7609623c9 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -274,12 +274,8 @@ void tst_qquicktextinput::simulateKeys(QWindow *window, const QList<Key> &keys)
void tst_qquicktextinput::simulateKeys(QWindow *window, const QKeySequence &sequence)
{
- for (int i = 0; i < sequence.count(); ++i) {
- const int key = sequence[i];
- const int modifiers = key & Qt::KeyboardModifierMask;
-
- QTest::keyClick(window, Qt::Key(key & ~modifiers), Qt::KeyboardModifiers(modifiers));
- }
+ for (int i = 0; i < sequence.count(); ++i)
+ QTest::keyClick(window, sequence[i].key(), sequence[i].keyboardModifiers());
}
QList<Key> &operator <<(QList<Key> &keys, const QKeySequence &sequence)
@@ -851,7 +847,7 @@ void tst_qquicktextinput::isRightToLeft_data()
QTest::addColumn<bool>("midString");
QTest::addColumn<bool>("endString");
- const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647};
+ const char16_t arabic_str[] = { 0x0638, 0x0643, 0x0646, 0x0647, 0x0633, 0x0638, 0x0643, 0x0646, 0x0647, 0x0633, 0x0647};
QTest::newRow("Empty") << "" << false << false << false << false << false << false << false;
QTest::newRow("Neutral") << "23244242" << false << false << false << false << false << false << false;
QTest::newRow("LTR") << "Hello world" << false << false << false << false << false << false << false;
@@ -2574,7 +2570,7 @@ void tst_qquicktextinput::navigation_RTL()
QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput")));
QVERIFY(input != nullptr);
- const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647};
+ const char16_t arabic_str[] = { 0x0638, 0x0643, 0x0646, 0x0647, 0x0633, 0x0638, 0x0643, 0x0646, 0x0647, 0x0633, 0x0647};
input->setText(QString::fromUtf16(arabic_str, 11));
input->setCursorPosition(0);
@@ -3102,7 +3098,7 @@ void tst_qquicktextinput::cursorVisible()
void tst_qquicktextinput::cursorRectangle_data()
{
- const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647};
+ const char16_t arabic_str[] = { 0x0638, 0x0643, 0x0646, 0x0647, 0x0633, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0638, 0x0643, 0x0646, 0x0647, 0x0633, 0x0647};
QTest::addColumn<QString>("text");
QTest::addColumn<int>("positionAtWidth");
@@ -5934,7 +5930,7 @@ void tst_qquicktextinput::clear()
void tst_qquicktextinput::backspaceSurrogatePairs()
{
// Test backspace, and delete remove both characters in a surrogate pair.
- static const quint16 textData[] = { 0xd800, 0xdf00, 0xd800, 0xdf01, 0xd800, 0xdf02, 0xd800, 0xdf03, 0xd800, 0xdf04 };
+ static const char16_t textData[] = { 0xd800, 0xdf00, 0xd800, 0xdf01, 0xd800, 0xdf02, 0xd800, 0xdf03, 0xd800, 0xdf04 };
const QString text = QString::fromUtf16(textData, lengthOf(textData));
QString componentStr = "import QtQuick 2.0\nTextInput { focus: true }";