Commit graph

102 commits

Author SHA1 Message Date
willemferguson
1bdf00b2b4 Convert the atmospheric pressure in the Information Tab to an editable field
The Information tab shows the atmospheric pressure. Make this value editable
and also ensure that changes to it are undo-able.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2019-05-15 07:37:14 -07:00
Berthold Stoeger
858d3e2eed Dive site: fix merging tests
The handling of dive site merging changed and therefore the tests
have to be adapted.

1) Dive sites are recognized as identical based on their name.
   Therefore, give the dive sites that should be merged the same name.
2) The dive site id of the first imported dive is kept. Thus,
   merge and reverse merge produce two different output files.
   Create a second file reflecting that fact.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12 18:19:07 +03:00
Berthold Stoeger
b024ca101e Dive site: make UUID generation deterministic
Instead of using a random UUID, use an SHA1 hash of name, description
and notes (if defined). This is necessary for testing.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12 18:19:07 +03:00
Robert C. Helling
d9f2b537af Fixed get_gas_at_time for equal times
This fixes a subtle bug introduced in 5c4569247a which
unified two functions finding the gasmix at a given time
during the dive. There was a slight difference, though:
Does a gaschange exactly at that time count or not? For
the planner to work, the answer has to be in the affirmative.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-10-30 15:33:43 +01:00
Miika Turkia
68ef735bde Update DM5 test data
Now that we read the temperatures properly, the test comparison must
also include them.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-04-07 11:33:09 -07:00
Miika Turkia
947065d995 Add water temperature to test dive
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
a4c2eb5b70 Update latests changes to test dive
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
4a5b40c144 Update DL7 tests to current import
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>
2018-01-08 06:06:12 +02:00
Miika Turkia
35778d9bbc Add converted DL7 file for test validation
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
87bab637fa Add two dive headers to DL7 sample
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
62779fa453 DL7/zxu sample dive
Manually crafted sample dive demonstrating parts of the DL7 format.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
0c564a4579 Fix test parsing as new DC appears in the XML files
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-27 13:42:10 -08:00
Miika Turkia
63f1c84e38 Add imported version of DM5 test dive
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-27 13:42:10 -08:00
Miika Turkia
25afbdaa89 Test dives in DM5 database format
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-27 13:42:10 -08:00
Linus Torvalds
d5a0184f71 Fix divinglog import temperature truncation
The code incorrectly divided the temperature by 10 as an integer,
causing unnecessary precision loss due to truncation.

Fix it, and update the test results for the now improved temperature
import.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 14:52:57 -07:00
Miika Turkia
c69a56b53b Fix TestParse to handle CCR import properly
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-24 10:03:07 +09:00
Miika Turkia
405f27eb2a Fix comparison data for TestParse
It appears that we used to get additional tts=0:00min tags on Seabear
parsing. I would assume these to be incorrect as there other values
right before these that look more sensible. Also the resent change to
streamline the feature of not storing repeating values causes the test
to fail. Anyway, just grabbing the new result to compare with as it
seems sensible.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-23 04:11:00 +09:00
Miika Turkia
ccf916344b Include some extradata info on Seabear import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 21:36:50 -07:00
Dirk Hohndel
d7cf3408e5 Merge branch 'seabear-refactor'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-07 07:52:55 -07:00
Miika Turkia
21cdc64712 Update Seabear test data to use proper times
Now that we parse them...

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 16:32:32 +03:00
Stefan Fuchs
67fbf6009a Test for adding a picture with data after JFIF EOI to a dive
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-06 10:31:09 -07:00
Jeremie Guichard
2b06a0b223 Fix potential double/float to int rounding errors
Not using lrint(f) when converting double/float to int
creates rounding errors.
This error was detected by TestParse::testParseDM4 failure
on Windows. It was creating rounding inconsistencies
on Linux too, see change in TestDiveDM4.xml.

Enable -Wfloat-conversion for gcc version greater than 4.9.0

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-09 23:07:30 +07:00
Dirk Hohndel
3fef6ec31d Simple test case for merging dives
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-21 18:22:56 -08:00
Robert C. Helling
c4976b505a Test for basic image handling
This tests adding image files to dives including hashing and evaluating
exif data.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-21 13:14:56 -08:00
Dirk Hohndel
ec20d36f3c Add test for merging multiple cylinders
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-09 22:22:12 -08:00
Dirk Hohndel
4c74b15e2f TestParse: adjust reference output
Things have changed a bit in how we store data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05 16:12:10 -08:00
Linus Torvalds
56ed3f1c61 Fix Qt date interfaces for times before 1970
This seems to work around the crazy QDateTime::fromTime_t() problem in Qt.

