summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2022-09-30 10:23:45 +0300
committerJuha Vuolle <juha.vuolle@insta.fi>2022-10-04 08:11:52 +0300
commitc3a265592d7d4709998e5bf12d14a143aa0bf14f (patch)
treedf3fb44a6049105f1e062d62d0b52f6e407c0180 /tests
parenta83541566473ce7f362eced21d12ac245a28f431 (diff)
Change from count() to size() with Qt containers
As the preferred method. Potentially may be deprecated similar to QString/QByteArray Fixes: QTBUG-107068 Change-Id: I0cfc9d7f8e2e450849f1d22c5b98aa353748ecf6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qml_cpp/tst_sensors_qmlcpp.cpp10
-rw-r--r--tests/auto/qsensor/tst_qsensor.cpp22
2 files changed, 16 insertions, 16 deletions
diff --git a/tests/auto/qml/qml_cpp/tst_sensors_qmlcpp.cpp b/tests/auto/qml/qml_cpp/tst_sensors_qmlcpp.cpp
index 5a53e807..9a6fdf35 100644
--- a/tests/auto/qml/qml_cpp/tst_sensors_qmlcpp.cpp
+++ b/tests/auto/qml/qml_cpp/tst_sensors_qmlcpp.cpp
@@ -265,11 +265,11 @@ void tst_sensors_qmlcpp::testSensorRanges()
QSignalSpy output2Spy(output2, SIGNAL(destroyed()));
qmlSensor.reset();
- QCOMPARE(range0Spy.count(), 1);
- QCOMPARE(range1Spy.count(), 1);
- QCOMPARE(output0Spy.count(), 1);
- QCOMPARE(output1Spy.count(), 1);
- QCOMPARE(output2Spy.count(), 1);
+ QCOMPARE(range0Spy.size(), 1);
+ QCOMPARE(range1Spy.size(), 1);
+ QCOMPARE(output0Spy.size(), 1);
+ QCOMPARE(output1Spy.size(), 1);
+ QCOMPARE(output2Spy.size(), 1);
}
QT_END_NAMESPACE
diff --git a/tests/auto/qsensor/tst_qsensor.cpp b/tests/auto/qsensor/tst_qsensor.cpp
index 38251c5e..528fca31 100644
--- a/tests/auto/qsensor/tst_qsensor.cpp
+++ b/tests/auto/qsensor/tst_qsensor.cpp
@@ -423,20 +423,20 @@ private slots:
sensor.setProperty("doThis", "setOne");
QSignalSpy spy(&sensor, SIGNAL(readingChanged()));
sensor.start();
- QCOMPARE(spy.count(), 1); // reading changes
+ QCOMPARE(spy.size(), 1); // reading changes
sensor.stop();
TestSensorFilter *filter2 = new MyFilter;
sensor.addFilter(filter2);
sensor.start();
- QCOMPARE(spy.count(), 1); // filter suppresses reading so it does not change
+ QCOMPARE(spy.size(), 1); // filter suppresses reading so it does not change
sensor.stop();
delete filter2;
TestSensorFilter *filter1 = new ModFilter;
sensor.addFilter(filter1);
sensor.start();
- QCOMPARE(spy.count(), 2); // filter does not suppress reading
+ QCOMPARE(spy.size(), 2); // filter does not suppress reading
sensor.stop();
delete filter1;
}
@@ -895,7 +895,7 @@ private slots:
// Stopping the first instance causes the busyChanged signal to be emitted from the second instance
QSignalSpy spy(&sensor2, SIGNAL(busyChanged()));
sensor1.stop();
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
// Now we can start the second instance
sensor2.start();
@@ -908,14 +908,14 @@ private slots:
QSignalSpy busySpy(&accelerometer, SIGNAL(busyChanged()));
QVERIFY(accelerometer.connectToBackend());
QVERIFY(!accelerometer.isBusy());
- QCOMPARE(busySpy.count(), 0);
+ QCOMPARE(busySpy.size(), 0);
set_test_backend_busy(&accelerometer, true);
- QCOMPARE(busySpy.count(), 1);
+ QCOMPARE(busySpy.size(), 1);
QVERIFY(accelerometer.isBusy());
set_test_backend_busy(&accelerometer, false);
- QCOMPARE(busySpy.count(), 2);
+ QCOMPARE(busySpy.size(), 2);
QVERIFY(!accelerometer.isBusy());
unregister_test_backends();
}
@@ -929,23 +929,23 @@ private slots:
// Change id and verify change
sensor.setIdentifier("a");
QCOMPARE(sensor.identifier(), "a");
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
// Set same id and verify that no changes
sensor.setIdentifier("a");
QCOMPARE(sensor.identifier(), "a");
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
// Change id and verify change
sensor.setIdentifier(testsensorimpl::id);
QCOMPARE(sensor.identifier(), testsensorimpl::id);
- QCOMPARE(spy.count(), 2);
+ QCOMPARE(spy.size(), 2);
// Identifier cant be changed after connected to backend
QVERIFY(sensor.connectToBackend());
sensor.setIdentifier("c");
QCOMPARE(sensor.identifier(), testsensorimpl::id);
- QCOMPARE(spy.count(), 2);
+ QCOMPARE(spy.size(), 2);
}
void testSupportedFeatures()