aboutsummaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)Author
2020-11-19build-system: fix tests in mobile buildsGravatar Dirk Hohndel
We can no longer build TestPictures in mobile builds. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26tests: don't fail if TestGitStorage can reach the serverGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-25cleanup: split out divecomputer functions from dive.cGravatar Berthold Stoeger
Since dive.c is so huge, split out divecomputer-related functions into divecomputer.[c|h], sample.[c|h] and extradata.[c|h]. This does not give huge compile time improvements, since struct dive contains a struct divecomputer and therefore dive.h has to include divecomputer.h. However, it make things distinctly more clear. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25cleanup: break out event-related code into event.[c|h]Gravatar Berthold Stoeger
In an effort to reduce the size of dive.h and dive.c, break out the event related functions. Moreover event-names were handled by the profile-code, collect that also in the new source files. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25cleanup: remove unsaved_changes() test in testrenumber.cppGravatar Berthold Stoeger
Unsaved changes are now kept track by the undo-system. No need to test for this function when directly modifying the core data structures. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24tests: move TestGitStorage to its own test configGravatar Dirk Hohndel
This way 'make check' doesn't execute TestGitStorage anymore. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-24devices: add devices in Command::importTable()Gravatar Berthold Stoeger
Add a device_table parameters to Command::importTable() and add_imported_dives(). The content of this table will be added to the global device list (respectively removed on undo). This is currently a no-op, as the parser doesn't yet fill out the device table, but adds devices directly to the global device table. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24parser: add device_table to parser stateGravatar Berthold Stoeger
If we want to avoid the parsers to directly modify global data, we have to provide a device_table to parse into. This adds such a state and the corresponding function parameters. However, for now this is unused. Adding new parameters is very painful and this commit shows that we urgently need a "struct divelog" collecting all those tables! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-23parser: replace params[] code by new xml_params structGravatar Berthold Stoeger
This fixes a load of memory holes, and makes the code (hopefully) more readable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-17filter: remove filter_preset_table_tGravatar Berthold Stoeger
We used a typedef "filter_preset_table_t" for the filter preset table, because it is a "std::vector<filter_preset>". However, that is in contrast to all the other global tables (dives, trips, sites) that we have. Therefore, turn this into a standard struct, which simply inherits from "std::vector<filter_preset>". Note that while inheriting from std::vector<> is generally not recommended, it is not a problem here, because we don't modify it in any shape or form. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: load filter presets from XML filesGravatar Berthold Stoeger
This is a bit painful: since we don't want to modify the filter presets when the user imports (as opposed to opens) a log, we have to provide a table where the parser stores the presets. Calling the parser is getting quite unwieldy, since many tables are passed. We probably should introduce a structure representing a full log-book at one point, which collects all the things that are saved to the log. Apart from that, this is simply the counterpart to saving to XML. The interpretation of the string data is performed by core functions, not the parser itself to avoid code duplication with the git parser. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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>