[education/rkward] rkward: Init command line args values in tests, too.
Thomas Friedrichsmeier
null at kde.org
Sat Jun 8 23:21:01 BST 2024
Git commit ef1f0d5e9bd6abe76e90cf895655eb0c2024673d by Thomas Friedrichsmeier.
Committed on 08/06/2024 at 22:08.
Pushed by tfry into branch 'master'.
Init command line args values in tests, too.
M +4 -1 rkward/autotests/core_test.cpp
M +1 -1 rkward/main.cpp
M +2 -2 rkward/misc/rkcommandlineargs.cpp
M +1 -1 rkward/misc/rkcommandlineargs.h
https://invent.kde.org/education/rkward/-/commit/ef1f0d5e9bd6abe76e90cf895655eb0c2024673d
diff --git a/rkward/autotests/core_test.cpp b/rkward/autotests/core_test.cpp
index ffef9a0e5..53aa3ebe1 100644
--- a/rkward/autotests/core_test.cpp
+++ b/rkward/autotests/core_test.cpp
@@ -28,6 +28,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "../core/robjectlist.h"
#include "../core/renvironmentobject.h"
#include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcommandlineargs.h"
QElapsedTimer _test_timer;
@@ -155,7 +156,9 @@ private Q_SLOTS:
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--no-sandbox"); // Allow test to be run as root, which, for some reason is being done on the SuSE CI.
// qputenv("QT_LOGGING_RULES", "qt.qpa.windows.debug=true"); // Deliberately overwriting the rules set in the CI, as we are producing too much output, otherwise -- TODO: does not appear to have any effect
KLocalizedString::setApplicationDomain("rkward");
- KAboutData::setApplicationData(KAboutData("rkward", "RKWard", RKWARD_VERSION, "Frontend to the R statistics language", KAboutLicense::GPL)); // component name needed for .rc files to load
+ KAboutData about("rkward", "RKWard", RKWARD_VERSION, "Frontend to the R statistics language", KAboutLicense::GPL); // component name needed for .rc files to load
+ KAboutData::setApplicationData(about);
+ new RKCommandLineArgs(&about, qApp);
RK_Debug::RK_Debug_Level = DL_DEBUG;
testLog(R_EXECUTABLE);
RKSessionVars::r_binary = R_EXECUTABLE;
diff --git a/rkward/main.cpp b/rkward/main.cpp
index b16d7a9b1..9deb10d0d 100644
--- a/rkward/main.cpp
+++ b/rkward/main.cpp
@@ -279,7 +279,7 @@ int main (int argc, char *argv[]) {
aboutData.setOtherText(QString("<p><b>%1</b></p><ul><li><a href=\"https://www.jstatsoft.org/article/view/v049i09\">%2</a></li><li>Friedrichsmeier, T. & the RKWard Team (%3). RKWard: %4. Version %5. %6</li></ul>").arg(i18n("How to cite:"), i18n("Peer-reviewed article in the Journal of Statistical Software"), aboutData.copyrightStatement().right(4), aboutData.shortDescription(), aboutData.version(), aboutData.homepage()));
KAboutData::setApplicationData (aboutData);
- RKCommandLineArgs args(&aboutData, app);
+ RKCommandLineArgs args(&aboutData, &app);
// Set up debugging
RK_Debug::RK_Debug_Level = DL_FATAL - args[RKCommandLineArgs::DebugLevel].toInt();
diff --git a/rkward/misc/rkcommandlineargs.cpp b/rkward/misc/rkcommandlineargs.cpp
index e463438bd..e26075438 100644
--- a/rkward/misc/rkcommandlineargs.cpp
+++ b/rkward/misc/rkcommandlineargs.cpp
@@ -17,7 +17,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
RKCommandLineArgs* RKCommandLineArgs::instance = nullptr;
-RKCommandLineArgs::RKCommandLineArgs(KAboutData *about, QCoreApplication &app) {
+RKCommandLineArgs::RKCommandLineArgs(KAboutData *about, QCoreApplication *app) {
RK_TRACE(MISC);
RK_ASSERT(instance == nullptr);
@@ -38,7 +38,7 @@ RKCommandLineArgs::RKCommandLineArgs(KAboutData *about, QCoreApplication &app) {
parser.addOption(QCommandLineOption("setup", i18n("Act as if the version of RKWard had changed (show setup wizard, and (re-)install rkward R package).")));
parser.addPositionalArgument("files", i18n("File or files to open, typically a workspace, or an R script file. When loading several things, you should specify the workspace, first."), "[Files...]");
- parser.process(app);
+ parser.process(*app);
about->processCommandLine(&parser);
storage.resize(NUM_OPTIONS);
diff --git a/rkward/misc/rkcommandlineargs.h b/rkward/misc/rkcommandlineargs.h
index 55bdca6bd..dcd2df0a6 100644
--- a/rkward/misc/rkcommandlineargs.h
+++ b/rkward/misc/rkcommandlineargs.h
@@ -18,7 +18,7 @@ class QCoreApplication;
class RKCommandLineArgs {
public:
- explicit RKCommandLineArgs(KAboutData *about, QCoreApplication &app);
+ explicit RKCommandLineArgs(KAboutData *about, QCoreApplication *app);
~RKCommandLineArgs() {};
enum Option {
UrlArgs,
More information about the rkward-tracker
mailing list