diff --git a/INSTALL.md b/INSTALL.md index c00ce13faad5653b828a984b99b8e05b4e948300..7dabb8a45481c0fa8b69c1d328353a55c2cbbf39 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -127,8 +127,8 @@ Only 64-bit MSVC build can be compiled. ```sh git clone https://review.jami.net/ring-project cd ring-project/ - git submodule update --init daemon lrc client-windows - git submodule update --recursive --remote daemon lrc client-windows + git submodule update --init daemon lrc client-qt + git submodule update --recursive --remote daemon lrc client-qt ``` - Using **Elevated Command Prompt** ```sh @@ -212,7 +212,7 @@ Only 64-bit MSVC build can be compiled. - In Visual Studio, download WiX Toolset Visual Studio Extension. - Build client-windows project first, then the JamiInstaller project, msi package should be stored in ring-project\client-windows\JamiInstaller\bin\Release -## Testing For Client-qt +## Testing for Client-qt on Windows - We currently use [GoogleTest](https://github.com/google/googletest) and [Qt Quick Test](https://doc.qt.io/qt-5/qtquicktest-index.html#introduction) in our product. To build and run tests, you could use the following command. @@ -221,6 +221,16 @@ Only 64-bit MSVC build can be compiled. python make-client.py runtests ``` +- Note that, for tests, the path of local storage files for jami will be changed based on following environment variables. + +``` + %JAMI_DATA_HOME% = %TEMP% + '\\jami_test\\jami' + %JAMI_CONFIG_HOME% = %TEMP% + '\\jami_test\\.config' + %JAMI_CACHE_HOME% = %TEMP% + '\\jami_test\\.cache' +``` + +- These environment variables will be temporarily set when using make-client.py to run tests. + ## Debugging Compile the client with `BUILD=Debug` and compile LibRingClient with diff --git a/make-client.py b/make-client.py index 7a7a1cec8c6b3e1165dcb7affdd3498eee76b7e3..30800e75ad90259d2b93684b39964c3cafbb17f4 100644 --- a/make-client.py +++ b/make-client.py @@ -21,6 +21,7 @@ vs_where_path = os.path.join( host_is_64bit = (False, True)[platform.machine().endswith('64')] this_dir = os.path.dirname(os.path.realpath(__file__)) build_dir = this_dir + '\\build' +temp_path = os.environ['TEMP'] # project path jami_qt_project = build_dir + '\\jami-qt.vcxproj' @@ -31,6 +32,11 @@ qml_test_project = build_dir + '\\tests\\qml_tests.vcxproj' qml_test_exe = this_dir + '\\x64\\test\\qml_tests.exe -input ' + this_dir + '\\tests\\qml' unit_test_exe = this_dir + '\\x64\\test\\unittests.exe' +# test env path +test_data_dir = temp_path + '\\jami_test\\jami' +test_config_dir = temp_path + '\\jami_test\\.config' +test_cache_dir = temp_path + '\\jami_test\\.cache' + class QtVerison(Enum): Major = 0 Minor = 1 @@ -308,6 +314,12 @@ def run_tests(mute_dring, output_to_files): # make sure that the tests are rendered offscreen os.environ["QT_QPA_PLATFORM"] = 'offscreen' os.environ["QT_QUICK_BACKEND"] = 'software' + + # set test env variables + os.environ["JAMI_DATA_HOME"] = test_data_dir + os.environ["JAMI_CONFIG_HOME"] = test_config_dir + os.environ["JAMI_CACHE_HOME"] = test_cache_dir + for test_exe_command in test_exe_command_list: if (execute_cmd(test_exe_command, True)): test_result_code = 1 diff --git a/tests/qml/main.cpp b/tests/qml/main.cpp index 89d11c3ad6b9caddafaf73b04690deddfea00993..93f26b6d6c6c8a8c117f1e3a318dd7aff01418af 100644 --- a/tests/qml/main.cpp +++ b/tests/qml/main.cpp @@ -195,6 +195,8 @@ main(int argc, char** argv) argc = std::distance(argv, end); } + QStandardPaths::setTestModeEnabled(true); + QTEST_SET_MAIN_SOURCE_PATH Setup setup(muteDring); return quick_test_main_with_setup(argc, argv, "qml_test", nullptr, &setup); diff --git a/tests/unittests/main_unittest.cpp b/tests/unittests/main_unittest.cpp index 45a025d9d8ea3fc34478cfe3b4ba22f7b95cbbc0..8a28e5b458c605f25fd3ee3c71b8be51fd3908b5 100644 --- a/tests/unittests/main_unittest.cpp +++ b/tests/unittests/main_unittest.cpp @@ -20,6 +20,8 @@ #include "globaltestenvironment.h" #include <QApplication> +#include <QStandardPaths> + #include <gtest/gtest.h> bool muteDring; @@ -40,6 +42,8 @@ main(int argc, char* argv[]) argc = std::distance(argv, end); } + QStandardPaths::setTestModeEnabled(true); + QApplication a(argc, argv); a.processEvents(); ::testing::InitGoogleTest(&argc, argv);