QmlProfiler: Fix tests involving TimelineModel::color()

Change-Id: Ia3d1ab6be249fb7193ce084b7312e2b6192edad6
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Ulf Hermann
2016-11-09 18:31:06 +01:00
parent faf77fd0e5
commit 05746be80d
4 changed files with 14 additions and 14 deletions

View File

@@ -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());
} }
} }

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);