Commit graph

361 commits

Author SHA1 Message Date
Berthold Stoeger
95284c026e cleanup: move dive_table from dive.h to divelist.h
This allows us to decouple dive.h and divelist.h, a small step in
include disentangling.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 09:42:31 -07:00
Dirk Hohndel
da953fa18a move GitHub url to the Subsurface org
Instead of using the Subsurface-divelog user on GitHub, we now use an org that
was generously donated to us.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-26 16:36:30 -07:00
Berthold Stoeger
17526ded58 cleanup: move clearing of device nodes to clear_dive_file_data()
It makes no sense to keep the device nodes if all the other data
is cleared. Let's do this automatically and not explicitly.
This ensures that the function is also called on mobile.
Currently it was only called on desktop.

Weirdly, the parser-tests were expecting that the device nodes
were not reset by clear_dive_file_data() and therefore divecomputers
were accumulating in the test results. Thus, the additional
computers had to be removed from the expected test results.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-24 10:40:12 -07:00
Dirk Hohndel
ad66297cfd desktop: remove user survey
We have never made good use of the results. Let's just remove it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-19 14:27:54 -07:00
Dirk Hohndel
af753a52e3 testing: re-enable TestGitStorage
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-15 07:58:10 -07:00
Dirk Hohndel
935b28c119 testing/git-storage: alternative random number generation for Qt 5.9
We still need to support Qt 5.9 for Ubuntu 18.04 / Bionic. This uses
deprecated calls to qrand() - but then qrand() wasn't deprecated in 5.9.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-15 07:58:10 -07:00
Dirk Hohndel
20f0a82b4e testing/git-storage: fairly fundamental rewrite of the storage test
The old test was broken in many ways and kept failing for a number of
reasons. Some of them were addressed in the previous commits (the
missing HEAD ref being the main one), the other one was that the tests
kept stepping on top of each other - as were potentially random users or
reviewers using the 'universal' test account.

This uses a random one of ten dedicated test accounts, and on top of
that uses a random branch name (instead of the fixed email address
associated with the account).

This also rewrites several of the tests dealing with offline changes to
correctly model going offline (but keeps one that directly writes to the
local cache).

Finally this change also tries to do a much better job cleaning up after
itself and not leaving data behind the the next run could stumble over.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-15 07:58:10 -07:00
Berthold Stoeger
3f3869ff65 media: move picture function from dive.c to picture.c
Currently, move only those functions that do not access dive
structures.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-10 10:53:03 -07:00
Berthold Stoeger
6dbc9ca4b0 cleanup: don't compile subsurface-helper.cpp for tests
It is unclear why the subsurface-helper.cpp file was linked with the
tests. In any case, it led to comlicated ifdef-ery, so let's remove
that for now and readd later if the need arises.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-31 08:49:12 -07:00
Robert C. Helling
285fa8acbc Grammar: replaces 'indexes' by 'indices'
Grammar-nazi ran

git grep -l 'indexes' | xargs sed -i '' -e 's/indexes/indices/g'

to prevent future wincing when reading the source code.

Unfortunatly, Qt itself is infected as in
QModelIndexList QItemSelection::indexes() const

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-03-11 08:26:30 -07:00
Dirk Hohndel
5601104ba5 tests: don't build PlannerShared
Once we start using the commands on mobile, the dependencies for this test
break. And since we have disabled the failed attempt to create a planner for
mobile, there's no point running these tests right now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09 12:41:11 -07:00
Berthold Stoeger
d27b6805f3 Cleanup: rename plannerShared to PlannerShared
Usually, we use PascalCase (i.e. camelCase with a capital
letter at the start) for class names. For consistency, let's
do it here as well.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04 02:17:52 +01:00
Berthold Stoeger
8396b4bf01 Remove plannerShared::instance()
This class contains only static functions (i.e. it does not contain
any state). There does not seem to be a reason to have an instance
of that class. Therefore, remove the instance() function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-31 21:31:26 +01:00
Dirk Hohndel
49616c1842 GitHub Actions: disabling TestGitStorage again
I thought I had it fixed, but we still see a ridiculous number
of random, unexplained failures which distract from what we are
trying to do with the GitHub Actions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-26 16:29:14 -08:00
jan Iversen
86fd49f2d7 diveplanner: adjust sac-factor calculation.
The real values are 1.0 to 10.0, but QML needs int so mobile
gets values 10.0 to 100.0

