learnHash() is called either on a local picture structure
[DiveListView::loadImageFromURL()] or on a cloned picture structure
[ImageDownloader::saveImage()]. In neither case the picture structure
is passed to the frontend. Therefore, storing the new hash in the
picture struct is not necessary.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
As we now parse dives without profile, we get 2 more dives from the
sample log import (3 in total). And naturally also the resulting XML to
compare against needs to be updated.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
The preferences flag cloud_background_sync used to be used heavily in
the mobile code, but is not used there anymore. Now, it is accessed
only in one place, but does not do what it actually says: If it is off,
the remote storage is not synced on save (but will be synced on next
load).
Syncing on save can also be prevented by unchecking the "Cloud online"
menu checkbox. Since the latter seems more logical and general
(support for non-cloud remote git repositories), remove the cloud_background_sync
option.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This should help us to move parsing that is not XML related to other
files, hopefully making the code cleaner.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
For UI responsiveness, we need to be able to run the planner in the background. This needs the
planner state to be localized (and we need to pass a pointer around).
In order to not let too many lines overrun (and to save typing in the future)
I have renamed instances of struct deco_state to ds. Yes this should have gone
to a separate commit but I accidentally commit --amend'ed it.
Computing of planner variations is temporarily disabled.
Unlock the planner when returning early
So we don't deadlock in add dive and recreational mode (which
use the planner without actually planning).
Signed-off-by: Robert C. Helling <helling@atdotde.de>
In general, the C++-side of the preferences code consistently uses
the bool data type for boolean settings. There are five exceptions,
which use short instead:
showPo2
showPn2
showPhe
saveUserIdLocal
displayInvalidDives
This patch attempts to make the code more consistent by turning
these into bools as well.
Tests showed that writing as short and reading as bool is handled
gracefully by the Qt variant code. Therefore, an upgrade should not
cause user-visible changes to their settings.
As a bonus, two extern declarations of the set_save_userid_local()
function, which is not defined anywhere, were removed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
... and reset deco information in profile ceiling computation.
The planner test then needs to know about the struct holding the deco
state.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
This option should have never been there. This is not how
gradient factors are supposed to work. It would only trick
users to use the wrong value..
Signed-off-by: Robert C. Helling <helling@atdotde.de>
...rather than use a global variable and a macro.
This should be a no-op in preparation to allow planning
several versions of a dive.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
QDate::addDays() returns a copy with the changed date, calling it and
ignoring the return value does nothing.
Signed-off-by: Seamus Boyle <seamus@beantrader.com.au>
Add one more picture to the already existing test.
This new picture is a JPEG and has data after JFIF EOI tag.
Suggested-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Note that the actual validation of the result is currently disabled, so
the tests will pass even though there are some bugs and rounding errors
present.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Wfloat-conversion enabled for C++ part of the code
Fix warnings raised by the flag using lrint
Original issue reported on the mailing list:
The ascent/descent rates are sometimes not what is expected.
E.g. setting the ascent rate to 10m/min results in an actual
ascent rate of 9m/min.
This is due to truncating the ascent rate preference,
then effectively rounding up the time to reach each stop to 2s intervals.
The result being that setting the ascent rate to 10m/min
results in 20s to ascend 3m (9m/min), when it should be exactly 18s.
Reported-by: John Smith <noseygit@hotmail.com>
Reported-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
Add automatic tests in TestPlan for minimum gas:
- Copy minimum gas result (pressure) to diveplan.
- Add cylinder size and working pressure for bottom gas to every dive in TestPlan
Hint: Unrealistic cylinder sizes (100l, 200l) have to be used for the very long and deep dives in TestPlan
- Add minimum gas check for every dive
- Add two additional test dives in TestPlan which produce sane minimum gas results with 24l tank
Hint: Deco check for these new dives is commented out at the moment
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
The rule was working when called from the fake test
used as preparation step in check target on Windows,
but did not work for the normal install target.
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
In the original version, parsing and comparing output was
done in separate test methods. This was forbidding use of
QTest cleanup to call clear_dive_file_data().
As a side effect a failure in one test would make other tests
failing too (since call to clear_dive_file_data was skipped
by QCOMPARE failure).
Added a FILE_COMPARE macro to avoid code duplication.
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
In case of QCOMPARE failure, code following the comparison
is not executed, this results in application state not being
properly resorted and often gives several test failures,
when only one test really fails.
Using QTest cleanup method allows restoring proper state,
before next test is executed.
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
Method originally called testSetup is more a precondition
to test execution rather than an actual test.
QTest recommends to use initTestCase for that purpose.
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
Expected value is the second argument of QCOMPARE,
having the arguments in the right order avoid confusion
when looking at error message in case of test failure.
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
Windows implementation of fwrite changes \n to \r\n
for files opened in text mode.
It caused failures in TestMerge and TestParse when
comparing written files against reference data.
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
Update install rules to create a staging_tests folder
for easy deployment to test target.
Update test rules for compile time testing
when wine is available on build machine.
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
On Windows that would fail because stat() doesn't deal well with our
utf8 strings.
Added new subsurface_stat() portability function to replace stat().
Added Windows implementation of subsurface_stat() using wstat(),
with conversion to ut16 of the inputed path.
Other platform implementations (linux, android) make use of the normal stat().
Added non ASCII test case in TestGitStorage::testGitStorageLocal()
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
Update TestGitStorage to use qUtf8Printable instead of pPrintable.
This ensures that non-ASCII chars are utf8 encoded before calling internal functions.
In windows case pPrintable returns other codepoint that depends on system settings.
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
Update tests with a (compile time) option SUBSURFACE_TEST_DATA,
pointing to test data base path. It is needed for cross compilation cases.
SUBSURFACE_TEST_DATA is set to SUBSURFACE_SOURCE by default,
or configurable via cmake option -DSUBSURFACE_TEST_DATA="...".
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>