aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-03-18 10:49:12 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-03-19 01:55:53 +0000
commite14aa2175a443ee3cc0d6c9706c15d120f640773 (patch)
treeb5614931e0b42b39cd9a52e44e1714e61b6bc4bb
parenta8eda1de24f1034f57810156622f0edd68aa13df (diff)
Build tests without warnings after qtbase changes
Replace deprecated QString::count with QString::size or QString::length, depending on context, and use qsizetype instead of int. Change-Id: Ie4c08abd2cf2ba771c23e8def72756170cc07af7 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 6fca2c1a6d5ae24a5ae48844df7579acc2656628) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/qml/debugger/qqmldebugtranslationclient/tst_qqmldebugtranslationclient.cpp10
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp22
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp22
3 files changed, 27 insertions, 27 deletions
diff --git a/tests/auto/qml/debugger/qqmldebugtranslationclient/tst_qqmldebugtranslationclient.cpp b/tests/auto/qml/debugger/qqmldebugtranslationclient/tst_qqmldebugtranslationclient.cpp
index 1c73eb8521..2cdf0a5029 100644
--- a/tests/auto/qml/debugger/qqmldebugtranslationclient/tst_qqmldebugtranslationclient.cpp
+++ b/tests/auto/qml/debugger/qqmldebugtranslationclient/tst_qqmldebugtranslationclient.cpp
@@ -121,20 +121,20 @@ private:
QString getNewProcessOutput(int updateTimeOut = 10)
{
- int newCurrentOutputLine = 0;
+ qsizetype newCurrentOutputLine = 0;
int counter = 0;
do {
counter++;
- newCurrentOutputLine = m_process->output().count();
+ newCurrentOutputLine = m_process->output().size();
if (newCurrentOutputLine > m_currentOutputLine) {
// lets wait a little bit more to not cut anything
int triggeredCount = 0;
int debugCounter = 0;
do {
debugCounter++;
- triggeredCount = m_process->output().count();
+ triggeredCount = m_process->output().size();
QTest::qWait(updateTimeOut);
- newCurrentOutputLine = m_process->output().count();
+ newCurrentOutputLine = m_process->output().size();
} while (triggeredCount != newCurrentOutputLine);
QString currentOutputString = m_process->output().right(newCurrentOutputLine - m_currentOutputLine);
if (m_enableClientOutput)
@@ -159,7 +159,7 @@ private:
QPointer<QQmlDebugTranslationClient> m_debugTranslationClient;
QPointer<QQmlPreviewClient> m_previewClient;
- int m_currentOutputLine = 0;
+ qsizetype m_currentOutputLine = 0;
bool m_enableClientOutput = true;
};
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index 0fc3db86ae..7cdaf6819e 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -1489,7 +1489,7 @@ void tst_qquicktextedit::selection()
QCOMPARE(textEditObject->selectionEnd(), 0);
QVERIFY(textEditObject->selectedText().isNull());
- textEditObject->setCursorPosition(textEditObject->text().count()+1);
+ textEditObject->setCursorPosition(textEditObject->text().length()+1);
QCOMPARE(textEditObject->cursorPosition(), 0);
QCOMPARE(textEditObject->selectionStart(), 0);
QCOMPARE(textEditObject->selectionEnd(), 0);
@@ -1646,24 +1646,24 @@ void tst_qquicktextedit::isRightToLeft()
// first test that the right string is delivered to the QString::isRightToLeft()
QCOMPARE(textEdit.isRightToLeft(0,0), text.mid(0,0).isRightToLeft());
QCOMPARE(textEdit.isRightToLeft(0,1), text.mid(0,1).isRightToLeft());
- QCOMPARE(textEdit.isRightToLeft(text.count()-2, text.count()-1), text.mid(text.count()-2, text.count()-1).isRightToLeft());
- QCOMPARE(textEdit.isRightToLeft(text.count()/2, text.count()/2 + 1), text.mid(text.count()/2, text.count()/2 + 1).isRightToLeft());
- QCOMPARE(textEdit.isRightToLeft(0,text.count()/4), text.mid(0,text.count()/4).isRightToLeft());
- QCOMPARE(textEdit.isRightToLeft(text.count()/4,3*text.count()/4), text.mid(text.count()/4,3*text.count()/4).isRightToLeft());
+ QCOMPARE(textEdit.isRightToLeft(text.length()-2, text.length()-1), text.mid(text.length()-2, text.length()-1).isRightToLeft());
+ QCOMPARE(textEdit.isRightToLeft(text.length()/2, text.length()/2 + 1), text.mid(text.length()/2, text.length()/2 + 1).isRightToLeft());
+ QCOMPARE(textEdit.isRightToLeft(0,text.length()/4), text.mid(0,text.length()/4).isRightToLeft());
+ QCOMPARE(textEdit.isRightToLeft(text.length()/4,3*text.length()/4), text.mid(text.length()/4,3*text.length()/4).isRightToLeft());
if (text.isEmpty())
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextEdit: isRightToLeft(start, end) called with the end property being smaller than the start.");
- QCOMPARE(textEdit.isRightToLeft(3*text.count()/4,text.count()-1), text.mid(3*text.count()/4,text.count()-1).isRightToLeft());
+ QCOMPARE(textEdit.isRightToLeft(3*text.length()/4,text.length()-1), text.mid(3*text.length()/4,text.length()-1).isRightToLeft());
// then test that the feature actually works
QCOMPARE(textEdit.isRightToLeft(0,0), emptyString);
QCOMPARE(textEdit.isRightToLeft(0,1), firstCharacter);
- QCOMPARE(textEdit.isRightToLeft(text.count()-2, text.count()-1), lastCharacter);
- QCOMPARE(textEdit.isRightToLeft(text.count()/2, text.count()/2 + 1), middleCharacter);
- QCOMPARE(textEdit.isRightToLeft(0,text.count()/4), startString);
- QCOMPARE(textEdit.isRightToLeft(text.count()/4,3*text.count()/4), midString);
+ QCOMPARE(textEdit.isRightToLeft(text.length()-2, text.length()-1), lastCharacter);
+ QCOMPARE(textEdit.isRightToLeft(text.length()/2, text.length()/2 + 1), middleCharacter);
+ QCOMPARE(textEdit.isRightToLeft(0,text.length()/4), startString);
+ QCOMPARE(textEdit.isRightToLeft(text.length()/4,3*text.length()/4), midString);
if (text.isEmpty())
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextEdit: isRightToLeft(start, end) called with the end property being smaller than the start.");
- QCOMPARE(textEdit.isRightToLeft(3*text.count()/4,text.count()-1), endString);
+ QCOMPARE(textEdit.isRightToLeft(3*text.length()/4,text.length()-1), endString);
}
void tst_qquicktextedit::keySelection()
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index 669f94ed48..8f80070b76 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -677,7 +677,7 @@ void tst_qquicktextinput::selection()
QCOMPARE(textinputObject->selectionEnd(), 0);
QVERIFY(textinputObject->selectedText().isNull());
- textinputObject->setCursorPosition(textinputObject->text().count()+1);
+ textinputObject->setCursorPosition(textinputObject->text().length() + 1);
QCOMPARE(textinputObject->cursorPosition(), 0);
QCOMPARE(textinputObject->selectionStart(), 0);
QCOMPARE(textinputObject->selectionEnd(), 0);
@@ -865,24 +865,24 @@ void tst_qquicktextinput::isRightToLeft()
// first test that the right string is delivered to the QString::isRightToLeft()
QCOMPARE(textInput.isRightToLeft(0,0), text.mid(0,0).isRightToLeft());
QCOMPARE(textInput.isRightToLeft(0,1), text.mid(0,1).isRightToLeft());
- QCOMPARE(textInput.isRightToLeft(text.count()-2, text.count()-1), text.mid(text.count()-2, text.count()-1).isRightToLeft());
- QCOMPARE(textInput.isRightToLeft(text.count()/2, text.count()/2 + 1), text.mid(text.count()/2, text.count()/2 + 1).isRightToLeft());
- QCOMPARE(textInput.isRightToLeft(0,text.count()/4), text.mid(0,text.count()/4).isRightToLeft());
- QCOMPARE(textInput.isRightToLeft(text.count()/4,3*text.count()/4), text.mid(text.count()/4,3*text.count()/4).isRightToLeft());
+ QCOMPARE(textInput.isRightToLeft(text.length()-2, text.length()-1), text.mid(text.length()-2, text.length()-1).isRightToLeft());
+ QCOMPARE(textInput.isRightToLeft(text.length()/2, text.length()/2 + 1), text.mid(text.length()/2, text.length()/2 + 1).isRightToLeft());
+ QCOMPARE(textInput.isRightToLeft(0,text.length()/4), text.mid(0,text.length()/4).isRightToLeft());
+ QCOMPARE(textInput.isRightToLeft(text.length()/4,3*text.length()/4), text.mid(text.length()/4,3*text.length()/4).isRightToLeft());
if (text.isEmpty())
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextInput: isRightToLeft(start, end) called with the end property being smaller than the start.");
- QCOMPARE(textInput.isRightToLeft(3*text.count()/4,text.count()-1), text.mid(3*text.count()/4,text.count()-1).isRightToLeft());
+ QCOMPARE(textInput.isRightToLeft(3*text.length()/4,text.length()-1), text.mid(3*text.length()/4,text.length()-1).isRightToLeft());
// then test that the feature actually works
QCOMPARE(textInput.isRightToLeft(0,0), emptyString);
QCOMPARE(textInput.isRightToLeft(0,1), firstCharacter);
- QCOMPARE(textInput.isRightToLeft(text.count()-2, text.count()-1), lastCharacter);
- QCOMPARE(textInput.isRightToLeft(text.count()/2, text.count()/2 + 1), middleCharacter);
- QCOMPARE(textInput.isRightToLeft(0,text.count()/4), startString);
- QCOMPARE(textInput.isRightToLeft(text.count()/4,3*text.count()/4), midString);
+ QCOMPARE(textInput.isRightToLeft(text.length()-2, text.length()-1), lastCharacter);
+ QCOMPARE(textInput.isRightToLeft(text.length()/2, text.length()/2 + 1), middleCharacter);
+ QCOMPARE(textInput.isRightToLeft(0,text.length()/4), startString);
+ QCOMPARE(textInput.isRightToLeft(text.length()/4,3*text.length()/4), midString);
if (text.isEmpty())
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextInput: isRightToLeft(start, end) called with the end property being smaller than the start.");
- QCOMPARE(textInput.isRightToLeft(3*text.count()/4,text.count()-1), endString);
+ QCOMPARE(textInput.isRightToLeft(3*text.length()/4,text.length()-1), endString);
}
void tst_qquicktextinput::moveCursorSelection_data()