Commit d1453aaa authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Add a test to SensorDataModelTest to ensure QTransposeProxyModel is correct

Commit 74db33b1 reported QTransposeProxyModel as broken. Since the code
has now changed again, let's make sure we verify that things still work
correctly.
parent c383c372
......@@ -20,6 +20,7 @@
#include <QTest>
#include <QAbstractItemModelTester>
#include <QTransposeProxyModel>
#include <QDBusInterface>
......@@ -94,6 +95,28 @@ private Q_SLOTS:
QCOMPARE(model.headerData(1, Qt::Horizontal, unit).value<KSysGuard::Unit>(), KSysGuard::UnitByteRate);
QCOMPARE(model.headerData(2, Qt::Horizontal, unit).value<KSysGuard::Unit>(), KSysGuard::UnitPercent);
}
void testTransposeProxy()
{
KSysGuard::SensorDataModel model;
QAbstractItemModelTester tester{&model};
Q_UNUSED(tester)
QTransposeProxyModel transpose;
transpose.setSourceModel(&model);
model.setSensors({
qs("cpu/all/usage"),
qs("memory/physical/used"),
qs("network/all/download"),
qs("disk/all/used")
});
QTRY_VERIFY(model.isReady());
QCOMPARE(model.columnCount(), transpose.rowCount());
QCOMPARE(model.rowCount(), transpose.columnCount());
}
};
QTEST_MAIN(SensorDataModelTest);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment