Commit 940e6451 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Create autotest

parent d12d1b98
Pipeline #44375 passed with stage
in 9 minutes and 11 seconds
......@@ -21,6 +21,7 @@
#include "loadgroupmenutest.h"
#include "loadgroupmenu.h"
#include <QTest>
#include <QStandardPaths>
QTEST_MAIN(LoadGroupMenuTest)
LoadGroupMenuTest::LoadGroupMenuTest(QObject *parent)
: QObject(parent)
......@@ -31,5 +32,7 @@ LoadGroupMenuTest::LoadGroupMenuTest(QObject *parent)
void LoadGroupMenuTest::shouldHaveDefaultValues()
{
LoadGroupMenu m;
QVERIFY(m.isEmpty());
QVERIFY(!m.isEnabled());
//TODO
}
......@@ -48,9 +48,15 @@ void LoadGroupMenu::init()
}
QDir dir(groupPath);
const QStringList groups = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
if (groups.isEmpty()) {
setEnabled(false);
return;
}
for (const QString &file : groups) {
//TODO add connect etc.
//TODO groupPath + file.
addAction(file);
QAction *act = addAction(file);
const QString fullPath = groupPath + QLatin1Char('/') + file;
connect(act, &QAction::triggered, this, [this, fullPath]{
Q_EMIT loadGroupRequested(fullPath);
});
}
}
Markdown is supported
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