┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Englbrecht <[email protected]>2026-06-01 19:29:34 +0200
committerMéven Car <[email protected]>2026-06-18 10:06:00 +0000
commit8cbae43d2269a056b530e10ae8c11168bc66ebb5 (patch)
treed39f084b0adc0593f146493058d6a4e64cfb634d
parent5cd0c642f59924babe66d017d7c0ced7934de3d3 (diff)
tests: exclude two tests on windows
dolphinmainwindowtest requires a real window server no_bare_qwait_in_tests requires bash and only serves as lint, so linux only is OK
-rw-r--r--src/tests/CMakeLists.txt13
-rw-r--r--src/tests/viewpropertiestest.cpp29
2 files changed, 31 insertions, 11 deletions
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 3ac657215..94bba8e5c 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -68,16 +68,20 @@ ecm_add_test(viewpropertiestest.cpp testdir.cpp
TEST_NAME viewpropertiestest
LINK_LIBRARIES dolphinprivate dolphinstatic Qt6::Test KF6::FileMetaData)
-# DolphinMainWindowTest
-ecm_add_test(dolphinmainwindowtest.cpp testdir.cpp ${CMAKE_SOURCE_DIR}/src/dolphin.qrc
-TEST_NAME dolphinmainwindowtest
-LINK_LIBRARIES dolphinprivate dolphinstatic Qt6::Test)
+# DolphinMainWindowTest (requires a real window desktop; not reliable on Windows CI)
+if(NOT WIN32)
+ ecm_add_test(dolphinmainwindowtest.cpp testdir.cpp ${CMAKE_SOURCE_DIR}/src/dolphin.qrc
+ TEST_NAME dolphinmainwindowtest
+ LINK_LIBRARIES dolphinprivate dolphinstatic Qt6::Test)
+endif()
# DragAndDropHelperTest
ecm_add_test(draganddrophelpertest.cpp LINK_LIBRARIES dolphinprivate Qt6::Test)
# Lint: forbid bare QTest::qWait() in test sources without an // UNAVOIDABLE: justification.
# Every unavoidable delay must carry a comment explaining why no signal-based wait is possible.
+# Requires bash; not run on Windows.
+if(NOT WIN32)
add_test(
NAME no_bare_qwait_in_tests
COMMAND bash -c
@@ -105,6 +109,7 @@ add_test(
exit 1; \
fi"
)
+endif()
# Smoke test: launch Dolphin, verify it starts without crashing, then quit.
if(NOT WIN32)
diff --git a/src/tests/viewpropertiestest.cpp b/src/tests/viewpropertiestest.cpp
index f90d57b88..1d9e886e1 100644
--- a/src/tests/viewpropertiestest.cpp
+++ b/src/tests/viewpropertiestest.cpp
@@ -109,30 +109,45 @@ void ViewPropertiesTest::testReadOnlyDirectory()
QVERIFY(QFile(localFolder).setPermissions(QFileDevice::ReadOwner));
QScopedPointer<ViewProperties> props(new ViewProperties(testDirUrl));
- const QString destinationDir = props->destinationDir(QStringLiteral("local")) + localFolder;
-
QVERIFY(props->isAutoSaveEnabled());
props->setSortRole("someNewSortRole");
props.reset();
+#ifdef Q_OS_WIN
+ // On Windows the read-only attribute is not honored on directories: files and
+ // Alternate Data Streams can still be created inside them. The properties are
+ // therefore stored locally rather than redirected to the destination directory.
+ KFileMetaData::UserMetaData metadata(localFolder);
+ if (metadata.isSupported()) {
+ QVERIFY(metadata.hasAttribute("kde.fm.viewproperties#1"));
+ } else {
+ QVERIFY(QFile::exists(dotDirectoryFile));
+ }
+#else
+ // On a directory without write permission the properties are redirected to the
+ // destination directory, leaving the local directory untouched.
+ const QString destinationDir = props->destinationDir(QStringLiteral("local")) + localFolder;
QVERIFY(QDir(destinationDir).exists());
QVERIFY(!QFile::exists(dotDirectoryFile));
KFileMetaData::UserMetaData metadata(localFolder);
- const QString viewProperties = metadata.attribute(QStringLiteral("kde.fm.viewproperties#1"));
- QVERIFY(viewProperties.isEmpty());
+ QVERIFY(metadata.attribute(QStringLiteral("kde.fm.viewproperties#1")).isEmpty());
+#endif
+ // The stored value round-trips regardless of where it was written.
props.reset(new ViewProperties(testDirUrl));
QVERIFY(props->isAutoSaveEnabled());
QCOMPARE(props->sortRole(), "someNewSortRole");
props.reset();
- metadata = KFileMetaData::UserMetaData(destinationDir);
- if (metadata.isSupported()) {
- QVERIFY(metadata.hasAttribute("kde.fm.viewproperties#1"));
+#ifndef Q_OS_WIN
+ KFileMetaData::UserMetaData destMetadata(destinationDir);
+ if (destMetadata.isSupported()) {
+ QVERIFY(destMetadata.hasAttribute("kde.fm.viewproperties#1"));
} else {
QVERIFY(QFile::exists(destinationDir + "/.directory"));
}
+#endif
// un-restrict write permissions
QFile(localFolder).setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner);