forked from qt-creator/qt-creator
QmlProfiler: Fix tests involving TimelineModel::color()
Change-Id: Ia3d1ab6be249fb7193ce084b7312e2b6192edad6 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -64,7 +64,7 @@ void DebugMessagesModelTest::testColor()
|
||||
// TimelineModel::colorBySelectionId ...
|
||||
for (int i = 0; i < 10; ++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()
|
||||
|
||||
void InputEventsModelTest::testColor()
|
||||
{
|
||||
QColor keyColor;
|
||||
QColor mouseColor;
|
||||
QRgb keyColor = 0;
|
||||
QRgb mouseColor = 0;
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
InputEventType type = static_cast<InputEventType>(i % MaximumInputEventType);
|
||||
int selectionId = (type <= InputKeyUnknown ? Key : Mouse);
|
||||
QCOMPARE(selectionId, model.selectionId(i));
|
||||
|
||||
QColor &expectedColor = selectionId == Key ? keyColor : mouseColor;
|
||||
if (expectedColor.isValid())
|
||||
QRgb &expectedColor = selectionId == Key ? keyColor : mouseColor;
|
||||
if (expectedColor != 0)
|
||||
QCOMPARE(model.color(i), expectedColor);
|
||||
else
|
||||
expectedColor = model.color(i);
|
||||
|
||||
@@ -122,9 +122,9 @@ void MemoryUsageModelTest::testTypeId()
|
||||
|
||||
void MemoryUsageModelTest::testColor()
|
||||
{
|
||||
QColor heapPageColor = model.color(0);
|
||||
QColor smallItemColor = model.color(1);
|
||||
QColor largeItemColor = model.color(2);
|
||||
QRgb heapPageColor = model.color(0);
|
||||
QRgb smallItemColor = model.color(1);
|
||||
QRgb largeItemColor = model.color(2);
|
||||
QVERIFY(smallItemColor != heapPageColor);
|
||||
QVERIFY(largeItemColor != heapPageColor);
|
||||
QVERIFY(smallItemColor != largeItemColor);
|
||||
|
||||
@@ -270,20 +270,20 @@ void PixmapCacheModelTest::testRowMaxValue()
|
||||
|
||||
void PixmapCacheModelTest::testColor()
|
||||
{
|
||||
QColor row1Color;
|
||||
QColor dingsColor;
|
||||
QColor blahColor;
|
||||
QRgb row1Color = 0;
|
||||
QRgb dingsColor = 0;
|
||||
QRgb blahColor = 0;
|
||||
for (int i = 0; i < model.count(); ++i) {
|
||||
if (model.collapsedRow(i) == 1) {
|
||||
if (!row1Color.isValid())
|
||||
if (row1Color == 0)
|
||||
row1Color = model.color(i);
|
||||
else
|
||||
QCOMPARE(model.color(i), row1Color);
|
||||
} else {
|
||||
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;
|
||||
if (!pixmapColor.isValid())
|
||||
if (pixmapColor == 0)
|
||||
pixmapColor = model.color(i);
|
||||
else
|
||||
QCOMPARE(model.color(i), pixmapColor);
|
||||
|
||||
Reference in New Issue
Block a user