Commit 95e3d7bd authored by Volker Krause's avatar Volker Krause
Browse files

Add unit test for multiple active providers

parent 6cdd1191
......@@ -18,6 +18,7 @@
#include <provider/core/provider.h>
#include <provider/core/platforminfosource.h>
#include <provider/core/screeninfosource.h>
#include <provider/core/startcountsource.h>
#include <QDebug>
#include <QtTest/qtest.h>
......@@ -202,6 +203,29 @@ private slots:
}
#endif
}
void testMultipleProviders()
{
{
Provider p0;
p0.setStatisticsCollectionMode(Provider::BasicUsageStatistics); // triggers store, so we want to avoid that below
}
Provider p1;
auto s1 = new StartCountSource;
p1.addDataSource(s1, Provider:: BasicUsageStatistics);
int c1 = s1->data().toMap().value(QLatin1String("value")).toInt();
int c2 = -1;
{
Provider p2;
auto s2 = new StartCountSource;
p2.addDataSource(s2, Provider:: BasicUsageStatistics);
c2 = s2->data().toMap().value(QLatin1String("value")).toInt();
}
QVERIFY(c2 == c1 + 1);
}
};
QTEST_MAIN(ProviderTest)
......
Markdown is supported
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