Commit ddd5ebb5 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Add test for LRU fix when there are widgets

parent 098f435f
Pipeline #239324 passed with stage
in 14 minutes and 44 seconds
......@@ -206,3 +206,47 @@ void KateViewManagementTests::testTwoMainWindowsCloseInitialDocument3()
// create a new document, this did crash due to empty view space
void KateViewManagementTests::testTabLRUWithWidgets()
// get first main window
KateMainWindow *mw = app->activeKateMainWindow();
auto vm = mw->viewManager();
auto vs = vm->activeViewSpace();
auto view1 = vm->createView(nullptr);
auto view2 = vm->createView(nullptr);
QCOMPARE(vs->m_registeredDocuments.size(), 3);
// view2 should be active
QCOMPARE(vm->activeView(), view2);
// Add a widget
QWidget *widget = new QWidget;
Utils::addWidget(widget, app->activeMainWindow());
QCOMPARE(vs->currentWidget(), widget);
QCOMPARE(vs->m_registeredDocuments.size(), 4);
// activate view1
// activate widget again
QCOMPARE(vs->currentWidget(), nullptr);
QCOMPARE(vs->currentWidget(), widget);
// close "widget"
// on closing the widget we should fallback to view1
// as it was the last visited view
QCOMPARE(vs->m_registeredDocuments.size(), 3);
QCOMPARE(vm->activeView(), view1);
// and view2 after closing view1
QCOMPARE(vs->m_registeredDocuments.size(), 2);
QCOMPARE(vm->activeView(), view2);
......@@ -30,6 +30,7 @@ private Q_SLOTS:
void testTwoMainWindowsCloseInitialDocument1();
void testTwoMainWindowsCloseInitialDocument2();
void testTwoMainWindowsCloseInitialDocument3();
void testTabLRUWithWidgets();
class QTemporaryDir *m_tempdir;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment