Skip to content

Commit

Permalink
VPN-6423: Fix TestQmlPath on Qt 6.6.0 and later (#9657)
Browse files Browse the repository at this point in the history
* Fix TestQmlPath on Qt 6.6.0 and later
* Run app_unit_tests offscrean for Linux
  • Loading branch information
oskirby committed Jun 14, 2024
1 parent 5335ce1 commit c8a95d7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 28 deletions.
7 changes: 6 additions & 1 deletion tests/unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ target_compile_definitions(app_unit_tests PRIVATE UNIT_TEST "MZ_$<UPPER_CASE:${M
target_compile_definitions(app_unit_tests PRIVATE MZ_ADJUST)

target_link_libraries(app_unit_tests PRIVATE
Qt6::Gui
Qt6::Quick
Qt6::Test
Qt6::WebSockets
Expand Down Expand Up @@ -168,6 +169,10 @@ if(NOT BUILD_ADJUST_SDK_TOKEN)
)
endif()

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
list(APPEND UNIT_TEST_ARGS -platform offscreen)
endif()

## Add the tests to be run, one for each test class.
get_target_property(UTEST_SOURCES app_unit_tests SOURCES)
list(FILTER UTEST_SOURCES INCLUDE REGEX "test.*.h$")
Expand All @@ -180,7 +185,7 @@ foreach(filename ${UTEST_SOURCES})
)

foreach(UTEST_CLASS ${UTEST_CLASS_LIST})
add_test(NAME ${UTEST_CLASS} COMMAND app_unit_tests ${UTEST_CLASS})
add_test(NAME ${UTEST_CLASS} COMMAND app_unit_tests ${UNIT_TEST_ARGS} ${UTEST_CLASS})
set_property(TEST ${UTEST_CLASS} PROPERTY ENVIRONMENT LANG="en" LANGUAGE="en")
endforeach()
endforeach()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int main(int argc, char* argv[]) {
pe.insert("LANG", "en");
pe.insert("LANGUAGE", "en");

QCoreApplication app(argc, argv);
QGuiApplication app(argc, argv);

I18nStrings::initialize();

Expand Down
10 changes: 0 additions & 10 deletions tests/unit_tests/qml/a.qml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,6 @@ Item {
}
}

/*
This PathView breaks testqmlpath when run with statically compiled
Qt6.6.3 on mac.
See: https://mozilla-hub.atlassian.net/browse/VPN-6423
PathView {
objectName: "list"
model: vegetableModel
Expand All @@ -88,9 +81,6 @@ Item {
}
}

*/


Item {
objectName: "rangeA"
}
Expand Down
23 changes: 7 additions & 16 deletions tests/unit_tests/testqmlpath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,13 @@ void TestQmlPath::evaluate_data() {
<< "/abc/apple" << true << "apple";
QTest::addRow("search for apple in repeater") << "//apple" << true << "apple";

/*
These tests break when run with statically compiled
Qt6.6.3 on mac.
See: https://mozilla-hub.atlassian.net/browse/VPN-6423
// objects with contentItem property (lists)
QTest::addRow("select item in lists")
<< "/abc/list/artichoke" << true << "artichoke";
QTest::addRow("search for item a lists")
<< "//artichoke" << true << "artichoke";
QTest::addRow("search for list, then item")
<< "//list/artichoke" << true << "artichoke";
*/
// objects with contentItem property (lists)
QTest::addRow("select item in lists")
<< "/abc/list/artichoke" << true << "artichoke";
QTest::addRow("search for item a lists")
<< "//artichoke" << true << "artichoke";
QTest::addRow("search for list, then item")
<< "//list/artichoke" << true << "artichoke";

// Indexing
QTest::addRow("root index") << "/[0]" << true << "abc";
Expand Down

0 comments on commit c8a95d7

Please sign in to comment.