Commit 6b699202 authored by Volker Krause's avatar Volker Krause
Browse files

Fix data format of the property ratio source

parent 58f81a74
...@@ -134,8 +134,11 @@ QVariant PropertyRatioSource::data() ...@@ -134,8 +134,11 @@ QVariant PropertyRatioSource::data()
for (auto it = d->ratioSet.constBegin(); it != d->ratioSet.constEnd(); ++it) for (auto it = d->ratioSet.constBegin(); it != d->ratioSet.constEnd(); ++it)
total += it.value(); total += it.value();
for (auto it = d->ratioSet.constBegin(); it != d->ratioSet.constEnd(); ++it) for (auto it = d->ratioSet.constBegin(); it != d->ratioSet.constEnd(); ++it) {
m.insert(it.key(), (double)it.value() / (double)(total)); QVariantMap v;
v.insert(QStringLiteral("property"), (double)it.value() / (double)(total));
m.insert(it.key(), v);
}
return m; return m;
} }
......
...@@ -99,7 +99,7 @@ private slots: ...@@ -99,7 +99,7 @@ private slots:
o = v.toMap(); o = v.toMap();
QCOMPARE(o.size(), 1); QCOMPARE(o.size(), 1);
QVERIFY(o.contains(QLatin1String("value1"))); QVERIFY(o.contains(QLatin1String("value1")));
v = o.value(QLatin1String("value1")); v = o.value(QLatin1String("value1")).toMap().value(QLatin1String("property"));;
QCOMPARE(v.type(), QVariant::Double); QCOMPARE(v.type(), QVariant::Double);
setProp(23); setProp(23);
...@@ -108,7 +108,7 @@ private slots: ...@@ -108,7 +108,7 @@ private slots:
o = v.toMap(); o = v.toMap();
QCOMPARE(o.size(), 2); QCOMPARE(o.size(), 2);
QVERIFY(o.contains(QLatin1String("value2"))); QVERIFY(o.contains(QLatin1String("value2")));
v = o.value(QLatin1String("value2")); v = o.value(QLatin1String("value2")).toMap().value(QLatin1String("property"));
QCOMPARE(v.type(), QVariant::Double); QCOMPARE(v.type(), QVariant::Double);
} }
......
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