add sacfactor() to QMLInterface and update QML.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
cd3c2266f9 dive planner: correct bottomsac/decosac calc.
Move conversion cuft <-> liter from desktop-widget/diveplanner.cpp
to plannerShared, to facilitate the same results in mobile
diveplanner

Use Backend for bottomsac/decosac and update to check
for switch LITER <-> CUFT

Add bottomsac/decosac to QMLinterface.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
e55c740d84 diveplanner: call planner model directly for simple variables.
Variables without conversion, do not need to pass plannerShared
(due to the QML interface).

Simple variables do not pass plannerShared, but diveplanner
in desktop-widgets and qmlinterface in mobile-widgets call the
implementation directly.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
1f51251f1b backend-shared: remove asc/desc functions
Ascent/Descent rate functions are fully implemented in diveplannermodel,
therefore remove these functions.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 15:49:02 -08:00
jan Iversen
6e06550631 core/settings:: remove string functions for units
Remove string version of unit_system, duration_units, length, pressure,
temperature, vertical_speed_time, and volume, including tests and make signals
strongly typed in C++

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 09:55:26 -08:00
jan Iversen
13b2b9f19c core/settings: allow signals to be strongly typed in C++
Register enums to allow them to be used in signal handlers instead of int.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 09:49:49 -08:00
Dirk Hohndel
e1cd055111 code cleanup: add empty table structures
It seemed to make sense to combine all three types in one commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
4e419f7445 code cleanup: use setPath to set directory
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
7e599c9ff0 Revert "build system: disable TestGitStorage"
This reverts commit d0e52140e5.

TestGitStorage should work again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-04 02:47:45 +09:00
Dirk Hohndel
d0e52140e5 build system: disable TestGitStorage
While this appears to work fine when tested individually, when running
as part of the GitHub actions it causes random failures. This needs to
be rethought.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-02 09:00:22 -08:00
Dirk Hohndel
f87275b804 tests: allow overwriting cloud account
TestGitStorage is used in all test runs, which results in occasional errors
because two test runs step on each other. This allows us to use different
accounts in different runs.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-01 15:11:20 -08:00
Dirk Hohndel
66ce324ec5 tests: refactor TestGitStorage
It's silly to set up the URL and email in almost every function. Instead do it
once at the start and reuse that information.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-01 15:11:20 -08:00
jan Iversen
e9301690ce tests: corrected typo in CMakeFiles.txt
This typo caused that testplannershared was not available
in neither desktop nor mobil.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31 07:43:19 +09:00
jan Iversen
80b55b9e85 tests: correct decosac/bottomsac in imperial.
The getter returns alwayes in m/1000, making the calculations
identical, independent if the system is in Metric or Imperial units.

Correct getter test cases.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31 04:32:34 +09:00
jan Iversen
2f16f7539e tests: correct bestmixend test cases.
When unit system Imperial is properly activated, these test cases
have wrong values, and thus fail.

Use correct values.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31 04:32:34 +09:00
jan Iversen
24c42b9b55 tests: reactivate test case in testplannershared
reactivate deco2 test case, after problem is solved in plannerShared.

Also add a commit on bottompo2/decopo2 in imperial mode, that do not
use PSI as expected.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31 04:32:34 +09:00
Dirk Hohndel
a85b0896b4 tests: fix TestGitStorage in a mobile build
The default behavior of parse_file() is different between a desktop build
and a mobile build. This makes parse_file() always assume that it's ok to
connect to the cloud.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 13:29:08 -08:00
jan Iversen
7641a6263f tests: correct testplannershared
PSI is not implemented for diveplanner
Bestmixend in feet is not implemented for diveplanner

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:32:45 -08:00
jan Iversen
12dc98c359 tests: deactivate testQML
Qt 5.13 (and maybe 5.12) introduced new macros for QUICK_TEST_MAIN_WITH_SETUP
and as testQML is loosely based on this macro it needs to be redesigned.

