Commit 5ecc6bb2 authored by Volker Krause's avatar Volker Krause
Browse files

Use the schema model templates for unit testing the schema model

parent c42efd7a
......@@ -2,6 +2,7 @@ set(analyzer_lib_srcs
core/product.cpp
core/schemaentry.cpp
core/schemaentryelement.cpp
core/schemaentrytemplates.cpp
core/survey.cpp
rest/restapi.cpp
......@@ -11,6 +12,8 @@ set(analyzer_lib_srcs
model/productmodel.cpp
model/schemamodel.cpp
model/surveymodel.cpp
schemaentrytemplates/schemaentrytemplates.qrc
)
add_library(UserFeedbackAnalyzer STATIC ${analyzer_lib_srcs})
......@@ -35,11 +38,8 @@ set(analyzer_srcs
schemaeditor/schemaeditwidget.cpp
schemaeditor/schemaentryitemeditorfactory.cpp
schemaeditor/schemaentrytemplates.cpp
schemaeditor/schemaentrytypecombobox.cpp
schemaentrytemplates/schemaentrytemplates.qrc
surveyeditor/surveydialog.cpp
surveyeditor/surveyeditor.cpp
)
......
......@@ -40,8 +40,6 @@ QVector<SchemaEntry> SchemaEntryTemplates::availableTemplates()
QDirIterator it(dir, {QStringLiteral("*.json")}, QDir::Files | QDir::Readable);
while (it.hasNext()) {
const auto fileName = it.next();
qDebug() << fileName;
QFile f(fileName);
if (!f.open(QFile::ReadOnly))
continue;
......
......@@ -27,6 +27,8 @@ int main(int argc, char** argv)
QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
Q_INIT_RESOURCE(schemaentrytemplates);
QApplication app(argc, argv);
UserFeedback::Analyzer::MainWindow mainWindow;
......
......@@ -18,11 +18,11 @@
#include "schemaeditwidget.h"
#include "ui_schemaeditwidget.h"
#include "schemaentryitemeditorfactory.h"
#include "schemaentrytemplates.h"
#include <model/schemamodel.h>
#include <rest/restapi.h>
#include <core/product.h>
#include <core/schemaentrytemplates.h>
#include <QDebug>
#include <QMenu>
......
......@@ -16,6 +16,7 @@
*/
#include <model/schemamodel.h>
#include <core/schemaentrytemplates.h>
#include <3rdparty/qt/modeltest.h>
......@@ -33,6 +34,7 @@ class SchemaModelTest : public QObject
private slots:
void initTestCase()
{
Q_INIT_RESOURCE(schemaentrytemplates);
QStandardPaths::setTestModeEnabled(true);
}
......@@ -56,6 +58,10 @@ private slots:
p.setSchema(schema);
model.setProduct(p);
QCOMPARE(model.rowCount(), schema.size());
p.setSchema(SchemaEntryTemplates::availableTemplates());
model.setProduct(p);
QVERIFY(model.rowCount() > 0);
}
};
......
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