diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2021-04-16 06:47:51 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-04-19 12:51:01 -0700 |
commit | fe074ccad153791b32c2f62af530091cb025cdee (patch) | |
tree | c40ecb5394edba602cfac732732dd14de7e0b3a4 /tests/testprofile.cpp | |
parent | cfe20ee5f4f77a3a42ba301bdd69f5585c46184c (diff) | |
download | subsurface-fe074ccad153791b32c2f62af530091cb025cdee.tar.gz |
cloudstorage: adapt tests
The code assumes that prefs.cloud_base_url is non NULL. Allowing that to
be NULL makes no sense during normal operation of the app. Yet, most of
the tests don't initialize the prefs at all.
Making things worse, if we do correctly initialize the prefs (so as to
reasonably approximate the behavior when running the app), things break
because some of the reference outputs assume that the prefs are unset.
This deserves fixing.
For now, simply make sure that cloud_base_url is set for all the tests
that try to parse files.
Additionally, the semantics how cloud_base_url is saved to disk have
changed, so adjust the test for those prefs accordingly.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests/testprofile.cpp')
-rw-r--r-- | tests/testprofile.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/testprofile.cpp b/tests/testprofile.cpp index cd9d51f0c..66f6eea5c 100644 --- a/tests/testprofile.cpp +++ b/tests/testprofile.cpp @@ -14,6 +14,23 @@ // ..dives/exportprofilereference.csv) and copy the former over the later and commit that change // as well. +void TestProfile::init() +{ + // Set UTF8 text codec as in real applications + QTextCodec::setCodecForLocale(QTextCodec::codecForMib(106)); + + // first, setup the preferences + + // normally we should be able to do this - but it makes this test fail because the reference data + // assume that the prefs are all 0 / false + // copy_prefs(&default_prefs, &prefs); + // instead we just set up the cloud_base_url to prevent parse_file() from crashing + prefs.cloud_base_url = strdup(default_prefs.cloud_base_url); + + QCoreApplication::setOrganizationName("Subsurface"); + QCoreApplication::setOrganizationDomain("subsurface.hohndel.org"); + QCoreApplication::setApplicationName("Subsurface"); +} void TestProfile::testProfileExport() { prefs.planner_deco_mode = BUEHLMANN; |