Skip to content
Snippets Groups Projects
Commit 6b699202 authored by Volker Krause's avatar Volker Krause
Browse files

Fix data format of the property ratio source

parent 58f81a74
Branches
Tags
No related merge requests found
......@@ -134,8 +134,11 @@ QVariant PropertyRatioSource::data()
for (auto it = d->ratioSet.constBegin(); it != d->ratioSet.constEnd(); ++it)
total += it.value();
for (auto it = d->ratioSet.constBegin(); it != d->ratioSet.constEnd(); ++it)
m.insert(it.key(), (double)it.value() / (double)(total));
for (auto it = d->ratioSet.constBegin(); it != d->ratioSet.constEnd(); ++it) {
QVariantMap v;
v.insert(QStringLiteral("property"), (double)it.value() / (double)(total));
m.insert(it.key(), v);
}
return m;
}
......
......@@ -99,7 +99,7 @@ private slots:
o = v.toMap();
QCOMPARE(o.size(), 1);
QVERIFY(o.contains(QLatin1String("value1")));
v = o.value(QLatin1String("value1"));
v = o.value(QLatin1String("value1")).toMap().value(QLatin1String("property"));;
QCOMPARE(v.type(), QVariant::Double);
setProp(23);
......@@ -108,7 +108,7 @@ private slots:
o = v.toMap();
QCOMPARE(o.size(), 2);
QVERIFY(o.contains(QLatin1String("value2")));
v = o.value(QLatin1String("value2"));
v = o.value(QLatin1String("value2")).toMap().value(QLatin1String("property"));
QCOMPARE(v.type(), QVariant::Double);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment