From 58de7cea94f35c991d37b01f49c9bc4693818a9c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 5 Mar 2018 13:36:16 +0100 Subject: [PATCH] [calamares] Allow test-loading of View modules The view modules need a QApplication, not just a core application, and a ViewManager instance, so create those before really loading the module. --- src/calamares/testmain.cpp | 39 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/calamares/testmain.cpp b/src/calamares/testmain.cpp index 0f07e6e13..5671a591e 100644 --- a/src/calamares/testmain.cpp +++ b/src/calamares/testmain.cpp @@ -30,7 +30,9 @@ #include "Job.h" #include "JobQueue.h" #include "Settings.h" +#include "ViewManager.h" +#include #include #include #include @@ -40,26 +42,10 @@ struct ModuleConfig { - QString - moduleName() const - { - return m_module; - } - QString - configFile() const - { - return m_jobConfig; - } - QString - language() const - { - return m_language; - } - QString - globalConfigFile() const - { - return m_globalConfig; - } + QString moduleName() const { return m_module; } + QString configFile() const { return m_jobConfig; } + QString language() const { return m_language; } + QString globalConfigFile() const { return m_globalConfig; } QString m_module; QString m_jobConfig; @@ -202,6 +188,7 @@ int main( int argc, char* argv[] ) { QCoreApplication a( argc, argv ); + QApplication* aw = nullptr; ModuleConfig module = handle_args( a ); if ( module.moduleName().isEmpty() ) @@ -233,6 +220,13 @@ main( int argc, char* argv[] ) return 1; } + cDebug() << " .. got" << m->name() << m->typeString() << m->interfaceString(); + if ( m->type() == Calamares::Module::Type::View ) + { + aw = new QApplication( argc, argv ); + (void)Calamares::ViewManager::instance( nullptr ); + } + if ( !m->isLoaded() ) { m->loadSelf(); @@ -268,5 +262,10 @@ main( int argc, char* argv[] ) ++count; } + if ( aw ) + { + delete aw; + } + return failure_count ? 1 : 0; }