mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
fix: remove deprecations from test cases
This commit is contained in:
parent
b0df3535a5
commit
d71f85eaad
@ -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<QString, QString> 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<QString> 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);
|
||||
}
|
||||
|
||||
|
@ -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())));
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user