Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
ddd5ebb5
Commit
ddd5ebb5
authored
Oct 01, 2022
by
Waqar Ahmed
Committed by
Christoph Cullmann
Oct 01, 2022
Browse files
Add test for LRU fix when there are widgets
parent
098f435f
Pipeline
#239324
passed with stage
in 14 minutes and 44 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
apps/lib/autotests/kate_view_mgmt_tests.cpp
View file @
ddd5ebb5
...
...
@@ -206,3 +206,47 @@ void KateViewManagementTests::testTwoMainWindowsCloseInitialDocument3()
// create a new document, this did crash due to empty view space
second
->
viewManager
()
->
slotDocumentNew
();
}
void
KateViewManagementTests
::
testTabLRUWithWidgets
()
{
app
->
sessionManager
()
->
activateAnonymousSession
();
app
->
activeKateMainWindow
()
->
viewManager
()
->
slotDocumentNew
();
// 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
vm
->
activateView
(
view1
->
document
());
// activate widget again
QCOMPARE
(
vs
->
currentWidget
(),
nullptr
);
vm
->
activateWidget
(
widget
);
QCOMPARE
(
vs
->
currentWidget
(),
widget
);
// close "widget"
vm
->
slotDocumentClose
();
// 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
);
vm
->
slotDocumentClose
();
// and view2 after closing view1
QCOMPARE
(
vs
->
m_registeredDocuments
.
size
(),
2
);
QCOMPARE
(
vm
->
activeView
(),
view2
);
}
apps/lib/autotests/kate_view_mgmt_tests.h
View file @
ddd5ebb5
...
...
@@ -30,6 +30,7 @@ private Q_SLOTS:
void
testTwoMainWindowsCloseInitialDocument1
();
void
testTwoMainWindowsCloseInitialDocument2
();
void
testTwoMainWindowsCloseInitialDocument3
();
void
testTabLRUWithWidgets
();
private:
class
QTemporaryDir
*
m_tempdir
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment