[education/rkward/kf5] /: Fix test crash on Windows

Thomas Friedrichsmeier null at kde.org
Wed Apr 10 16:12:08 BST 2024


Git commit a8a7c262ba5e40b76701d733e12f7c547a336fae by Thomas Friedrichsmeier.
Committed on 06/04/2024 at 13:32.
Pushed by tfry into branch 'kf5'.

Fix test crash on Windows

M  +5    -4    CommitPolicy.txt
M  +18   -10   rkward/autotests/core_test.cpp

https://invent.kde.org/education/rkward/-/commit/a8a7c262ba5e40b76701d733e12f7c547a336fae

diff --git a/CommitPolicy.txt b/CommitPolicy.txt
index 69f8309cd..6bdeb548f 100644
--- a/CommitPolicy.txt
+++ b/CommitPolicy.txt
@@ -9,11 +9,12 @@ Library dependencies
 ====================
 
 It is important to note that RKWard makes a point of _not_ requiring the latest KDE / QT libraries. If you want to use the latest and greatest, be sure to use #ifdef's, and make a best
-effort to support features for older versions of libraries, too. For the moment, in the KF5 versions of RKWard, we're trying to support:
+effort to support features for older versions of libraries, too. Generally we aim to support the two most recent Ubunut LTS releases.
 
-Oldest library versions to support (= Ubuntu Bionic / 18.04; we generally try to support the two most recent LTS releases)
-* Qt: 5.9.5
-* KDE: 5.44.0
+Of course, with the switch to KF6, we made a clean cut, thus, currently the minimum requirements are:
+
+* Qt: 6.6.0
+* KDE: 6.0.0
 * R: 3.4.4
 
 Note: This is not set in stone, may change according to whatever is included in important distributions.
diff --git a/rkward/autotests/core_test.cpp b/rkward/autotests/core_test.cpp
index c08579700..a0b89b544 100644
--- a/rkward/autotests/core_test.cpp
+++ b/rkward/autotests/core_test.cpp
@@ -91,20 +91,28 @@ class RKWardCoreTest: public QObject {
 
 	void listBackendLog() {
 		testLog("Listing (new) contents of /tmp/rkward.rbackend");
+		QByteArray output, oldoutput;
 		QFile f(QDir::tempPath() + "/rkward.rbackend");
-		f.open(QIODevice::ReadOnly);
-		auto output = f.readAll();
+		if (f.open(QIODevice::ReadOnly)) {
+			output = f.readAll();
+			f.close();
+		}
+
 		QFile fl(QDir::tempPath() + "/rkward.rbackend.listed");
-		fl.open(QIODevice::ReadOnly);
-		auto oldoutput = fl.readAll();
-		fl.close();
-		fl.open(QIODevice::ReadWrite | QIODevice::Truncate);
-		fl.write(output);
-		fl.close();
+		if (fl.open(QIODevice::ReadOnly)) {
+			oldoutput = fl.readAll();
+			fl.close();
+		}
+
+		if (fl.open(QIODevice::ReadWrite | QIODevice::Truncate) ) {
+			fl.write(output);
+			fl.close();
+		}
+
 		if (output.startsWith(oldoutput)) {
-			output = output.mid(oldoutput.length());
+			output = output.sliced(oldoutput.length());
 		}
-		testLog("%s", output.data());
+		testLog(qPrintable(output.data()));
 	}
 
 	void waitForBackendStarted() {



More information about the rkward-tracker mailing list