CustomShortcutsPersistenceDriver.cmake
Go to the documentation of this file.
1 # Regression test driver for paraview/paraview#21133.
2 #
3 # QSettings(IniFormat, UserScope) reads/writes "$HOME/.config/<Organization>/
4 # <Application>.ini" on linux/macOS, so a fake HOME pointed at a directory
5 # pre-populated with INI_FIXTURE lets this test start ParaView as if a
6 # custom shortcut had already been saved in a previous session, without
7 # touching real settings.
8 
9 set(home_dir "${TEMPORARY_DIR}/CustomShortcutsPersistenceHome")
10 file(REMOVE_RECURSE "${home_dir}")
11 file(MAKE_DIRECTORY "${home_dir}/.config/ParaView")
12 file(COPY "${INI_FIXTURE}" DESTINATION "${home_dir}/.config/ParaView")
13 get_filename_component(ini_fixture_name "${INI_FIXTURE}" NAME)
14 file(RENAME "${home_dir}/.config/ParaView/${ini_fixture_name}" "${home_dir}/.config/ParaView/ParaView.ini")
15 
16 set(ENV{HOME} "${home_dir}")
17 set(ENV{DASHBOARD_TEST_FROM_CTEST} "1")
18 
19 execute_process(
20  COMMAND ${PARAVIEW_EXECUTABLE}
21  --test-script=${TEST_SCRIPT}
22  --exit
23  RESULT_VARIABLE rv
24 )
25 
26 file(REMOVE_RECURSE "${home_dir}")
27 
28 if (NOT rv EQUAL 0)
29  message(FATAL_ERROR "ParaView return value was ${rv}")
30 endif()