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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>