mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
test cases update
This commit is contained in:
parent
3f20aa8878
commit
3c8bf1baf1
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -27,10 +27,10 @@ jobs:
|
||||
run: pacman -Sy --noconfirm base-devel cmake extra-cmake-modules python util-linux-libs xorg-server-xvfb
|
||||
|
||||
- name: install dependencies
|
||||
run: pacman -S --noconfirm plasma-workspace ksysguard
|
||||
run: pacman -S --noconfirm plasma-workspace
|
||||
|
||||
- name: configure cmake
|
||||
run: cmake -B build -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_FUTURE=ON -DBUILD_TESTING=ON sources
|
||||
run: cmake -B build -S sources -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_FUTURE=ON -DBUILD_TESTING=ON
|
||||
|
||||
- name: build
|
||||
working-directory: /repo/build
|
||||
|
@ -130,8 +130,7 @@ QStringList AWKeyOperations::dictKeys() const
|
||||
allKeys.append(QString("up%1").arg(i));
|
||||
}
|
||||
// battery
|
||||
auto allBatteryDevices
|
||||
= QDir("/sys/class/power_supply")
|
||||
auto allBatteryDevices = QDir("/sys/class/power_supply")
|
||||
.entryList(QStringList({"BAT*"}), QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
|
||||
for (int i = 0; i < allBatteryDevices.count(); i++) {
|
||||
allKeys.append(QString("bat%1").arg(i));
|
||||
|
@ -62,7 +62,7 @@ void ExtSysMonAggregator::init(const QHash<QString, QString> &_config)
|
||||
createSensor("custom", i18n("Scripts"), new CustomSource(this, {}));
|
||||
// desktop
|
||||
// FIXME causes segfault in kde libs
|
||||
// createSensor("desktop", i18n("Desktop"), new DesktopSource(this, {}));
|
||||
// createSensor("desktop", i18n("Desktop"), new DesktopSource(this, {}));
|
||||
// network
|
||||
createSensor("network", i18n("Network"), new NetworkSource(this, {}));
|
||||
// player
|
||||
|
@ -49,15 +49,15 @@ void TestAWDateTimeFormatter::test_values()
|
||||
|
||||
void TestAWDateTimeFormatter::test_conversion()
|
||||
{
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
QCOMPARE(formatter->convert(now), now.toString(format));
|
||||
auto now = QDateTime::currentDateTime();
|
||||
QCOMPARE(formatter->convert(now), QLocale::system().toString(now, format));
|
||||
}
|
||||
|
||||
|
||||
void TestAWDateTimeFormatter::test_copy()
|
||||
{
|
||||
formatter->setTranslateString(false);
|
||||
AWDateTimeFormatter *newFormatter = formatter->copy("/dev/null", 1);
|
||||
auto *newFormatter = formatter->copy("/dev/null", 1);
|
||||
|
||||
QCOMPARE(newFormatter->format(), formatter->format());
|
||||
QCOMPARE(newFormatter->translateString(), formatter->translateString());
|
||||
|
@ -39,13 +39,13 @@ void TestNetworkSource::cleanupTestCase()
|
||||
|
||||
void TestNetworkSource::test_sources()
|
||||
{
|
||||
QCOMPARE(source->sources(), QStringList() << src << "network/current/ssid");
|
||||
QCOMPARE(source->sources(), QStringList({"device", "ssid"}));
|
||||
}
|
||||
|
||||
|
||||
void TestNetworkSource::test_values()
|
||||
{
|
||||
QVERIFY(source->data(src).toString().count() > 0);
|
||||
QVERIFY(source->data("device").toString().length() > 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,7 +38,6 @@ private slots:
|
||||
|
||||
private:
|
||||
NetworkSource *source = nullptr;
|
||||
QString src = "network/current/name";
|
||||
};
|
||||
|
||||
|
||||
|
@ -43,23 +43,23 @@ void TestPlayerSource::test_buildString()
|
||||
{
|
||||
QString randomString = AWTestLibrary::randomString(1, 40);
|
||||
QString str = PlayerSource::buildString("", randomString, 20);
|
||||
QCOMPARE(str.count(), 20);
|
||||
QCOMPARE(str.length(), 20);
|
||||
|
||||
str = PlayerSource::buildString(str, randomString, 20);
|
||||
QCOMPARE(str.count(), 20);
|
||||
QCOMPARE(str.length(), 20);
|
||||
|
||||
str = PlayerSource::buildString("", AWTestLibrary::randomString(1, 10), 20);
|
||||
QCOMPARE(str.count(), 20);
|
||||
QCOMPARE(str.length(), 20);
|
||||
}
|
||||
|
||||
|
||||
void TestPlayerSource::test_stripString()
|
||||
{
|
||||
QString str = PlayerSource::buildString("", AWTestLibrary::randomString(1, 40), 20);
|
||||
QCOMPARE(str.count(), 20);
|
||||
QCOMPARE(str.length(), 20);
|
||||
|
||||
str = PlayerSource::buildString("", AWTestLibrary::randomString(1, 10), 20);
|
||||
QCOMPARE(str.count(), 20);
|
||||
QCOMPARE(str.length(), 20);
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ void TestPlayerSource::test_mpd()
|
||||
|
||||
// init spy
|
||||
QSignalSpy spy(source, SIGNAL(dataReceived(const QVariantHash &)));
|
||||
QVariant firstValue = source->data("player/title");
|
||||
QVariant firstValue = source->data("title");
|
||||
if (!source->isMpdSocketConnected())
|
||||
QSKIP("No mpd found");
|
||||
|
||||
@ -95,10 +95,10 @@ void TestPlayerSource::test_mpd()
|
||||
QVariantHash secondValue = arguments.at(0).toHash();
|
||||
|
||||
// actually nothing to test here just print warning if no information found
|
||||
if (secondValue["player/title"].toString() == "unknown")
|
||||
if (secondValue["title"].toString() == "unknown")
|
||||
QSKIP("No mpd found");
|
||||
|
||||
QVERIFY(secondValue["player/progress"].toInt() < secondValue["player/duration"].toInt());
|
||||
QVERIFY(secondValue["progress"].toInt() < secondValue["duration"].toInt());
|
||||
}
|
||||
|
||||
|
||||
@ -109,9 +109,9 @@ void TestPlayerSource::test_mpris()
|
||||
PlayerSource *source = new PlayerSource(this, args);
|
||||
_test_sources(source);
|
||||
|
||||
QString value = source->data("player/title").toString();
|
||||
int progress = source->data("player/progress").toInt();
|
||||
int duration = source->data("player/duration").toInt();
|
||||
QString value = source->data("title").toString();
|
||||
int progress = source->data("progress").toInt();
|
||||
int duration = source->data("duration").toInt();
|
||||
|
||||
// actually nothing to test here just print warning if no information found
|
||||
if (value == "unknown")
|
||||
|
@ -45,9 +45,9 @@ void TestProcessesSource::test_sources()
|
||||
|
||||
void TestProcessesSource::test_values()
|
||||
{
|
||||
QVERIFY(source->data("ps/running/count").toInt() > 0);
|
||||
QVERIFY(source->data("ps/running/list").toStringList().count() > 0);
|
||||
QVERIFY(source->data("ps/total/count").toInt() > 0);
|
||||
QVERIFY(source->data("running").toInt() > 0);
|
||||
QVERIFY(source->data("list").toStringList().count() > 0);
|
||||
QVERIFY(source->data("count").toInt() > 0);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user