aboutsummaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)Author
2020-05-26Test case for multicylinder support on CSV importGravatar Miika Turkia
Test for importing Subsurface generated CSV dive details, with multiple cylinders support. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26Use single cylinder dive for testsGravatar Miika Turkia
Now that CSV export supports multiple cylinders and import doesn't, we need a test dive with single cylinder in it. (Multi-cylinder import from CSV will be supported for Subsurface style CSV export only, and not generic exports that are used here.) Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26Initialize variable to silence compiler warningGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-18Use stored SAC for validationGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-18TestParse to support SACGravatar Miika Turkia
Take into account the added SAC field in dive detail CSV export. Note that we do a test of: - export to CSV file - import the written CSV file - export the newly read data to second file - compare these two exported files As SAC information is not currently read from any import, this adds the SAC value to the imported data before exporting again. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-06media: move addition of pictures out of create_picture()Gravatar Berthold Stoeger
If we want to make addition of pictures undoable, then create_picture() must not add directly to the dive. Instead, return the dive to which the picture should be added and let the caller perform the addition. This means that the picture-test has to be adapted. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-06media: use table instead of linked list for mediaGravatar Berthold Stoeger
For consistency with equipment, use our table macros for pictures. Generally tables (arrays) are preferred over linked lists, because they allow random access. This is mostly copy & paste of the equipment code. Sadly, our table macros are quite messy and need some revamping. Therefore, the resulting code is likewise somewhat messy. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-05Explanatory comment in testprofile.cppGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-05-04Add test for profile dataGravatar Robert C. Helling
There was a TestProfile but that was a stub that did not test anything. We have an export function that serialises the profile data (including lots of derived data like deco information and cylinder pressure interpolation). So here is now a simple tests that can detect regressions in the profle. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-05-04CSV import/export test: Add support for dive modeGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-01cleanup: move dive_table from dive.h to divelist.hGravatar Berthold Stoeger
This allows us to decouple dive.h and divelist.h, a small step in include disentangling. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-26move GitHub url to the Subsurface orgGravatar Dirk Hohndel
Instead of using the Subsurface-divelog user on GitHub, we now use an org that was generously donated to us. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-24cleanup: move clearing of device nodes to clear_dive_file_data()Gravatar Berthold Stoeger
It makes no sense to keep the device nodes if all the other data is cleared. Let's do this automatically and not explicitly. This ensures that the function is also called on mobile. Currently it was only called on desktop. Weirdly, the parser-tests were expecting that the device nodes were not reset by clear_dive_file_data() and therefore divecomputers were accumulating in the test results. Thus, the additional computers had to be removed from the expected test results. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-19desktop: remove user surveyGravatar Dirk Hohndel
We have never made good use of the results. Let's just remove it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-15testing: re-enable TestGitStorageGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-15testing/git-storage: alternative random number generation for Qt 5.9Gravatar Dirk Hohndel
We still need to support Qt 5.9 for Ubuntu 18.04 / Bionic. This uses deprecated calls to qrand() - but then qrand() wasn't deprecated in 5.9. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-15testing/git-storage: fairly fundamental rewrite of the storage testGravatar Dirk Hohndel
The old test was broken in many ways and kept failing for a number of reasons. Some of them were addressed in the previous commits (the missing HEAD ref being the main one), the other one was that the tests kept stepping on top of each other - as were potentially random users or reviewers using the 'universal' test account. This uses a random one of ten dedicated test accounts, and on top of that uses a random branch name (instead of the fixed email address associated with the account). This also rewrites several of the tests dealing with offline changes to correctly model going offline (but keeps one that directly writes to the local cache). Finally this change also tries to do a much better job cleaning up after itself and not leaving data behind the the next run could stumble over. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-10media: move picture function from dive.c to picture.cGravatar Berthold Stoeger
Currently, move only those functions that do not access dive structures. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-31cleanup: don't compile subsurface-helper.cpp for testsGravatar Berthold Stoeger
It is unclear why the subsurface-helper.cpp file was linked with the tests. In any case, it led to comlicated ifdef-ery, so let's remove that for now and readd later if the need arises. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-11Grammar: replaces 'indexes' by 'indices'Gravatar Robert C. Helling
Grammar-nazi ran git grep -l 'indexes' | xargs sed -i '' -e 's/indexes/indices/g' to prevent future wincing when reading the source code. Unfortunatly, Qt itself is infected as in QModelIndexList QItemSelection::indexes() const Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-03-09tests: don't build PlannerSharedGravatar Dirk Hohndel
Once we start using the commands on mobile, the dependencies for this test break. And since we have disabled the failed attempt to create a planner for mobile, there's no point running these tests right now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-04Cleanup: rename plannerShared to PlannerSharedGravatar Berthold Stoeger
Usually, we use PascalCase (i.e. camelCase with a capital letter at the start) for class names. For consistency, let's do it here as well. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-31Remove plannerShared::instance()Gravatar Berthold Stoeger
This class contains only static functions (i.e. it does not contain any state). There does not seem to be a reason to have an instance of that class. Therefore, remove the instance() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-26GitHub Actions: disabling TestGitStorage againGravatar Dirk Hohndel
I thought I had it fixed, but we still see a ridiculous number of random, unexplained failures which distract from what we are trying to do with the GitHub Actions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25diveplanner: adjust sac-factor calculation.Gravatar jan Iversen
The real values are 1.0 to 10.0, but QML needs int so mobile gets values 10.0 to 100.0 add sacfactor() to QMLInterface and update QML. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25dive planner: correct bottomsac/decosac calc.Gravatar jan Iversen
Move conversion cuft <-> liter from desktop-widget/diveplanner.cpp to plannerShared, to facilitate the same results in mobile diveplanner Use Backend for bottomsac/decosac and update to check for switch LITER <-> CUFT Add bottomsac/decosac to QMLinterface. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25diveplanner: call planner model directly for simple variables.Gravatar jan Iversen
Variables without conversion, do not need to pass plannerShared (due to the QML interface). Simple variables do not pass plannerShared, but diveplanner in desktop-widgets and qmlinterface in mobile-widgets call the implementation directly. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-20backend-shared: remove asc/desc functionsGravatar jan Iversen
Ascent/Descent rate functions are fully implemented in diveplannermodel, therefore remove these functions. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20core/settings:: remove string functions for unitsGravatar jan Iversen
Remove string version of unit_system, duration_units, length, pressure, temperature, vertical_speed_time, and volume, including tests and make signals strongly typed in C++ Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20core/settings: allow signals to be strongly typed in C++Gravatar jan Iversen
Register enums to allow them to be used in signal handlers instead of int. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10code cleanup: add empty table structuresGravatar Dirk Hohndel
It seemed to make sense to combine all three types in one commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10code cleanup: use setPath to set directoryGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-04Revert "build system: disable TestGitStorage"Gravatar Dirk Hohndel
This reverts commit d0e52140e586e4f9537738177d54400a855b7d2b. TestGitStorage should work again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-02build system: disable TestGitStorageGravatar Dirk Hohndel
While this appears to work fine when tested individually, when running as part of the GitHub actions it causes random failures. This needs to be rethought. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-01tests: allow overwriting cloud accountGravatar Dirk Hohndel
TestGitStorage is used in all test runs, which results in occasional errors because two test runs step on each other. This allows us to use different accounts in different runs. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-01tests: refactor TestGitStorageGravatar Dirk Hohndel
It's silly to set up the URL and email in almost every function. Instead do it once at the start and reuse that information. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-31tests: corrected typo in CMakeFiles.txtGravatar jan Iversen
This typo caused that testplannershared was not available in neither desktop nor mobil. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31tests: correct decosac/bottomsac in imperial.Gravatar jan Iversen
The getter returns alwayes in m/1000, making the calculations identical, independent if the system is in Metric or Imperial units. Correct getter test cases. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31tests: correct bestmixend test cases.Gravatar jan Iversen
When unit system Imperial is properly activated, these test cases have wrong values, and thus fail. Use correct values. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31tests: reactivate test case in testplannersharedGravatar jan Iversen
reactivate deco2 test case, after problem is solved in plannerShared. Also add a commit on bottompo2/decopo2 in imperial mode, that do not use PSI as expected. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-29tests: fix TestGitStorage in a mobile buildGravatar Dirk Hohndel
The default behavior of parse_file() is different between a desktop build and a mobile build. This makes parse_file() always assume that it's ok to connect to the cloud. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29tests: correct testplannersharedGravatar jan Iversen
PSI is not implemented for diveplanner Bestmixend in feet is not implemented for diveplanner Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29tests: deactivate testQMLGravatar jan Iversen
Qt 5.13 (and maybe 5.12) introduced new macros for QUICK_TEST_MAIN_WITH_SETUP and as testQML is loosely based on this macro it needs to be redesigned. Before Qt 5.11 it was not possible to do QML testing that depended on classes being registred with the macro QUICK_TEST_MAIN_WITH_SETUP, therefore it was nessecary to make an independent implementation of main(). For now, let the main do a "return 0", to keep the test in the loop. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29tests: fix testqPrefDisplayGravatar jan Iversen
Font size are never stored on disk for the mobile version, so testing load/save does not make sense. add #ifndef SUBSURFACE_MOBILE Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29tests: fix TestQPrefLogGravatar Dirk Hohndel
There were several issues with these tests, including checking the value argument against bool values even if the underlying preference isn't bool. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29tests: fix TestQPrefEquipmentGravatar Dirk Hohndel
When we actually change the value, the argument to the changed signal should be true, not false. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29tests: fix TestQPrefUnitsGravatar Dirk Hohndel
This clearly never was tested. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28tests: fix cmake syntax confusionGravatar Dirk Hohndel
You cannot have a conditional in the middle of a list. I should have caught this in review. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29tests: add gas tests for plannerSharedGravatar jan Iversen
Add cases to test gas options. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-29tests: add research values for diveplanning.Gravatar jan Iversen
This commit contains the researched values used for diveplanning, which form the basis for the test cases. Signed-off-by: Jan Iversen <jan@casacondor.com>