[education/rkward] /: Add testcase for bug #505364

Thomas Friedrichsmeier null at kde.org
Mon Jun 9 10:05:38 BST 2025


Git commit 2a7b71448868b1b84a8f86f17d1224c461f8d7b9 by Thomas Friedrichsmeier.
Committed on 09/06/2025 at 09:05.
Pushed by tfry into branch 'master'.

Add testcase for bug #505364

M  +1    -1    ChangeLog
M  +12   -0    rkward/autotests/core_test.cpp

https://invent.kde.org/education/rkward/-/commit/2a7b71448868b1b84a8f86f17d1224c461f8d7b9

diff --git a/ChangeLog b/ChangeLog
index 153a786aa..a62c75e67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,5 @@
 --- Version 0.8.2 - UNRELEASED
-- Fixed: Crash when switch from dialog to wizard interface in plugins providing a preview   - TODO: add autotest
+- Fixed: Crash when switch from dialog to wizard interface in plugins providing a preview
 - Added: Actions to navigate R code based on its structure & Quick Code Navigation Mode
 - Added: Plugins: Enhance addChangeCommand() to allow writing more readable GUI logic code
 - Added: Plugins: Simplify running R commands inside GUI logic code
diff --git a/rkward/autotests/core_test.cpp b/rkward/autotests/core_test.cpp
index 5bbcc9802..8bb48faf3 100644
--- a/rkward/autotests/core_test.cpp
+++ b/rkward/autotests/core_test.cpp
@@ -29,6 +29,8 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../misc/rkcommonfunctions.h"
 #include "../misc/rkrapimenu.h"
 #include "../misc/rkxmlguipreviewarea.h"
+#include "../plugin/rkcomponentmap.h"
+#include "../plugin/rkstandardcomponent.h"
 #include "../rbackend/rkrinterface.h"
 #include "../rbackend/rksessionvars.h"
 #include "../rkconsole.h"
@@ -604,6 +606,16 @@ class RKWardCoreTest : public QObject {
 		QVERIFY(RObjectList::getGlobalEnv()->findObject(u"x"_s));
 	}
 
+	void switchComponentInterface() { // test for https://bugs.kde.org/show_bug.cgi?id=505364
+		// this needs to be a plugin with both types of interface, *and* a preview defined from inside an embedded component
+		auto handle = RKComponentMap::getComponentHandle(u"rkward::scatterplot"_s);
+		QVERIFY(handle);
+		auto ui = handle->invoke(nullptr, nullptr);
+		QVERIFY(handle);
+		ui->switchInterface(); // this used to crash
+		ui->deleteLater();
+	}
+
 	void cleanupTestCase() {
 		// at least the backend should exit properly, to avoid creating emergency save files
 		RInterface::issueCommand(new RCommand(QStringLiteral("# Quit (test cleanup)"), RCommand::App | RCommand::EmptyCommand | RCommand::QuitCommand));


More information about the rkward-tracker mailing list