diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -83,6 +83,8 @@ ) if(Qt5Qml_FOUND) + add_test(NAME qmltests COMMAND qmltestrunner WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + frameworkintegration_tests(kfiledialogqml_unittest) target_link_libraries(kfiledialogqml_unittest Qt5::Qml) endif() diff --git a/autotests/tst_filedialog.qml b/autotests/tst_filedialog.qml new file mode 100644 --- /dev/null +++ b/autotests/tst_filedialog.qml @@ -0,0 +1,24 @@ +import QtQuick 2.2 +import QtTest 1.0 +import QtQuick.Dialogs 1.2 +TestCase { + id: testCase + width: 400 + height: 400 + visible: true + when: windowShown + name: "FileDialogTest" + + FileDialog { + id: fileDialog + folder: shortcuts.home + } + + function test_filedialog() { + //At the moment it just makes sure that something opens and doesn't crash. + //Since this is a QGuiApplication (and not a QApplication) + fileDialog.visible = true + testCase.wait(200) + fileDialog.visible = false + } +} diff --git a/src/platformtheme/CMakeLists.txt b/src/platformtheme/CMakeLists.txt --- a/src/platformtheme/CMakeLists.txt +++ b/src/platformtheme/CMakeLists.txt @@ -8,9 +8,7 @@ find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED X11Extras) find_package(XCB COMPONENTS XCB) - set_package_properties(XCB PROPERTIES DESCRIPTION "Required for exposing the global menu on X11" - TYPE REQUIRED - ) + set_package_properties(XCB PROPERTIES TYPE REQUIRED) endif() configure_file(config-platformtheme.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-platformtheme.h ) diff --git a/src/platformtheme/kdeplatformtheme.cpp b/src/platformtheme/kdeplatformtheme.cpp --- a/src/platformtheme/kdeplatformtheme.cpp +++ b/src/platformtheme/kdeplatformtheme.cpp @@ -257,7 +257,7 @@ bool KdePlatformTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const { - return type == QPlatformTheme::FileDialog; + return type == QPlatformTheme::FileDialog && qobject_cast(QCoreApplication::instance()); } QString KdePlatformTheme::standardButtonText(int button) const