add tests for battery and gpuload sources

+ some tests refactoring
This commit is contained in:
2016-06-09 12:45:21 +03:00
parent bc2071a493
commit 78b7a87c29
16 changed files with 269 additions and 44 deletions

View File

@ -60,12 +60,13 @@ void TestHDDTemperatureSource::test_hddtemp()
QSignalSpy spy(hddtempSource,
SIGNAL(dataReceived(const QVariantHash &)));
float firstValue = hddtempSource->data(device).toFloat();
QCOMPARE(firstValue, 0.0f);
QVERIFY(spy.wait(5000));
QVariantHash arguments = spy.takeFirst().at(0).toHash();
device.remove(QString("hdd/temperature"));
float secondValue = arguments[device].toFloat();
QCOMPARE(firstValue, 0.0f);
QVERIFY((secondValue >= temp.first) && (secondValue <= temp.second));
});
}
@ -77,12 +78,13 @@ void TestHDDTemperatureSource::test_smartctl()
QSignalSpy spy(smartctlSource,
SIGNAL(dataReceived(const QVariantHash &)));
float firstValue = smartctlSource->data(device).toFloat();
QCOMPARE(firstValue, 0.0f);
QVERIFY(spy.wait(5000));
QVariantHash arguments = spy.takeFirst().at(0).toHash();
device.remove(QString("hdd/temperature"));
float secondValue = arguments[device].toFloat();
QCOMPARE(firstValue, 0.0f);
QVERIFY((secondValue >= temp.first) && (secondValue <= temp.second));
});
}