Commit 6559dc82 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

try to balance test over two runs

parent a3361287
Pipeline #170169 passed with stage
in 5 minutes and 8 seconds
......@@ -12,7 +12,6 @@
#include <KConfigGroup>
#include <QCommandLineParser>
#include <QSignalSpy>
#include <QTemporaryDir>
#include <QtTestWidgets>
......@@ -88,40 +87,6 @@ void KateSessionManagerTest::urlizeSessionFile()
QCOMPARE(m_manager->sessionList().size(), 0);
}
void KateSessionManagerTest::deleteSession()
{
m_manager->activateSession(QStringLiteral("foo"));
KateSession::Ptr s = m_manager->activeSession();
m_manager->activateSession(QStringLiteral("bar"));
KateSession::Ptr s2 = m_manager->activeSession();
QCOMPARE(m_manager->sessionList().size(), 2);
m_manager->deleteSession(s);
QCOMPARE(m_manager->sessionList().size(), 1);
// cleanup again for next test
QVERIFY(m_manager->activateAnonymousSession());
QVERIFY(m_manager->deleteSession(s2));
QCOMPARE(m_manager->sessionList().size(), 0);
}
void KateSessionManagerTest::deleteActiveSession()
{
m_manager->activateSession(QStringLiteral("foo"));
KateSession::Ptr s = m_manager->activeSession();
QCOMPARE(m_manager->sessionList().size(), 1);
m_manager->deleteSession(s);
QCOMPARE(m_manager->sessionList().size(), 1);
// cleanup again for next test
QVERIFY(m_manager->activateAnonymousSession());
QVERIFY(m_manager->deleteSession(s));
QCOMPARE(m_manager->sessionList().size(), 0);
}
void KateSessionManagerTest::renameSession()
{
m_manager->activateSession(QStringLiteral("foo"));
......@@ -140,42 +105,3 @@ void KateSessionManagerTest::renameSession()
QVERIFY(m_manager->deleteSession(s));
QCOMPARE(m_manager->sessionList().size(), 0);
}
void KateSessionManagerTest::saveActiveSessionWithAnynomous()
{
QVERIFY(m_manager->activateAnonymousSession());
QVERIFY(m_manager->activeSession()->isAnonymous());
QVERIFY(m_manager->sessionList().empty());
QCOMPARE(m_manager->saveActiveSession(), true);
QCOMPARE(m_manager->activeSession()->isAnonymous(), true);
QCOMPARE(m_manager->activeSession()->name(), QString());
QCOMPARE(m_manager->sessionList().size(), 0);
}
void KateSessionManagerTest::deletingSessionFilesUnderRunningApp()
{
m_manager->activateSession(QStringLiteral("foo"));
m_manager->activateSession(QStringLiteral("bar"));
QVERIFY(m_manager->sessionList().size() == 2);
QVERIFY(m_manager->activeSession()->name() == QLatin1String("bar"));
const QString file = m_tempdir->path() + QLatin1String("/foo.katesession");
QVERIFY(QFile::remove(file));
// wait for notification about external session list change
QSignalSpy spy(m_manager, &KateSessionManager::sessionListChanged);
QVERIFY(spy.wait());
QCOMPARE(m_manager->activeSession()->name(), QLatin1String("bar"));
}
void KateSessionManagerTest::startNonEmpty()
{
m_manager->activateSession(QStringLiteral("foo"));
m_manager->activateSession(QStringLiteral("bar"));
KateSessionManager m(this, m_tempdir->path());
QCOMPARE(m.sessionList().size(), 2);
}
......@@ -24,12 +24,6 @@ private Q_SLOTS:
void anonymousSessionFile();
void urlizeSessionFile();
void renameSession();
void deleteActiveSession();
void deleteSession();
void saveActiveSessionWithAnynomous();
void deletingSessionFilesUnderRunningApp();
void startNonEmpty();
private:
class QTemporaryDir *m_tempdir;
......
......@@ -11,6 +11,7 @@
#include <QActionGroup>
#include <QCommandLineParser>
#include <QSignalSpy>
#include <QTemporaryDir>
#include <QtTestWidgets>
......@@ -45,13 +46,86 @@ void KateSessionsActionTest::basic()
QCOMPARE(actions.size(), 0);
}
void KateSessionsActionTest::deleteActiveSession()
{
m_manager->activateSession(QStringLiteral("foo"));
KateSession::Ptr s = m_manager->activeSession();
QCOMPARE(m_manager->sessionList().size(), 1);
m_manager->deleteSession(s);
QCOMPARE(m_manager->sessionList().size(), 1);
// cleanup again for next test
QVERIFY(m_manager->activateAnonymousSession());
QVERIFY(m_manager->deleteSession(s));
QCOMPARE(m_manager->sessionList().size(), 0);
}
void KateSessionsActionTest::deleteSession()
{
m_manager->activateSession(QStringLiteral("foo"));
KateSession::Ptr s = m_manager->activeSession();
m_manager->activateSession(QStringLiteral("bar"));
KateSession::Ptr s2 = m_manager->activeSession();
QCOMPARE(m_manager->sessionList().size(), 2);
m_manager->deleteSession(s);
QCOMPARE(m_manager->sessionList().size(), 1);
// cleanup again for next test
QVERIFY(m_manager->activateAnonymousSession());
QVERIFY(m_manager->deleteSession(s2));
QCOMPARE(m_manager->sessionList().size(), 0);
}
void KateSessionsActionTest::saveActiveSessionWithAnynomous()
{
QVERIFY(m_manager->activateAnonymousSession());
QVERIFY(m_manager->activeSession()->isAnonymous());
QVERIFY(m_manager->sessionList().empty());
QCOMPARE(m_manager->saveActiveSession(), true);
QCOMPARE(m_manager->activeSession()->isAnonymous(), true);
QCOMPARE(m_manager->activeSession()->name(), QString());
QCOMPARE(m_manager->sessionList().size(), 0);
}
void KateSessionsActionTest::deletingSessionFilesUnderRunningApp()
{
m_manager->activateSession(QStringLiteral("foo"));
m_manager->activateSession(QStringLiteral("bar"));
QVERIFY(m_manager->sessionList().size() == 2);
QVERIFY(m_manager->activeSession()->name() == QLatin1String("bar"));
const QString file = m_tempdir->path() + QLatin1String("/foo.katesession");
QVERIFY(QFile::remove(file));
// wait for notification about external session list change
QSignalSpy spy(m_manager, &KateSessionManager::sessionListChanged);
QVERIFY(spy.wait());
QCOMPARE(m_manager->activeSession()->name(), QLatin1String("bar"));
}
void KateSessionsActionTest::startNonEmpty()
{
m_manager->activateSession(QStringLiteral("foo"));
m_manager->activateSession(QStringLiteral("bar"));
KateSessionManager m(this, m_tempdir->path());
QCOMPARE(m.sessionList().size(), 2);
}
void KateSessionsActionTest::limit()
{
for (int i = 0; i < 14; i++) {
m_manager->copySession(m_manager->activeSession(), QStringLiteral("session %1").arg(i));
}
QCOMPARE(m_manager->sessionList().size(), 14);
QVERIFY(m_manager->sessionList().size() > 10);
QCOMPARE(m_ac->isEnabled(), true);
m_ac->slotAboutToShow();
......
......@@ -19,6 +19,13 @@ public:
private Q_SLOTS:
void basic();
void deleteActiveSession();
void deleteSession();
void saveActiveSessionWithAnynomous();
void deletingSessionFilesUnderRunningApp();
void startNonEmpty();
void limit();
private:
......
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