Commit 05746be8 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: Fix tests involving TimelineModel::color()



Change-Id: Ia3d1ab6be249fb7193ce084b7312e2b6192edad6
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent faf77fd0
...@@ -64,7 +64,7 @@ void DebugMessagesModelTest::testColor() ...@@ -64,7 +64,7 @@ void DebugMessagesModelTest::testColor()
// TimelineModel::colorBySelectionId ... // TimelineModel::colorBySelectionId ...
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
QCOMPARE(model.color(i), QCOMPARE(model.color(i),
QColor::fromHsl((i % (QtMsgType::QtInfoMsg + 1) * 25) % 360, 150, 166)); QColor::fromHsl((i % (QtMsgType::QtInfoMsg + 1) * 25) % 360, 150, 166).rgb());
} }
} }
......
...@@ -74,15 +74,15 @@ void InputEventsModelTest::testTypeId() ...@@ -74,15 +74,15 @@ void InputEventsModelTest::testTypeId()
void InputEventsModelTest::testColor() void InputEventsModelTest::testColor()
{ {
QColor keyColor; QRgb keyColor = 0;
QColor mouseColor; QRgb mouseColor = 0;
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
InputEventType type = static_cast<InputEventType>(i % MaximumInputEventType); InputEventType type = static_cast<InputEventType>(i % MaximumInputEventType);
int selectionId = (type <= InputKeyUnknown ? Key : Mouse); int selectionId = (type <= InputKeyUnknown ? Key : Mouse);
QCOMPARE(selectionId, model.selectionId(i)); QCOMPARE(selectionId, model.selectionId(i));
QColor &expectedColor = selectionId == Key ? keyColor : mouseColor; QRgb &expectedColor = selectionId == Key ? keyColor : mouseColor;
if (expectedColor.isValid()) if (expectedColor != 0)
QCOMPARE(model.color(i), expectedColor); QCOMPARE(model.color(i), expectedColor);
else else
expectedColor = model.color(i); expectedColor = model.color(i);
......
...@@ -122,9 +122,9 @@ void MemoryUsageModelTest::testTypeId() ...@@ -122,9 +122,9 @@ void MemoryUsageModelTest::testTypeId()
void MemoryUsageModelTest::testColor() void MemoryUsageModelTest::testColor()
{ {
QColor heapPageColor = model.color(0); QRgb heapPageColor = model.color(0);
QColor smallItemColor = model.color(1); QRgb smallItemColor = model.color(1);
QColor largeItemColor = model.color(2); QRgb largeItemColor = model.color(2);
QVERIFY(smallItemColor != heapPageColor); QVERIFY(smallItemColor != heapPageColor);
QVERIFY(largeItemColor != heapPageColor); QVERIFY(largeItemColor != heapPageColor);
QVERIFY(smallItemColor != largeItemColor); QVERIFY(smallItemColor != largeItemColor);
......
...@@ -270,20 +270,20 @@ void PixmapCacheModelTest::testRowMaxValue() ...@@ -270,20 +270,20 @@ void PixmapCacheModelTest::testRowMaxValue()
void PixmapCacheModelTest::testColor() void PixmapCacheModelTest::testColor()
{ {
QColor row1Color; QRgb row1Color = 0;
QColor dingsColor; QRgb dingsColor = 0;
QColor blahColor; QRgb blahColor = 0;
for (int i = 0; i < model.count(); ++i) { for (int i = 0; i < model.count(); ++i) {
if (model.collapsedRow(i) == 1) { if (model.collapsedRow(i) == 1) {
if (!row1Color.isValid()) if (row1Color == 0)
row1Color = model.color(i); row1Color = model.color(i);
else else
QCOMPARE(model.color(i), row1Color); QCOMPARE(model.color(i), row1Color);
} else { } else {
const QmlEventType &type = manager.qmlModel()->eventTypes()[model.typeId(i)]; const QmlEventType &type = manager.qmlModel()->eventTypes()[model.typeId(i)];
QColor &pixmapColor = (type.location().filename() == QString("blah.png")) ? QRgb &pixmapColor = (type.location().filename() == QString("blah.png")) ?
blahColor : dingsColor; blahColor : dingsColor;
if (!pixmapColor.isValid()) if (pixmapColor == 0)
pixmapColor = model.color(i); pixmapColor = model.color(i);
else else
QCOMPARE(model.color(i), pixmapColor); QCOMPARE(model.color(i), pixmapColor);
......
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