diff --git a/sources/test/awtestlibrary.cpp b/sources/test/awtestlibrary.cpp index e3ef226..78de05a 100644 --- a/sources/test/awtestlibrary.cpp +++ b/sources/test/awtestlibrary.cpp @@ -35,7 +35,7 @@ bool AWTestLibrary::isKWinActive() KWindowSystem::setShowingDesktop(true); spy.wait(5000); - bool state = KWindowSystem::showingDesktop(); + auto state = KWindowSystem::showingDesktop(); KWindowSystem::setShowingDesktop(false); return state; @@ -50,11 +50,11 @@ char AWTestLibrary::randomChar() QPair AWTestLibrary::randomFilenames() { - QString fileName = QString("%1/").arg(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); - QString writeFileName + auto fileName = QString("%1/").arg(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); + auto writeFileName = QString("%1/awesomewidgets/tmp/").arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); - QString name = randomString(1, 20); + auto name = randomString(1, 20); fileName += name; writeFileName += name; @@ -72,8 +72,8 @@ QString AWTestLibrary::randomString(const int _min, const int _max) { QString output; - int count = _min + randomInt(_max - _min); - for (int i = 0; i < count; i++) + auto count = _min + randomInt(_max - _min); + for (auto i = 0; i < count; i++) output += randomChar(); return output; @@ -84,8 +84,8 @@ QStringList AWTestLibrary::randomStringList(const int _max) { QStringList output; - int count = 1 + randomInt(_max); - for (int i = 0; i < count; i++) + auto count = 1 + randomInt(_max); + for (auto i = 0; i < count; i++) output.append(randomString()); return output; @@ -96,9 +96,9 @@ QStringList AWTestLibrary::randomSelect(const QStringList &_available) { QSet output; - int count = 1 + randomInt(_available.count()); - for (int i = 0; i < count; i++) { - int index = randomInt(_available.count()); + auto count = 1 + randomInt(_available.count()); + for (auto i = 0; i < count; i++) { + auto index = randomInt(_available.count()); output << _available.at(index); } diff --git a/sources/test/testbatterysource.cpp b/sources/test/testbatterysource.cpp index 434cb6d..6fe2c33 100644 --- a/sources/test/testbatterysource.cpp +++ b/sources/test/testbatterysource.cpp @@ -42,7 +42,7 @@ void TestBatterySource::cleanupTestCase() void TestBatterySource::test_sources() { // - QVERIFY(source->sources().count() >= 6); + QVERIFY(source->sources().length() >= 6); } @@ -54,9 +54,9 @@ void TestBatterySource::test_battery() QStringList batteries = source->sources(); std::for_each(batteries.begin(), batteries.end(), [this](const QString &bat) { QVariant value = source->data(bat); - if (bat == "battery/ac") + if (bat == "ac") QCOMPARE(value.type(), QVariant::Bool); - else if (bat.startsWith("battery/batrate") || bat.startsWith("battery/batleft")) + else if (bat.startsWith("batrate") || bat.startsWith("batleft")) ; else QVERIFY((value.toFloat() >= battery.first) || (std::isnan(value.toFloat()))); diff --git a/sources/test/testdesktopsource.cpp b/sources/test/testdesktopsource.cpp index 288747e..0e5b64e 100644 --- a/sources/test/testdesktopsource.cpp +++ b/sources/test/testdesktopsource.cpp @@ -47,7 +47,7 @@ void TestDesktopSource::test_values() { QSKIP("Tests are failing with current api"); - QVERIFY(source->data("desktop/current/name").toString().count() > 0); + QVERIFY(source->data("desktop/current/name").toString().length() > 0); QVERIFY(source->data("desktop/current/number").toInt() >= 0); QVERIFY(source->data("desktop/total/name").toStringList().count() > 0); QVERIFY(source->data("desktop/total/number").toInt() > 0); diff --git a/sources/test/testextitemaggregator.cpp b/sources/test/testextitemaggregator.cpp index 631e169..926b927 100644 --- a/sources/test/testextitemaggregator.cpp +++ b/sources/test/testextitemaggregator.cpp @@ -42,7 +42,7 @@ void TestExtItemAggregator::test_values() { QCOMPARE(aggregator->type(), type); QCOMPARE(aggregator->uniqNumber(), 0); - QCOMPARE(aggregator->items().count(), 0); + QCOMPARE(aggregator->items().length(), 0); } diff --git a/sources/test/testextweather.cpp b/sources/test/testextweather.cpp index 0ba8a21..3c87c2f 100644 --- a/sources/test/testextweather.cpp +++ b/sources/test/testextweather.cpp @@ -120,7 +120,7 @@ void TestExtWeather::run() // image should be only one symbol here if (extWeather->jsonMapFile().isEmpty()) QSKIP("No json map found for weather, skip image test"); - QCOMPARE(arguments[extWeather->tag("weather")].toString().count(), 1); + QCOMPARE(arguments[extWeather->tag("weather")].toString().length(), 1); } diff --git a/sources/test/testfloatformatter.cpp b/sources/test/testfloatformatter.cpp index fbec11a..cbce2f3 100644 --- a/sources/test/testfloatformatter.cpp +++ b/sources/test/testfloatformatter.cpp @@ -50,7 +50,7 @@ void TestAWFloatFormatter::test_count() // test QString output = formatter->convert(QRandomGenerator::global()->generateDouble()); - QCOMPARE(output.count(), count); + QCOMPARE(output.length(), count); // reset formatter->setCount(0); @@ -85,7 +85,7 @@ void TestAWFloatFormatter::test_forceWidth() // test QString output = formatter->convert(QRandomGenerator::global()->generateDouble()); - QCOMPARE(output.count(), count); + QCOMPARE(output.length(), count); // reset formatter->setForceWidth(false); @@ -121,7 +121,7 @@ void TestAWFloatFormatter::test_precision() // test QString output = formatter->convert(QRandomGenerator::global()->generateDouble()); output.remove("0."); - QCOMPARE(output.count(), precision); + QCOMPARE(output.length(), precision); // reset formatter->setPrecision(-1); diff --git a/sources/test/teststringformatter.cpp b/sources/test/teststringformatter.cpp index 85ec061..848383e 100644 --- a/sources/test/teststringformatter.cpp +++ b/sources/test/teststringformatter.cpp @@ -49,10 +49,10 @@ void TestAWStringFormatter::test_count() // test auto testString = AWTestLibrary::randomString(); - while (testString.count() > count) + while (testString.length() > count) testString = AWTestLibrary::randomString(); QString output = formatter->convert(testString); - QCOMPARE(output.count(), count); + QCOMPARE(output.length(), count); // reset formatter->setCount(0); @@ -87,7 +87,7 @@ void TestAWStringFormatter::test_forceWidth() // test QString output = formatter->convert(AWTestLibrary::randomString()); - QCOMPARE(output.count(), count); + QCOMPARE(output.length(), count); // reset formatter->setForceWidth(false);