It is *very* lightly tested. In fact, the only test is that "test0.xml"
change that is part of this patch.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29 09:07:41 -07:00
Salvador Cuñat
19fffba327 SmartTrak import - Add example divelog file
This is the example divelog shipped with Subgear products (OEMs for
Scubapro/Uwatec), just changed the name to be meaningful for the reader
of the dives directory.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-12 07:39:21 -08:00
Dirk Hohndel
4e4cd280c4 Add missing XML files for TestRenumber
Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 14:40:33 +01:00
Dirk Hohndel
3f900885df Adjust expected output for TestParse
With commit b26e516e2a ("Dive_sites-Notes shouldn't be stored as
attribute") our output format changed slightly. Adjust the expected output
to match that change to ensure that TestParse passes again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-04 13:53:29 +01:00
Miika Turkia
261c11de28 Test case: fix Seabear test data to proper dive length
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-01 07:56:21 -04:00
Miika Turkia
1153f81856 Test case: control log for DLD import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-13 15:27:59 -07:00
Dirk Hohndel
1b37e0f1a4 Add test for dive site duplication bug
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-30 10:32:38 -07:00
Miika Turkia
bd5fbce64b Test dives for Seabear new format import comparison
This file contains imported dives from Seabear H3 and T1 dive computers.
It is used for validating Seaber import from new file format.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-28 08:46:55 -07:00
Miika Turkia
5868fc46aa Test dives for Seabear new format
These are test dives for Seabear H3 and T1 dive computers received from
Seabear Diving Technology.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-28 08:46:51 -07:00
Miika Turkia
ffa45b9d24 Test dive for Seabear HUDC import comparison
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-27 06:35:10 -07:00
Miika Turkia
3f0fb84fc2 Test dive for DM4 import comparison
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-26 09:14:06 -07:00
Miika Turkia
c19f4869af Create test case for DivingLog SQLite import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-24 13:21:19 -07:00
Miika Turkia
20b9c241f0 Divinglog test dive
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13 15:21:30 -07:00
Dirk Hohndel
3e35a0067b Add a more complex sample dive
This includes trips, dives outside trips, deco, gas changes, dives with
multiple dive computers, a really short dive, a rather long dive, a dive
with pictures, dive computers with very coarse sample rate, rather fine
sample rate, with gas integration, without...

Should touch a lot of different scenarios.

The file is in V2 format to also allow testing the importing / conversion
to dive sites.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-11 10:31:11 -07:00
Dirk Hohndel
79bb61dba1 Adapt CSV test to include suit
Also fixed it to correctly parse the mean depth (duh, a test that had a
bug) and added a buddy field for good measure.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-24 07:07:31 -07:00
Salvador Cuñat
a37abc4d49 OSTCTools-Add two sample dives
Adds two test dives for OSTCTools.
I've kept the original naming.
Num 173 selected because it implies using EAN32.
Num 80, provided in forum by Philippe Tescari, selected because involves
gas changes (although user don't seems to have set different gas mixes).
Sadly, both dives seems to be from 2N/C devices.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-04 12:25:52 -07:00
Robert C. Helling
6b3b50cc2f Load remote images
When loading an image by filename and by hash fails, try to interpret
the filename as URL and download the image.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-16 12:42:36 -07:00
Dirk Hohndel
b47d8d5992 Some simple test for file parsing
With no V2 question shown
- parsing fails when a V2 file is loaded
- parsing succeeds when a V3 file is loaded
- import of CSV file succeeds

With V2 question shown
- parsing succeeds when a V2 file is loaded

Finally compare the output of reading in the various files with reference
output included in the sources.

My guess is that this test might be a bit fragile, but hey, it's a start.

(reminder: the tests only get built when using cmake)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-14 18:15:08 -07:00
Salvador Cuñat
44b55bd1a2 Import Datatrak/WLog files
Sequentially parses a file, expected to be a Datatrak/WLog divelog, and
converts the dive info into Subsurface's dive structure.

As my first DC, back in 90s, was an Aladin Air X, the obvious choice of log
software was DTrak (Win version). After using it for some time we moved to WLog
(shareware software more user friendly than Dtrak, printing capable, and still
better, it runs under wine, which, as linux user, was definitive for me). Then,
some years later, my last Aladin died and I moved to an OSTC, forcing me to
look for a software that support this DC.
I found JDivelog which was capable of import Dtrak logs and used it for some
time until discovered Subsurface existence and devoted to it.

The fact was that importing Dtrak dives in JDivelog and then re-importing them
in Subsurface caused a significant data loss (mainly in the profile events and
alarms) and weird location of some other info in the dive notes (mostly tag
items in the original Dtrak software). This situation can't actually be solved
with tools like divelogs.de which causes similar if no greater data loss.

Although this won't be a core feature for Subsurface, I expect it can be useful
for some other divers as has been for me.

Comments and issues:

Datatrak/Wlog files include a lot of diving data which are not directly
supported in Subsurface, in these cases we choose mostly to use "tags".

The lack of some important info in Datatrak archives (e.g. tank's initial
pressure) forces us to do some arbitrary assumptions (e.g. initial pressure =
200 bar).

There might be archives coming directly from old DOS days, as first versions
of Datatrak run on that OS; they were coded CP437 or CP850, while dive logs
coming from Win versions seems to be coded CP1252. Finally, Wlog seems to use a
mixed confusing style. Program directly converts some of the old encoded chars
to iso8859 but is expected there be some issues with non alphabetic chars, e.g.
"ª".

There are two text fields: "Other activities" and "Dive notes", both limited to
256 char size. We have merged them in Subsurface's "Dive Notes" although the
first one could be "tagged", but we're unsure that the user had filled it in
a tag friendly way.

WLog adds some information to the dive and lets the user to write more than
256 chars notes. This is achieved, while keeping compatibility with DTrak
divelogs, by adding a complementary file named equally as the .log file and
with .add extension where all this info is stored.  We have, still, not worked
with this complementary files.

This work is based on the paper referenced in butracker #194 which has some
errors (e.g. beginning of log and beginning of dive are changed) and a lot of
bytes of unknown meaning. Example.log shows, at least, one more byte than those
referred in the paper for the O2 Aladin computer, this could be a byte referred
to the use of SCR but the lack of an OC dive with O2 computer makes impossible
for us to compare.

The only way we have figured out to distinguish a priori between SCR and non
SCR dives with O2 computers is that the dives are tagged with a "rebreather"
tag. Obviously this is not a very trusty way of doing things. In SCR dives,
the O2% in mix means, probably, the maximum O2% in the circuit, not the O2%
of the EAN mix in the tanks, which would be unknown in this case.

The list of DCs related in bug #194 paper seems incomplete, we have added
one or two from WLog and discarded those which are known to exist but whose
model is unknown, grouping them under the imaginative name of "unknown". The
list can easily be increased in the future if we ever know the models
identifiers.
BTW, in Example.log, 0x00 identifier is used for some DC dives and from my own
divelogs is inferred that 0x00 is used for manually entered dives, this could
easily be an error in Example.log coming from a preproduction DC model.

Example.log which is shipped in datatrak package is included in dives
directory for testing pourposes.

[Dirk Hohndel: some small cleanups, merged with latest master, support
               divesites, remove the pointless memset() before free() calls
	       add to cmake build]

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10 10:03:08 -07:00
Dirk Hohndel
a081fb34e0 Test dives for duplicate names and conflicting GPS
The conflicting GPS is somewhat artificial. Since the GPS gets parsed
first in our syntax, the different GPS location would create a new dive
site and we'd end up with two dive sites of the same name with different
coordinates. By having a location tag with just the name and no
coordinates we make sure that this gets identified with the existing dive
site and THEN add the GPS coordinates in the second location tag.

This would never happen in a XML file created by Subsurface, but it does a
good job in testing the different code paths.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14 18:13:35 -08:00
Dirk Hohndel
3e429ac77d Remove Poseidon XML file
The CSV/TXT import is working well now, the XML file is just causing
confusion.

Suggested-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-04 06:10:51 -06:00
Robert C. Helling
0d7c192e6e For CCR dives, the diluent cylinder is the current cylinder
Change the meaning that _the_ cylinder (as we treat it in OC dives) is the
diluent cylinder (rather than the O2 cylinder). This eliminates special
cases. Now, for CCR, we have to handle the O2 cylinder in addition
(rather than the diluent in addition).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17 11:45:06 +00:00
Dirk Hohndel
b0033287b7 CCR test dive
This is an anonymized version of a real dive. With the latest changes the
SAC calculations now make "mostly sense".

What's clearly still broken is the tank pressure graph.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17 00:24:33 +00:00
willem ferguson
77220cd2c5 Replace XML reference log for Poseidon
The Poseidon xml dive log in the /dives folder is faulty. This patch
replace it with a fully working one.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-10 12:15:57 -08:00