diff --git a/autotests/tabmodeltest.cpp b/autotests/tabmodeltest.cpp index adff8dab9..9a8662c6c 100644 --- a/autotests/tabmodeltest.cpp +++ b/autotests/tabmodeltest.cpp @@ -113,12 +113,39 @@ void TabModelTest::dataTest() QCOMPARE(model.index(0, 0).data(Qt::DecorationRole).value().pixmap(16), tab0->icon().pixmap(16)); QCOMPARE(model.index(0, 0).data(TabModel::PinnedRole).toBool(), tab0->isPinned()); QCOMPARE(model.index(0, 0).data(TabModel::RestoredRole).toBool(), tab0->isRestored()); + QCOMPARE(model.index(0, 0).data(TabModel::CurrentTabRole).toBool(), true); w->tabWidget()->addView(QUrl("http://test.com")); QTest::qWait(10); delete w; } +void TabModelTest::pinTabTest() +{ + BrowserWindow *w = mApp->createWindow(Qz::BW_NewWindow); + + TabModel model(w); + ModelTest modelTest(&model); + + w->tabWidget()->addView(QUrl("http://test.com")); + + QTRY_COMPARE(model.rowCount(), 2); + + WebTab *tab0 = w->weView(0)->webTab(); + WebTab *tab1 = w->weView(1)->webTab(); + + QCOMPARE(model.data(model.index(0, 0), TabModel::WebTabRole).value(), tab0); + QCOMPARE(model.data(model.index(1, 0), TabModel::WebTabRole).value(), tab1); + + tab1->togglePinned(); + + QCOMPARE(model.data(model.index(0, 0), TabModel::WebTabRole).value(), tab1); + QCOMPARE(model.data(model.index(1, 0), TabModel::WebTabRole).value(), tab0); + + QTest::qWait(10); + delete w; +} + void TabModelTest::treeModelTest() { BrowserWindow *w = mApp->createWindow(Qz::BW_NewWindow); diff --git a/autotests/tabmodeltest.h b/autotests/tabmodeltest.h index f11c82c05..59187f2ff 100644 --- a/autotests/tabmodeltest.h +++ b/autotests/tabmodeltest.h @@ -29,6 +29,7 @@ private slots: void basicTest(); void dataTest(); + void pinTabTest(); void treeModelTest(); void resetTreeModelTest(); }; diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index f99ea11aa..fcd11b0b8 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -339,7 +339,7 @@ void WebTab::attach(BrowserWindow* window) } }; - currentTabChanged(m_tabBar->currentIndex()); + currentChanged(m_tabBar->currentIndex()); connect(m_tabBar, &TabBar::currentChanged, this, currentChanged); }