mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-10-14 00:29:59 +00:00
newest qt fixes
This commit is contained in:
@ -22,13 +22,12 @@
|
||||
#include <QEventLoop>
|
||||
#include <QSet>
|
||||
#include <QStandardPaths>
|
||||
#include <QTime>
|
||||
#include <QRandomGenerator>
|
||||
#include <QtTest>
|
||||
|
||||
|
||||
void AWTestLibrary::init()
|
||||
{
|
||||
qsrand(static_cast<uint>(QTime::currentTime().msec()));
|
||||
}
|
||||
|
||||
|
||||
@ -47,13 +46,7 @@ bool AWTestLibrary::isKWinActive()
|
||||
|
||||
char AWTestLibrary::randomChar()
|
||||
{
|
||||
return 'A' + (qrand() % static_cast<int>('Z' - 'A'));
|
||||
}
|
||||
|
||||
|
||||
double AWTestLibrary::randomDouble()
|
||||
{
|
||||
return static_cast<double>(qrand()) / static_cast<double>(RAND_MAX);
|
||||
return 'A' + (QRandomGenerator::global()->generate() % static_cast<int>('Z' - 'A'));
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +68,7 @@ QPair<QString, QString> AWTestLibrary::randomFilenames()
|
||||
|
||||
int AWTestLibrary::randomInt(const int _max)
|
||||
{
|
||||
return qrand() % _max;
|
||||
return QRandomGenerator::global()->generate() % _max;
|
||||
}
|
||||
|
||||
|
||||
@ -113,5 +106,5 @@ QStringList AWTestLibrary::randomSelect(const QStringList &_available)
|
||||
output << _available.at(index);
|
||||
}
|
||||
|
||||
return output.toList();
|
||||
return output.values();
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ namespace AWTestLibrary
|
||||
void init();
|
||||
bool isKWinActive();
|
||||
char randomChar();
|
||||
double randomDouble();
|
||||
QPair<QString, QString> randomFilenames();
|
||||
int randomInt(const int _max = 100);
|
||||
QString randomString(const int _min = 1, const int _max = 100);
|
||||
|
@ -60,14 +60,6 @@ void TestExtWeather::test_runOWM()
|
||||
}
|
||||
|
||||
|
||||
void TestExtWeather::test_runYahoo()
|
||||
{
|
||||
extWeather->setProvider(ExtWeather::Provider::Yahoo);
|
||||
run();
|
||||
extWeather->setProvider(ExtWeather::Provider::OWM);
|
||||
}
|
||||
|
||||
|
||||
void TestExtWeather::test_ts()
|
||||
{
|
||||
extWeather->setTs(1);
|
||||
|
@ -36,7 +36,6 @@ private slots:
|
||||
// test
|
||||
void test_values();
|
||||
void test_runOWM();
|
||||
void test_runYahoo();
|
||||
void test_ts();
|
||||
void test_image();
|
||||
void test_copy();
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "testfloatformatter.h"
|
||||
|
||||
#include <QtTest>
|
||||
#include <QRandomGenerator>
|
||||
|
||||
#include "awfloatformatter.h"
|
||||
#include "awtestlibrary.h"
|
||||
@ -48,7 +49,7 @@ void TestAWFloatFormatter::test_count()
|
||||
QCOMPARE(formatter->count(), count);
|
||||
|
||||
// test
|
||||
QString output = formatter->convert(AWTestLibrary::randomDouble());
|
||||
QString output = formatter->convert(QRandomGenerator::global()->generateDouble());
|
||||
QCOMPARE(output.count(), count);
|
||||
|
||||
// reset
|
||||
@ -83,7 +84,7 @@ void TestAWFloatFormatter::test_forceWidth()
|
||||
QCOMPARE(formatter->forceWidth(), true);
|
||||
|
||||
// test
|
||||
QString output = formatter->convert(AWTestLibrary::randomDouble());
|
||||
QString output = formatter->convert(QRandomGenerator::global()->generateDouble());
|
||||
QCOMPARE(output.count(), count);
|
||||
|
||||
// reset
|
||||
@ -102,7 +103,7 @@ void TestAWFloatFormatter::test_format()
|
||||
QCOMPARE(formatter->format(), 'e');
|
||||
|
||||
// test
|
||||
QString output = formatter->convert(AWTestLibrary::randomDouble());
|
||||
QString output = formatter->convert(QRandomGenerator::global()->generateDouble());
|
||||
QVERIFY(output.contains('e'));
|
||||
|
||||
// reset
|
||||
@ -118,7 +119,7 @@ void TestAWFloatFormatter::test_precision()
|
||||
QCOMPARE(formatter->precision(), precision);
|
||||
|
||||
// test
|
||||
QString output = formatter->convert(AWTestLibrary::randomDouble());
|
||||
QString output = formatter->convert(QRandomGenerator::global()->generateDouble());
|
||||
output.remove("0.");
|
||||
QCOMPARE(output.count(), precision);
|
||||
|
||||
@ -132,12 +133,12 @@ void TestAWFloatFormatter::test_multiplier()
|
||||
formatter->setPrecision(6);
|
||||
|
||||
// assign
|
||||
double multiplier = AWTestLibrary::randomDouble();
|
||||
double multiplier = QRandomGenerator::global()->generateDouble();
|
||||
formatter->setMultiplier(multiplier);
|
||||
QCOMPARE(formatter->multiplier(), multiplier);
|
||||
|
||||
// test
|
||||
double value = AWTestLibrary::randomDouble();
|
||||
double value = QRandomGenerator::global()->generateDouble();
|
||||
QCOMPARE(formatter->convert(value), QString::number(value * multiplier, 'f', 6));
|
||||
|
||||
// reset
|
||||
@ -148,12 +149,12 @@ void TestAWFloatFormatter::test_multiplier()
|
||||
void TestAWFloatFormatter::test_summand()
|
||||
{
|
||||
// assign
|
||||
double summand = AWTestLibrary::randomDouble();
|
||||
double summand = QRandomGenerator::global()->generateDouble();
|
||||
formatter->setSummand(summand);
|
||||
QCOMPARE(formatter->summand(), summand);
|
||||
|
||||
// test
|
||||
double value = AWTestLibrary::randomDouble();
|
||||
double value = QRandomGenerator::global()->generateDouble();
|
||||
QCOMPARE(formatter->convert(value), QString::number(value + summand, 'f', 6));
|
||||
|
||||
// reset
|
||||
@ -185,9 +186,9 @@ void TestAWFloatFormatter::doRandom()
|
||||
formatter->setFillChar(AWTestLibrary::randomChar());
|
||||
formatter->setForceWidth(AWTestLibrary::randomInt() % 2);
|
||||
formatter->setFormat(AWTestLibrary::randomChar());
|
||||
formatter->setMultiplier(AWTestLibrary::randomDouble());
|
||||
formatter->setMultiplier(QRandomGenerator::global()->generateDouble());
|
||||
formatter->setPrecision(AWTestLibrary::randomInt());
|
||||
formatter->setSummand(AWTestLibrary::randomDouble());
|
||||
formatter->setSummand(QRandomGenerator::global()->generateDouble());
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ void TestNetworkSource::cleanupTestCase()
|
||||
|
||||
void TestNetworkSource::test_sources()
|
||||
{
|
||||
QCOMPARE(source->sources(), QStringList() << src);
|
||||
QCOMPARE(source->sources(), QStringList() << src << "network/current/ssid");
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user