Commit bdfe92d4 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Fix tabbar auto hide + test

parent 8989e4da
Pipeline #259255 failed with stage
in 6 minutes and 24 seconds
......@@ -396,3 +396,39 @@ void KateViewManagementTests::testWindowsClosesDocuments()
delete second;
QCOMPARE(app->documentManager()->documentList().size(), 1);
}
void KateViewManagementTests::testTabBarHidesShows()
{
app->sessionManager()->sessionNew();
KateMainWindow *mw = app->activeKateMainWindow();
auto vm = mw->viewManager();
auto vs = vm->activeViewSpace();
vs->m_autoHideTabBar = true;
vs->tabBarToggled();
QVERIFY(!vs->m_tabBar->isVisible());
app->activeKateMainWindow()->viewManager()->slotDocumentNew();
QCOMPARE(vm->views().size(), 1);
QVERIFY(vs->m_tabBar->isHidden());
app->activeKateMainWindow()->viewManager()->slotDocumentNew();
QCOMPARE(vm->views().size(), 2);
qApp->processEvents();
QVERIFY(vs->m_tabBar->isVisible());
vm->slotDocumentClose();
QCOMPARE(vm->views().size(), 1);
qApp->processEvents();
QVERIFY(!vs->m_tabBar->isVisible());
Utils::addWidget(new QWidget, app->activeMainWindow());
qApp->processEvents();
QVERIFY(vs->m_tabBar->isVisible());
vm->slotDocumentClose();
qApp->processEvents();
QVERIFY(!vs->m_tabBar->isVisible());
// m_autoHideTabBar
}
......@@ -37,6 +37,7 @@ private Q_SLOTS:
void testActivateNotAddedWidget();
void testBug460613();
void testWindowsClosesDocuments();
void testTabBarHidesShows();
private:
class QTemporaryDir *m_tempdir;
......
......@@ -171,8 +171,9 @@ KateViewSpace::KateViewSpace(KateViewManager *viewManager, QWidget *parent, cons
connect(KateApp::self(), &KateApp::configurationChanged, this, &KateViewSpace::readConfig);
// ensure we show/hide tabbar if needed
connect(KateApp::self()->documentManager(), &KateDocManager::documentCreated, this, &KateViewSpace::documentCreatedOrDeleted);
connect(KateApp::self()->documentManager(), &KateDocManager::documentDeleted, this, &KateViewSpace::documentCreatedOrDeleted);
// Queued so tabbar etc handle it first
connect(KateApp::self()->documentManager(), &KateDocManager::documentCreated, this, &KateViewSpace::documentCreatedOrDeleted, Qt::QueuedConnection);
connect(KateApp::self()->documentManager(), &KateDocManager::documentDeleted, this, &KateViewSpace::documentCreatedOrDeleted, Qt::QueuedConnection);
}
KateViewSpace::~KateViewSpace() = default;
......@@ -662,6 +663,8 @@ QWidget *KateViewSpace::takeView(DocOrWidget docOrWidget)
Qt::QueuedConnection);
}
documentCreatedOrDeleted(nullptr);
return ret;
}
......@@ -766,6 +769,7 @@ void KateViewSpace::closeTabRequest(int idx)
if (m_registeredDocuments.isEmpty() && m_tabBar->count() == 0) {
Q_EMIT viewSpaceEmptied(this);
}
documentCreatedOrDeleted(nullptr);
}
return;
}
......
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