Commit graph

11274 commits

Author SHA1 Message Date
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
Cristian Ionescu-Idbohrn
e8923a9bad Simplify some tests
Because `[ "$foo" != "" ] is equivalent to `[ "$foo" ]'
in all POSIX shells.

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-09 21:31:11 -08:00
Cristian Ionescu-Idbohrn
1c33951ce6 Remove useless quotes
Don't quote if you don't have to.  Spend those cpu cycles on doing
something more useful, instead.

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-09 21:31:11 -08:00
Cristian Ionescu-Idbohrn
9470278e87 Use `command' (shell builtin and POSIX) instead
The `which' command is a fork and possible not standard in various
distributions, or builtin in certain (odd)? shells, like `zsh'.

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-09 21:31:11 -08:00
Linus Torvalds
0e7d8993a2 Make cylinder merging a bit more careful
This makes some further updates to the new cylinder merging code:

 - avoid re-using the cylinder if the usage type (OC/diluent/O2) is
   different between the two dives, even if the gasmix might be the
   same.

 - avoid re-using a cylinder if the user has manually added pressure
   data for it (and the pressures don't match)

 - when deciding to reuse a cylinder, make sure that we merge as much of
   the type information as makes sense.

This will potentially result in more cylinders that might need manual
cleanup, but at least we won't be throwing out user data.  And in most
cases where merging happens, none of this is an issue (because the data
comes fresh from a dive computer, and won't have been manually edited to
trigger the new rules).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-02-09 21:30:49 -08:00
Linus Torvalds
e2bbd0ceec Rewrite cylinder merging code from scratch
The old cylinder merging code depended on the preferred dive having all
the cylinders, and the newly merged dive was just forced to pick from
that existing set of cylinders.

That worked ok if you have a "main" dive computer that you have all the
gases programmed for, and you download that first, and then you download
any secondary data later.

But it completely messed up if the second dive computer had gases that
the first one didn't know about, and just basically ended up doing
random things.

This rewrites the whole thing to actually try to create a union of the
two sets of cylinders when merging, with sane matching so that if the
cylinders match you won't get duplicates.

Miika Turkia hit this when he only used one gas, but had several gases
defined in his OSTC that he downloaded after his Vyper (with had just
the single gas defined).

This should fix that case (at least it does for my xml merging test-case
that showed the same problem after some munging).

Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-02-09 21:30:49 -08:00
Dirk Hohndel
8f97c4a8eb Reenable all of TestParse
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-09 16:54:48 -08:00
Miika Turkia
0630d584f4 Fix dive number comparison for Seabear import tests 2017-02-09 09:41:56 -08:00
Miika Turkia
d3cc3f371b Add numberField parameter for parse testing 2017-02-09 09:22:30 -08:00
Miika Turkia
19a2c28b1a Fix typo on parse testing 2017-02-09 09:22:30 -08:00
Miika Turkia
d23717523b Define numberField variable on CSV import
We need to define the import variables that we use. This should fix the
Seabear HUDC import and thus the corresponding test case.
2017-02-09 09:22:30 -08:00
Anton Lundin
24f61e8b3d travis: Correct infrastructure for tests on mobile
In the previous code, there was a mistake in how cwd in travis works.
This solves that by just using make -C instead.

The only issue is that the tests currently fail.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-07 07:48:31 -08:00
Anton Lundin
40620aca0b travis: actually build the mobile version to
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-07 07:48:07 -08:00
Anton Lundin
9aacc41a48 travis: Run a xfvb for TestPreferences
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-07 07:48:00 -08:00
Willem Ferguson
b912880707 Fix syntax error in android/build.sh
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-07 07:42:00 -08:00
Dirk Hohndel
5018ad4748 On Travis, don't run TestPreferences
... because that one needs a display to run.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 22:25:53 -08:00
Dirk Hohndel
2bad9bd57d Enable tests on Travis
Now that I disabled the failing parts of the TestParse, we should be
able to run this by default.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 22:10:13 -08:00
Dirk Hohndel
97baf9b54b TestParse: disable failing tests
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-06 22:08:56 -08:00
Anton Lundin
56b518d956 android: Rework build.sh
This reworks build.sh for proper argument parsing and variable quoting.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 21:16:10 -08:00
Anton Lundin
bed5ad31e6 android-wrapper: Auto install Qt
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 21:15:33 -08:00
Anton Lundin
9d235d165e android: Upgrade Qt to 5.8
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 21:15:08 -08:00
Anton Lundin
c345702d1b android: Move suggested/expected Qt install to just Qt
In the Qt installer, there is a MaintenanceTool which can upgrade your
install, so don't install in a "versioned" directory, just install in a
plain Qt-directory.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 21:14:53 -08:00
Anton Lundin
9f7c3c31f7 android-wrapper: Auto accept android sdk license
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 21:13:49 -08:00
Anton Lundin
b7a1b2dbf6 android-wrapper: Quiet down unzip
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 21:13:44 -08:00
Anton Lundin
cf5c9d371e android-wrapper: Quiet down wget
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 21:12:26 -08:00
Anton Lundin
2c160534eb android-wrapper: Add unzip as prerequisite
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 21:12:05 -08:00
Anton Lundin
2b89d9ead0 android-wrapper: Add wget as prerequisite
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 21:11:40 -08:00
Anton Lundin
82c972574b android-wrapper: Fail fast and at point
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 21:11:27 -08:00
Anton Lundin
6fd438e053 android-wrapper: Give a negative exit code on error
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 21:11:14 -08:00
Dirk Hohndel
77ed1b682e TestParse: prevent crashes
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-06 04:49:24 -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
Dirk Hohndel
90af2f1f48 TestParse: make sure we get one dive from SeabearHUDC
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05 16:11:20 -08:00
Dirk Hohndel
e6a50be127 TestPreferences needs GUI environment
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05 16:10:37 -08:00
Anton Lundin
3ae9408a4c Add a travis build of subsurface
This runs a subsurface script/build.sh build in travis-ci, and runs the
tests afterwards.

The build runs on the Ubuntu Trusty image, but due to the fact that the
Qt shipped there is to old, it installs a Qt 5.8 from qt.io , and with
some trickery caches it.

Hacked out are things that doesn't build with Qt 5.8, and the rest is
built against WebEngine.

The tests currently fail, and I really don't know why, but its a clear
indication that they aren't run that often. This cam makes sure they are
run at least. The actual testing is just commented out for that reason.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05 14:46:08 -08:00
Anton Lundin
c2ea3c2616 Our tests are actually GUILESS
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05 14:45:25 -08:00
Dirk Hohndel
f6cd21ce5a Finish removal of informational_prefs
And make export-html build again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05 12:44:11 -08:00
Joakim Bygdell
0277d5aacc Merge informational_prefs into git_prefs
There is no need to have two variables for the same purpose.

[Dirk Hohndel: changed to keep the two separate functions as otherwise
               we no longer parse existing repos successfully]

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05 12:29:51 -08:00
Joakim Bygdell
12c33a038f Mobile: Do not show tankbar for CCR dives
If we are showing the setpoint and sensor pO2 we need the space.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05 12:20:33 -08:00
Joakim Bygdell
11ccadbab5 MOBILE: Reposition objects in the profile
Add the tankbar to the profile and change the relative positions of the depth
and temperature curves to minimize overlap.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05 11:59:47 -08:00
Joakim Bygdell
11dcae436e MOBILE: Read profile settings from git
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05 11:59:47 -08:00
Joakim Bygdell
d4dbd0bee7 Save profile settings to git
In order to streamline the view between desktop and mobile we need to save
selected profile related settings to git.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05 11:59:47 -08:00
Robert C. Helling
6518b0db45 Treat gaschanges at 1s as inital gas use
When the first leg in the planner is not cylinder 0, a gaschange
event at t=1s is inserted. In the profile, we should treat that
as inital gas, so no pressure information is printed for cylinder 0
that is used nominally for one second.

This fixes a problem reported by Willem.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-04 07:09:35 -08:00
Robert C. Helling
2516ae7e5f Let cylinderid = -1 mean same gas as before
It's not too clever to give 0 a special meaning (as here:
use same gas as for previous leg) when 0 is a legitimate
value.

This should solve Willem's gas disappearance problem when
reediting a dive in the planner.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-04 07:09:35 -08:00
Stefan Fuchs
cd38cda186 Bugfix planner output formating (linebreaks)
Changed the markup with <div> and <br> tags of the planner output in
a way that is is a good compromise for both displaying in UI and
printing.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-02-04 07:06:29 -08:00
Dirk Hohndel
911d2798cd Android build wrapper: sometimes quotes hurt you
Shellcheck wanted quotes around "$USE_X" - but that makes the script
fail if you run it without the '-x' argument.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-04 07:02:11 -08:00
Dirk Hohndel
9a754b663a Extend Android wrapper shell to be smarter
Move it to packaging/android where it belongs
Use direct URLs to download Android components
Make sure required packages are installed (only tested on Ubuntu)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 17:45:26 -08:00
Dirk Hohndel
ca6a241a97 Add argument to subsurface_console_init call
Subsurface-mobile doesn't work on Windows, so we can just
hardcode this to false.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 17:43:25 -08:00
Robert C. Helling
855995191c Don't do strcmp on NIL pointer
This is what we have same_string() for...

This prevents a crash when saving a dive in the planner.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 15:04:51 -08:00
Dirk Hohndel
db7290a915 Same typo, two more times
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 15:01:15 -08:00
Dirk Hohndel
f563f73607 Fix build breakage with earlier Qt versions
In order to get the translations right for Windows we now explicitly
pull in a lot more translation files - some of which don't exist in
earlier Qt versions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 10:58:00 -08:00