From d3423e2d20272809b9ba1263762819543446cbe9 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 23 Oct 2020 13:06:38 +0200 Subject: 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 --- tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'tests/auto/quick/qquicktextinput') 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 &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 &operator <<(QList &keys, const QKeySequence &sequence) @@ -851,7 +847,7 @@ void tst_qquicktextinput::isRightToLeft_data() QTest::addColumn("midString"); QTest::addColumn("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(qvariant_cast(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("text"); QTest::addColumn("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 }"; -- cgit v1.2.3