Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_plasma_window_model.cpp
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | 52 | private Q_SLOTS: | |||
---|---|---|---|---|---|
74 | void testIsShaded(); | 74 | void testIsShaded(); | ||
75 | void testIsMovable(); | 75 | void testIsMovable(); | ||
76 | void testIsResizable(); | 76 | void testIsResizable(); | ||
77 | void testIsVirtualDesktopChangeable(); | 77 | void testIsVirtualDesktopChangeable(); | ||
78 | void testIsCloseable(); | 78 | void testIsCloseable(); | ||
79 | void testGeometry(); | 79 | void testGeometry(); | ||
80 | void testTitle(); | 80 | void testTitle(); | ||
81 | void testAppId(); | 81 | void testAppId(); | ||
82 | void testPid(); | ||||
82 | void testVirtualDesktop(); | 83 | void testVirtualDesktop(); | ||
83 | // TODO icon: can we ensure a theme is installed on CI? | 84 | // TODO icon: can we ensure a theme is installed on CI? | ||
84 | void testRequests(); | 85 | void testRequests(); | ||
85 | // TODO: minimized geometry | 86 | // TODO: minimized geometry | ||
86 | // TODO: model reset | 87 | // TODO: model reset | ||
87 | void testCreateWithUnmappedWindow(); | 88 | void testCreateWithUnmappedWindow(); | ||
88 | void testChangeWindowAfterModelDestroy_data(); | 89 | void testChangeWindowAfterModelDestroy_data(); | ||
89 | void testChangeWindowAfterModelDestroy(); | 90 | void testChangeWindowAfterModelDestroy(); | ||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Line(s) | 178 | if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\ | |||
206 | COMPARE(dataChangedSpy.last().last().value<QVector<int>>(), QVector<int>{int(role)}); | 207 | COMPARE(dataChangedSpy.last().last().value<QVector<int>>(), QVector<int>{int(role)}); | ||
207 | COMPARE(model->data(index, role).toBool(), false); | 208 | COMPARE(model->data(index, role).toBool(), false); | ||
208 | 209 | | |||
209 | #undef COMPARE | 210 | #undef COMPARE | ||
210 | #undef VERIFY | 211 | #undef VERIFY | ||
211 | return true; | 212 | return true; | ||
212 | } | 213 | } | ||
213 | 214 | | |||
214 | void PlasmaWindowModelTest::testRoleNames_data() | 215 | void PlasmaWindowModelTest::testRoleNames_data() | ||
graesslin: Please extend this | |||||
215 | { | 216 | { | ||
216 | QTest::addColumn<int>("role"); | 217 | QTest::addColumn<int>("role"); | ||
217 | QTest::addColumn<QByteArray>("name"); | 218 | QTest::addColumn<QByteArray>("name"); | ||
218 | 219 | | |||
219 | QTest::newRow("display") << int(Qt::DisplayRole) << QByteArrayLiteral("DisplayRole"); | 220 | QTest::newRow("display") << int(Qt::DisplayRole) << QByteArrayLiteral("DisplayRole"); | ||
220 | QTest::newRow("decoration") << int(Qt::DecorationRole) << QByteArrayLiteral("DecorationRole"); | 221 | QTest::newRow("decoration") << int(Qt::DecorationRole) << QByteArrayLiteral("DecorationRole"); | ||
221 | 222 | | |||
222 | QTest::newRow("AppId") << int(PlasmaWindowModel::AppId) << QByteArrayLiteral("AppId"); | 223 | QTest::newRow("AppId") << int(PlasmaWindowModel::AppId) << QByteArrayLiteral("AppId"); | ||
▲ Show 20 Lines • Show All 293 Lines • ▼ Show 20 Line(s) | 501 | { | |||
516 | w->setAppId(QStringLiteral("org.kde.testapp")); | 517 | w->setAppId(QStringLiteral("org.kde.testapp")); | ||
517 | QVERIFY(dataChangedSpy.wait()); | 518 | QVERIFY(dataChangedSpy.wait()); | ||
518 | QCOMPARE(dataChangedSpy.count(), 1); | 519 | QCOMPARE(dataChangedSpy.count(), 1); | ||
519 | QCOMPARE(dataChangedSpy.last().first().toModelIndex(), index); | 520 | QCOMPARE(dataChangedSpy.last().first().toModelIndex(), index); | ||
520 | QCOMPARE(dataChangedSpy.last().last().value<QVector<int>>(), QVector<int>{int(PlasmaWindowModel::AppId)}); | 521 | QCOMPARE(dataChangedSpy.last().last().value<QVector<int>>(), QVector<int>{int(PlasmaWindowModel::AppId)}); | ||
521 | QCOMPARE(model->data(index, PlasmaWindowModel::AppId).toString(), QStringLiteral("org.kde.testapp")); | 522 | QCOMPARE(model->data(index, PlasmaWindowModel::AppId).toString(), QStringLiteral("org.kde.testapp")); | ||
522 | } | 523 | } | ||
523 | 524 | | |||
525 | void PlasmaWindowModelTest::testPid() | ||||
526 | { | ||||
527 | auto model = m_pw->createWindowModel(); | ||||
528 | QVERIFY(model); | ||||
529 | QSignalSpy rowInsertedSpy(model, &PlasmaWindowModel::rowsInserted); | ||||
530 | QVERIFY(rowInsertedSpy.isValid()); | ||||
531 | auto w = m_pwInterface->createWindow(m_pwInterface); | ||||
532 | QVERIFY(w); | ||||
533 | QVERIFY(rowInsertedSpy.wait()); | ||||
534 | m_connection->flush(); | ||||
535 | m_display->dispatchEvents(); | ||||
536 | QSignalSpy dataChangedSpy(model, &PlasmaWindowModel::dataChanged); | ||||
537 | QVERIFY(dataChangedSpy.isValid()); | ||||
538 | | ||||
539 | const QModelIndex index = model->index(0); | ||||
540 | QCOMPARE(model->data(index, PlasmaWindowModel::Pid).toInt(), 0); | ||||
541 | | ||||
542 | w->setPid(1337); | ||||
543 | QVERIFY(dataChangedSpy.wait()); | ||||
544 | QCOMPARE(dataChangedSpy.count(), 1); | ||||
545 | QCOMPARE(dataChangedSpy.last().first().toModelIndex(), index); | ||||
546 | QCOMPARE(dataChangedSpy.last().last().value<QVector<int>>(), QVector<int>{int(PlasmaWindowModel::Pid)}); | ||||
547 | QCOMPARE(model->data(index, PlasmaWindowModel::Pid).toInt(), 1337); | ||||
548 | } | ||||
549 | | ||||
524 | void PlasmaWindowModelTest::testVirtualDesktop() | 550 | void PlasmaWindowModelTest::testVirtualDesktop() | ||
525 | { | 551 | { | ||
526 | auto model = m_pw->createWindowModel(); | 552 | auto model = m_pw->createWindowModel(); | ||
527 | QVERIFY(model); | 553 | QVERIFY(model); | ||
528 | QSignalSpy rowInsertedSpy(model, &PlasmaWindowModel::rowsInserted); | 554 | QSignalSpy rowInsertedSpy(model, &PlasmaWindowModel::rowsInserted); | ||
529 | QVERIFY(rowInsertedSpy.isValid()); | 555 | QVERIFY(rowInsertedSpy.isValid()); | ||
530 | auto w = m_pwInterface->createWindow(m_pwInterface); | 556 | auto w = m_pwInterface->createWindow(m_pwInterface); | ||
531 | QVERIFY(w); | 557 | QVERIFY(w); | ||
▲ Show 20 Lines • Show All 308 Lines • Show Last 20 Lines |
Please extend this