on xenial help sign in
Add missing mock data for Wizard plugin
commit2f186a956ec977ac739dc6508c41393c889f8aac authorRodney Dawes <dobey@ubports.com> dateMon 26 Oct 2020, 13:22 (6 years ago) parente9e0621
4 files changed+14−1
tests/mocks/Wizard/CMakeLists.txt+1 tests/mocks/Wizard/MockSystem.cpp+7−1 tests/mocks/Wizard/MockSystem.h+4 tests/mocks/Wizard/mockplugin.cpp+2
tests/mocks/Wizard/CMakeLists.txt+1
@@ -8,6 +8,7 @@ include_directories(
88add_library(MockWizard-qml MODULE
99 mockplugin.cpp
1010 MockSystem.cpp
11+ ${CMAKE_SOURCE_DIR}/plugins/Wizard/Changelog.cpp
1112 ${CMAKE_SOURCE_DIR}/plugins/Wizard/PageList.cpp
1213 ${CMAKE_SOURCE_DIR}/plugins/Wizard/timezonemodel.cpp
1314 ${CMAKE_SOURCE_DIR}/plugins/Wizard/LocalePlugin.cpp
tests/mocks/Wizard/MockSystem.cpp+7−1
@@ -21,7 +21,8 @@
2121
2222MockSystem::MockSystem()
2323 : QObject(),
24− m_wizardEnabled(false)
24+ m_wizardEnabled(false),
25+ m_version("Lomiri 17.04.12")
2526{
2627}
2728
@@ -47,6 +48,11 @@ void MockSystem::setIsUpdate(bool update)
4748 Q_EMIT isUpdateChanged();
4849}
4950
51+QString MockSystem::version() const
52+{
53+ return m_version;
54+}
55+
5056void MockSystem::updateSessionLocale(const QString &locale)
5157{
5258 Q_EMIT updateSessionLocaleCalled(locale);
tests/mocks/Wizard/MockSystem.h+4
@@ -24,6 +24,7 @@ class MockSystem : public QObject
2424{
2525 Q_OBJECT
2626 Q_PROPERTY(bool wizardEnabled READ wizardEnabled WRITE setWizardEnabled NOTIFY wizardEnabledChanged)
27+ Q_PROPERTY(QString version READ version NOTIFY versionChanged)
2728 Q_PROPERTY(bool isUpdate READ isUpdate WRITE setIsUpdate NOTIFY isUpdateChanged)
2829
2930public:
@@ -33,6 +34,7 @@ public:
3334 void setWizardEnabled(bool enabled);
3435 bool isUpdate() const;
3536 void setIsUpdate(bool enabled); // only in mock
37+ QString version() const;
3638
3739public Q_SLOTS:
3840 void updateSessionLocale(const QString &locale);
@@ -44,6 +46,7 @@ public Q_SLOTS:
4446Q_SIGNALS:
4547 void wizardEnabledChanged();
4648 void isUpdateChanged(); // only in mock
49+ void versionChanged();
4750 void updateSessionLocaleCalled(const QString &locale); // only in mock
4851 void wouldHaveSetSkipUntilFinish(); // only in mock
4952
@@ -52,6 +55,7 @@ private:
5255
5356 bool m_wizardEnabled = true;
5457 bool m_isUpdate = false;
58+ QString m_version;
5559};
5660
5761#endif
tests/mocks/Wizard/mockplugin.cpp+2
@@ -14,6 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17+#include "Changelog.h"
1718#include "mockplugin.h"
1819#include "MockSystem.h"
1920#include "PageList.h"
@@ -30,6 +31,7 @@ void MockWizardPlugin::registerTypes(const char *uri)
3031 qmlRegisterType<PageList>(uri, 0, 1, "PageList");
3132 qmlRegisterSingletonType<MockSystem>(uri, 0, 1, "System", [](QQmlEngine*, QJSEngine*) -> QObject* { return new MockSystem; });
3233 qmlRegisterSingletonType<Status>(uri, 0, 1, "Status", [](QQmlEngine*, QJSEngine*) -> QObject* { return new Status; });
34+ qmlRegisterSingletonType<Changelog>(uri, 0, 1, "Changelog", [](QQmlEngine*, QJSEngine*) -> QObject* { return new Changelog; });
3335 qmlRegisterType<TimeZoneLocationModel>(uri, 0, 1, "TimeZoneModel");
3436 qmlRegisterType<KeyboardLayoutsModel>(uri, 0, 1, "KeyboardLayoutsModel");
3537 qmlRegisterType<LocalePlugin>(uri, 0, 1, "LocalePlugin");