Changeset View
Changeset View
Standalone View
Standalone View
autotests/qml/qmltabsapitest.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 39 | { | |||
---|---|---|---|---|---|
50 | int windowId1 = retMap1.value(QSL("windowId"), -1).toInt(); | 50 | int windowId1 = retMap1.value(QSL("windowId"), -1).toInt(); | ||
51 | QCOMPARE(index1, 0); | 51 | QCOMPARE(index1, 0); | ||
52 | QCOMPARE(windowId1, 0); | 52 | QCOMPARE(windowId1, 0); | ||
53 | 53 | | |||
54 | QObject *qmlTabObject1 = m_testHelper.evaluateQObject("Falkon.Tabs.get({index: 0})"); | 54 | QObject *qmlTabObject1 = m_testHelper.evaluateQObject("Falkon.Tabs.get({index: 0})"); | ||
55 | QVERIFY(qmlTabObject1); | 55 | QVERIFY(qmlTabObject1); | ||
56 | QCOMPARE(qmlTabObject1->property("index").toInt(), 0); | 56 | QCOMPARE(qmlTabObject1->property("index").toInt(), 0); | ||
57 | QCOMPARE(qmlTabObject1->property("pinned").toBool(), false); | 57 | QCOMPARE(qmlTabObject1->property("pinned").toBool(), false); | ||
58 | QTRY_COMPARE(qmlTabObject1->property("url").toString(), "https://example.com/"); | 58 | QTRY_COMPARE(qmlTabObject1->property("url").toString(), QSL("https://example.com/")); | ||
59 | 59 | | |||
60 | m_testHelper.evaluate("Falkon.Tabs.addTab({" | 60 | m_testHelper.evaluate("Falkon.Tabs.addTab({" | ||
61 | " url: 'https://another-example.com/'," | 61 | " url: 'https://another-example.com/'," | ||
62 | "})"); | 62 | "})"); | ||
63 | QCOMPARE(qmlTabsInsertedSpy.count(), 2); | 63 | QCOMPARE(qmlTabsInsertedSpy.count(), 2); | ||
64 | QVariantMap retMap2 = QVariant(qmlTabsInsertedSpy.at(1).at(0)).toMap(); | 64 | QVariantMap retMap2 = QVariant(qmlTabsInsertedSpy.at(1).at(0)).toMap(); | ||
65 | int index2 = retMap2.value(QSL("index"), -1).toInt(); | 65 | int index2 = retMap2.value(QSL("index"), -1).toInt(); | ||
66 | int windowId2 = retMap2.value(QSL("windowId"), -1).toInt(); | 66 | int windowId2 = retMap2.value(QSL("windowId"), -1).toInt(); | ||
67 | QCOMPARE(index2, 1); | 67 | QCOMPARE(index2, 1); | ||
68 | QCOMPARE(windowId2, 0); | 68 | QCOMPARE(windowId2, 0); | ||
69 | 69 | | |||
70 | bool pinnedTab = m_testHelper.evaluate("Falkon.Tabs.pinTab({index: 1})").toBool(); | 70 | bool pinnedTab = m_testHelper.evaluate("Falkon.Tabs.pinTab({index: 1})").toBool(); | ||
71 | QVERIFY(pinnedTab); | 71 | QVERIFY(pinnedTab); | ||
72 | QObject *qmlTabObject2 = m_testHelper.evaluateQObject("Falkon.Tabs.get({index: 0})"); | 72 | QObject *qmlTabObject2 = m_testHelper.evaluateQObject("Falkon.Tabs.get({index: 0})"); | ||
73 | QVERIFY(qmlTabObject2); | 73 | QVERIFY(qmlTabObject2); | ||
74 | QCOMPARE(qmlTabObject2->property("index").toInt(), 0); | 74 | QCOMPARE(qmlTabObject2->property("index").toInt(), 0); | ||
75 | QCOMPARE(qmlTabObject2->property("pinned").toBool(), true); | 75 | QCOMPARE(qmlTabObject2->property("pinned").toBool(), true); | ||
76 | QTRY_COMPARE(qmlTabObject2->property("url").toString(), "https://another-example.com/"); | 76 | QTRY_COMPARE(qmlTabObject2->property("url").toString(), QSL("https://another-example.com/")); | ||
77 | 77 | | |||
78 | bool unpinnedTab = m_testHelper.evaluate("Falkon.Tabs.unpinTab({index: 0})").toBool(); | 78 | bool unpinnedTab = m_testHelper.evaluate("Falkon.Tabs.unpinTab({index: 0})").toBool(); | ||
79 | QVERIFY(unpinnedTab); | 79 | QVERIFY(unpinnedTab); | ||
80 | QObject *qmlTabObject3 = m_testHelper.evaluateQObject("Falkon.Tabs.get({index: 0})"); | 80 | QObject *qmlTabObject3 = m_testHelper.evaluateQObject("Falkon.Tabs.get({index: 0})"); | ||
81 | QVERIFY(qmlTabObject3); | 81 | QVERIFY(qmlTabObject3); | ||
82 | QCOMPARE(qmlTabObject3->property("url").toString(), "https://another-example.com/"); | 82 | QCOMPARE(qmlTabObject3->property("url").toString(), QSL("https://another-example.com/")); | ||
83 | QCOMPARE(qmlTabObject3->property("index").toInt(), 0); | 83 | QCOMPARE(qmlTabObject3->property("index").toInt(), 0); | ||
84 | QCOMPARE(qmlTabObject3->property("pinned").toBool(), false); | 84 | QCOMPARE(qmlTabObject3->property("pinned").toBool(), false); | ||
85 | 85 | | |||
86 | // Next-Previous-Current | 86 | // Next-Previous-Current | ||
87 | QCOMPARE(mApp->getWindow()->tabWidget()->currentIndex(), 0); | 87 | QCOMPARE(mApp->getWindow()->tabWidget()->currentIndex(), 0); | ||
88 | m_testHelper.evaluate("Falkon.Tabs.nextTab()"); | 88 | m_testHelper.evaluate("Falkon.Tabs.nextTab()"); | ||
89 | QCOMPARE(mApp->getWindow()->tabWidget()->currentIndex(), 1); | 89 | QCOMPARE(mApp->getWindow()->tabWidget()->currentIndex(), 1); | ||
90 | m_testHelper.evaluate("Falkon.Tabs.nextTab()"); | 90 | m_testHelper.evaluate("Falkon.Tabs.nextTab()"); | ||
Show All 24 Lines |