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>
We do some merging in a couple of the other tests as well, but the idea
is to have specific test cases that exercise our merge logic.
This one starts simple. Merge a dive with some valid info with a second
one that has less data filled. And then try it in both possible orders.
It shows a few potential problems.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch eliminates the difference between the saturation and
desaturation rates. This was probably once meant as a conservative
measure but the desaturation rate was increased rather than the
saturation rate (which is probably a typo, as reported by Stefan).
Since there is no good basis for this anyway, this patch sets
both factors to 1.0 (and if accepted the whole factor business
should be removed).
This makes our deco times slightly longer. But in the past,
we had introduced a 1.2% fudge factor in the critical radius
calculation to add conservatism and match the benchmark better.
Removing this fudge factor brings us close to the benchmarks.
Expected test values updated.
Reported-by: Stefan <sjti@gmx.net>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
In the beginning of the diveplan, divedatapoints of zero
duration indicate available gases with the depth giving
the suggested switch depth. Zero-duration datapoints in
the middle of the dive do not have this meaning and should
thus be ignored when composing the gaslist.
The tests should have these gas defining segments in the beginning.
This fixes a problem when replanning a dive that would change
to random gases during deco.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
I don't understand why the SeaBear tests fail... of course commenting
out failing tests is exactly the wrong thing to do. But I'll open an
issue on github instead.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is to avoid confusion with planner.display_deco_mode.
When accessing the "current deco mode" use the decoMode()
helper function.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
We where testing the whole document, wich made qDebug
completely bogus to see where we failed at testing the
generated file. If we test line-by-line, we can know
more easily where we failed.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>