aboutsummaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)Author
2017-07-04TestPreferences: Fix update manager test dateGravatar Seamus Boyle
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>
2017-05-27Fix some warningsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-26Adopt planner state caching to new structGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-12Test case for CSV profile export to imperial and backGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07Merge branch 'seabear-refactor'Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-07Change test case to use new Seabear parsing functionGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07Move intdup to qthelperGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06Test for adding a picture with data after JFIF EOI to a diveGravatar Stefan Fuchs
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>
2017-05-06Enable test mode in UDDF export testGravatar Miika Turkia
Using the units parameter to indicate test mode on UDDF export. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06Add UDDF export-import testGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06Fix memory leakGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-29Add SPDX header to testsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-01Cleanup for CSV testingGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-01Enable CSV import-export unit conversion testGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-01Export-import test for manual CSVGravatar Miika Turkia
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>
2017-04-01Change parseCSV to support unit and file selectionGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-03-28minimal pO2 threshold: corrected testpreferencesGravatar Jan Mulder
Adapt the testpreferences procedure for the new min/max pO2 preference. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-03-24Fix double to int truncation in C++ codeGravatar Jeremie Guichard
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>
2017-03-19Tests for minimum gasGravatar Stefan Fuchs
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>
2017-03-11Fix error in install target for tests on WindowsGravatar Jeremie Guichard
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>
2017-03-11Fix failures in TestPreferences for Windows runGravatar Jeremie Guichard
QSettings needs OrganizationName and ApplicationName to be set to work properly under Windows. Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-04Rework TestParse to make tests independent from each otherGravatar Jeremie Guichard
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>
2017-03-04Use QTest cleanup method for proper test shutdownGravatar Jeremie Guichard
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>
2017-03-04Use proper QTest initialization method in TestGitStorageGravatar Jeremie Guichard
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>
2017-03-04Use proper order in QCOMPARE argumentsGravatar Jeremie Guichard
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>
2017-02-25Fix trailing '\r' test failure on WindowsGravatar Jeremie Guichard
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>
2017-02-25Improve install and test rules for Windows test executionGravatar Jeremie Guichard
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>
2017-02-25Move CMake variables printing into a utility macroGravatar Jeremie Guichard
Added cmake_variables_helper.cmake providing 2 helpers - print_variable - print_all_variables Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-02-24Fix "Load/Save to cloudstorage" for non-ASCII user namesGravatar Jeremie Guichard
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>
2017-02-24Make TestGitStorage::testGitStorageLocal parametrizableGravatar Jeremie Guichard
Make use of QTest "Data Driven Testing", allowing to test multiple repo base path values. Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-02-24Replace pPrintable with qUtf8Printable in TestGitStorageGravatar Jeremie Guichard
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>
2017-02-24Use SUBSURFACE_TEST_DATA definition to point to test data dirGravatar Jeremie Guichard
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>
2017-02-21Simple test case for merging divesGravatar Dirk Hohndel
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>
2017-02-21Test for basic image handlingGravatar Robert C. Helling
This tests adding image files to dives including hashing and evaluating exif data. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-19Fix typo in saturation/desatureation ratesGravatar Robert C. Helling
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>
2017-02-11Set up gaslist only in the beginning of diveplanGravatar Robert C. Helling
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>
2017-02-09Add test for merging multiple cylindersGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-09Reenable all of TestParseGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-09Fix dive number comparison for Seabear import testsGravatar Miika Turkia
2017-02-09Add numberField parameter for parse testingGravatar Miika Turkia
2017-02-09Fix typo on parse testingGravatar Miika Turkia
2017-02-07travis: Run a xfvb for TestPreferencesGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06On Travis, don't run TestPreferencesGravatar Dirk Hohndel
... because that one needs a display to run. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06TestParse: disable failing testsGravatar Dirk Hohndel
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>
2017-02-06TestParse: prevent crashesGravatar Dirk Hohndel
Two CSV imports are failing right now; we shouldn't access uninitialized memory when that happens. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05TestParse: make sure we get one dive from SeabearHUDCGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05TestPreferences needs GUI environmentGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05Our tests are actually GUILESSGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-06Rename prefs.deco_mode to prefs.planner_deco_modeGravatar Robert C. Helling
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>
2016-12-27Test line-by-line for equality on TestGravatar Tomaz Canabrava
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>