summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qfileselector
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/io/qfileselector')
-rw-r--r--tests/auto/corelib/io/qfileselector/CMakeLists.txt77
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+emscripten/+wasm/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+emscripten/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+wasm/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+wasm/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/qfileselector.pro5
-rw-r--r--tests/auto/corelib/io/qfileselector/qfileselector.qrc51
-rw-r--r--tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp43
8 files changed, 88 insertions, 88 deletions
diff --git a/tests/auto/corelib/io/qfileselector/CMakeLists.txt b/tests/auto/corelib/io/qfileselector/CMakeLists.txt
new file mode 100644
index 0000000000..c27c4f4f96
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/CMakeLists.txt
@@ -0,0 +1,77 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## tst_qfileselectors Test:
+#####################################################################
+
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qfileselectors LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
+# Resources:
+set(qfileselector_resource_files
+ "extras/+custom1/test"
+ "extras/+custom1/test3"
+ "extras/+custom2/test"
+ "extras/+custom3/+custom2/test"
+ "extras/+custom3/+custom4/test"
+ "extras/+custom3/+custom5/test"
+ "extras/+custom3/test"
+ "extras/+custom5/+custom3/test"
+ "extras/test"
+ "extras/test2"
+ "platforms/+android/test"
+ "platforms/+android/test2"
+ "platforms/+darwin/test"
+ "platforms/+haiku/test"
+ "platforms/+haiku/test2"
+ "platforms/+ios/test"
+ "platforms/+ios/test2"
+ "platforms/+linux/test"
+ "platforms/+linux/test2"
+ "platforms/+wasm/test"
+ "platforms/+wasm/test2"
+ "platforms/+macos/test"
+ "platforms/+macos/test2"
+ "platforms/+qnx/test"
+ "platforms/+qnx/test2"
+ "platforms/+unix/+emscripten/+wasm/test"
+ "platforms/+unix/+emscripten/test"
+ "platforms/+unix/+android/test"
+ "platforms/+unix/+darwin/+ios/test"
+ "platforms/+unix/+darwin/+macos/test"
+ "platforms/+unix/+darwin/test"
+ "platforms/+unix/+haiku/test"
+ "platforms/+unix/+linux/test"
+ "platforms/+unix/+qnx/test"
+ "platforms/+unix/test"
+ "platforms/+unix/test3"
+ "platforms/+wince/test"
+ "platforms/+wince/test2"
+ "platforms/+windows/+wince/test"
+ "platforms/+windows/+winnt/test"
+ "platforms/+windows/+winrt/test"
+ "platforms/+windows/test"
+ "platforms/+windows/test3"
+ "platforms/+winnt/test2"
+ "platforms/+winrt/test"
+ "platforms/+winrt/test2"
+ "platforms/test"
+ "platforms/test2"
+ "platforms/test3"
+ "platforms/test4"
+ "platforms/test5"
+)
+
+qt_internal_add_test(tst_qfileselectors
+ SOURCES
+ tst_qfileselector.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ TESTDATA ${qfileselector_resource_files}
+ BUILTIN_TESTDATA
+)
+
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+emscripten/+wasm/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+emscripten/+wasm/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+emscripten/+wasm/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+emscripten/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+emscripten/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+emscripten/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+wasm/test b/tests/auto/corelib/io/qfileselector/platforms/+wasm/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+wasm/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+wasm/test2 b/tests/auto/corelib/io/qfileselector/platforms/+wasm/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+wasm/test2
diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.pro b/tests/auto/corelib/io/qfileselector/qfileselector.pro
deleted file mode 100644
index edcc91e8ed..0000000000
--- a/tests/auto/corelib/io/qfileselector/qfileselector.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qfileselectors
-QT = core-private testlib
-SOURCES = tst_qfileselector.cpp
-RESOURCES = qfileselector.qrc
diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
deleted file mode 100644
index f3b3ede575..0000000000
--- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc
+++ /dev/null
@@ -1,51 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>extras/test</file>
- <file>extras/test2</file>
- <file>extras/+custom1/test</file>
- <file>extras/+custom1/test3</file>
- <file>extras/+custom2/test</file>
- <file>extras/+custom3/test</file>
- <file>extras/+custom3/+custom2/test</file>
- <file>extras/+custom3/+custom4/test</file>
- <file>extras/+custom3/+custom5/test</file>
- <file>extras/+custom5/+custom3/test</file>
- <file>platforms/test</file>
- <file>platforms/+unix/+android/test</file>
- <file>platforms/+unix/+darwin/test</file>
- <file>platforms/+unix/+haiku/test</file>
- <file>platforms/+unix/+linux/test</file>
- <file>platforms/+unix/+qnx/test</file>
- <file>platforms/+unix/test</file>
- <file>platforms/+windows/+wince/test</file>
- <file>platforms/+windows/+winnt/test</file>
- <file>platforms/+windows/+winrt/test</file>
- <file>platforms/+windows/test</file>
- <file>platforms/+android/test</file>
- <file>platforms/+ios/test</file>
- <file>platforms/+macos/test</file>
- <file>platforms/+darwin/test</file>
- <file>platforms/+haiku/test</file>
- <file>platforms/+linux/test</file>
- <file>platforms/+qnx/test</file>
- <file>platforms/+wince/test</file>
- <file>platforms/+winrt/test</file>
- <file>platforms/test2</file>
- <file>platforms/+android/test2</file>
- <file>platforms/+ios/test2</file>
- <file>platforms/+macos/test2</file>
- <file>platforms/+haiku/test2</file>
- <file>platforms/+linux/test2</file>
- <file>platforms/+qnx/test2</file>
- <file>platforms/+wince/test2</file>
- <file>platforms/+winnt/test2</file>
- <file>platforms/+winrt/test2</file>
- <file>platforms/test3</file>
- <file>platforms/+windows/test3</file>
- <file>platforms/+unix/test3</file>
- <file>platforms/test4</file>
- <file>platforms/test5</file>
- <file>platforms/+unix/+darwin/+macos/test</file>
- <file>platforms/+unix/+darwin/+ios/test</file>
- </qresource>
-</RCC>
diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
index bac7a69e0f..626166c8b8 100644
--- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
+++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
@@ -1,32 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
+// Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QTest>
#include <qplatformdefs.h>
#include <QCoreApplication>
@@ -85,7 +60,7 @@ void tst_QFileSelector::basicTest_data()
QString expectedPlatform1File(":/platforms");
QString expectedPlatform2File(""); //Only the last selector
QString expectedPlatform3File; // Only the first selector (the family)
-#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && \
+#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_WASM) && \
!defined(Q_OS_DARWIN) && !defined(Q_OS_LINUX) && !defined(Q_OS_HAIKU) && !defined(Q_OS_QNX)
/* We are only aware of specific unixes, and do not have test files for any of the others.
However those unixes can get a selector added from the result of a uname call, so this will
@@ -96,10 +71,11 @@ void tst_QFileSelector::basicTest_data()
expectedPlatform2File = QString(":/platforms/test2");
#else
QString distributionName;
-# if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) || defined(Q_OS_FREEBSD) || defined(Q_OS_WINRT)
+# if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) || defined(Q_OS_FREEBSD)
distributionName = QSysInfo::productType();
# endif
- foreach (const QString &selector, QFileSelectorPrivate::platformSelectors()) {
+ const auto platformSelectors = QFileSelectorPrivate::platformSelectors();
+ for (const QString &selector : platformSelectors) {
// skip the Linux distribution name (if any) since we don't have files for them
if (selector == distributionName)
continue;
@@ -215,6 +191,9 @@ void tst_QFileSelector::urlConvenience_data()
strUrlWithFragment = QString("file:") + testWithQueryAndFragment;
QTest::newRow("file with query and fragment too") << QUrl(strUrlWithFragment) << (QStringList()) << QUrl(strUrlWithFragment);
+ // preserve path to root
+ QTest::newRow("path to root") << QUrl("file:///") << (QStringList()) << QUrl("file:///");
+
// http://qt-project.org/images/qtdn/sprites-combined-latest.png is chosen as a representative real world URL
// But note that this test is checking that http urls are NOT selected so it shouldn't be checked
QUrl testHttpUrl("http://qt-project.org/images/sprites-combined-latest.png");