mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
WebTab: Fix updating isCurrentTab in attach
This commit is contained in:
parent
16c7af63b6
commit
af95dd14e2
|
@ -113,12 +113,39 @@ void TabModelTest::dataTest()
|
||||||
QCOMPARE(model.index(0, 0).data(Qt::DecorationRole).value<QIcon>().pixmap(16), tab0->icon().pixmap(16));
|
QCOMPARE(model.index(0, 0).data(Qt::DecorationRole).value<QIcon>().pixmap(16), tab0->icon().pixmap(16));
|
||||||
QCOMPARE(model.index(0, 0).data(TabModel::PinnedRole).toBool(), tab0->isPinned());
|
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::RestoredRole).toBool(), tab0->isRestored());
|
||||||
|
QCOMPARE(model.index(0, 0).data(TabModel::CurrentTabRole).toBool(), true);
|
||||||
|
|
||||||
w->tabWidget()->addView(QUrl("http://test.com"));
|
w->tabWidget()->addView(QUrl("http://test.com"));
|
||||||
|
|
||||||
QTest::qWait(10);
|
QTest::qWait(10);
|
||||||
delete w;
|
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<WebTab*>(), tab0);
|
||||||
|
QCOMPARE(model.data(model.index(1, 0), TabModel::WebTabRole).value<WebTab*>(), tab1);
|
||||||
|
|
||||||
|
tab1->togglePinned();
|
||||||
|
|
||||||
|
QCOMPARE(model.data(model.index(0, 0), TabModel::WebTabRole).value<WebTab*>(), tab1);
|
||||||
|
QCOMPARE(model.data(model.index(1, 0), TabModel::WebTabRole).value<WebTab*>(), tab0);
|
||||||
|
|
||||||
|
QTest::qWait(10);
|
||||||
|
delete w;
|
||||||
|
}
|
||||||
|
|
||||||
void TabModelTest::treeModelTest()
|
void TabModelTest::treeModelTest()
|
||||||
{
|
{
|
||||||
BrowserWindow *w = mApp->createWindow(Qz::BW_NewWindow);
|
BrowserWindow *w = mApp->createWindow(Qz::BW_NewWindow);
|
||||||
|
|
|
@ -29,6 +29,7 @@ private slots:
|
||||||
|
|
||||||
void basicTest();
|
void basicTest();
|
||||||
void dataTest();
|
void dataTest();
|
||||||
|
void pinTabTest();
|
||||||
void treeModelTest();
|
void treeModelTest();
|
||||||
void resetTreeModelTest();
|
void resetTreeModelTest();
|
||||||
};
|
};
|
||||||
|
|
|
@ -339,7 +339,7 @@ void WebTab::attach(BrowserWindow* window)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
currentTabChanged(m_tabBar->currentIndex());
|
currentChanged(m_tabBar->currentIndex());
|
||||||
connect(m_tabBar, &TabBar::currentChanged, this, currentChanged);
|
connect(m_tabBar, &TabBar::currentChanged, this, currentChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user