Before Qt 5.11 it was not possible to do QML testing that depended on
classes being registred with the macro QUICK_TEST_MAIN_WITH_SETUP,
therefore it was nessecary to make an independent implementation of
main().

For now, let the main do a "return 0", to keep the test in the loop.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:32:02 -08:00
jan Iversen
d82840b468 tests: fix testqPrefDisplay
Font size are never stored on disk for the mobile version,
so testing load/save does not make sense.

add #ifndef SUBSURFACE_MOBILE

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:31:54 -08:00
Dirk Hohndel
9be028659e tests: fix TestQPrefLog
There were several issues with these tests, including checking
the value argument against bool values even if the underlying
preference isn't bool.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:31:43 -08:00
Dirk Hohndel
7046bb4f82 tests: fix TestQPrefEquipment
When we actually change the value, the argument to the changed signal
should be true, not false.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:31:31 -08:00
Dirk Hohndel
18fe7b8e9a tests: fix TestQPrefUnits
This clearly never was tested.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:31:20 -08:00
Dirk Hohndel
cb3561ae85 tests: fix cmake syntax confusion
You cannot have a conditional in the middle of a list. I should have
caught this in review.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:46:45 -08:00
jan Iversen
9e5564a3de tests: add gas tests for plannerShared
Add cases to test gas options.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-29 01:17:04 +09:00
jan Iversen
9229681b98 tests: add research values for diveplanning.
This commit contains the researched values used for
diveplanning, which form the basis for the test cases.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-29 01:17:04 +09:00
jan Iversen
d7d6f56c6f tests: add test cases plannerShared ratings
Add test cases to test ratings variables

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-27 05:40:26 +09:00
jan Iversen
efc573cb32 tests: activate TestPlannerShared
Use updated CMakeLists to activate TestPlannerShared
but only for mobile builds !!

This is due to the fact that commands are currently
not available for mobile builds.

Using the mobile library version of qt-mobile secured
diveplannermodel.cpp is compiled without referencces to
commands.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-27 05:40:26 +09:00
jan Iversen
f92daa16ef tests: add framework for plannerShared test
Add TestPlannerShared test (cpp + h)

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-27 05:40:26 +09:00
jan Iversen
9d34ab4bc4 buildsystem: update tests to include more libraries
In order to test plannerShared (backend-shared) more
libraries are needed.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-27 05:40:26 +09:00
jan Iversen
fc7aec5402 core/settings: make qPrefUnit accesable from QML
Use string literals to communicate with QML.

Instead of passing arounds enum/int value, it seems easier to pass string literals to QML and have that code respond to those

Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-27 04:03:25 +09:00
willemferguson
42a85dfa7e Preferences: add some tests
Write a test program to test the log tab in the preferences main menu
I am a bit skeptical about the accuracy of the last section that
delas with testing signals.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25 02:57:42 +09:00
willemferguson
b6c3cdb20c Preferences UI: add dive log tab
This adds a tab for dive log - related preferences.
A suitable test programs is still required.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25 02:57:42 +09:00
willemferguson
f63f3eb4ae Preferences: Create a test program for qPrefMedia
This is a companion for the new Media tab in the Preferences UI

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25 02:57:42 +09:00
willemferguson
2ac279d129 Pereferences UI: add media tab
Remove the preference settings dealing with thumbnails (currently under
General preferences and Profile preferences) and put them in a newly-created
Media preference tab.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25 02:57:42 +09:00
willemferguson
3e853e37a5 Preferences UI: create new equipment tab
Remove the "Show unused cylinders" checkbox (Profile tab) and the
"Set default cylinder" qTextEdit box (General tab) and put them in a
separate and new Equipment tab. This sounds like a simple task but,
as can be seen from the files changed, was actually a complex matter.
Adapt the existing test programs (General and TechDetails) for creating
a test program that tests parts of the Equipment tab.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25 02:57:42 +09:00