summaryrefslogtreecommitdiffstats
path: root/tests/tst_qPrefUnits.qml
blob: 88bee3076ac57fdb516d105180242ec5d4269fd6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// SPDX-License-Identifier: GPL-2.0
import QtQuick 2.6
import QtTest 1.2

TestCase {
	name: "qPrefUnits"

	function test_variables() {
		var x1 = PrefUnits.coordinates_traditional
		PrefUnits.coordinates_traditional = true
		compare(PrefUnits.coordinates_traditional, true)

//TBD		var x2 = PrefUnits.duration_units
//TBD		PrefUnits.duration_units = ??
//TBD		compare(PrefUnits.duration_units,  ??)

//TBD		var x3 = PrefUnits.length
//TBD		PrefUnits.=length = ??
//TBD		compare(PrefUnits.length,  ??)

//TBD		var x4 = PrefUnits.pressure
//TBD		PrefUnits.pressure = ??
//TBD		compare(PrefUnits.pressure, ??)

		var x5 = PrefUnits.show_units_table
		PrefUnits.show_units_table = true
		compare(PrefUnits.show_units_table, true)

//TBD		var x6 = PrefUnits.temperature
//TBD		PrefUnits.temperature = ??
//TBD		compare(PrefUnits.temperature, ??)

		var x7 = PrefUnits.unit_system
		PrefUnits.unit_system = "metric" 
		compare(PrefUnits.unit_system, "metric")

//TBD		var x8 = PrefUnits.vertical_speed_time
//TBD		PrefUnits.vertical_speed_time = ??
//TBD		compare(PrefUnits.vertical_speed_time, ??)

//TBD		var x9 = PrefUnits.volume
//TBD		PrefUnits.volume = ??
//TBD		compare(PrefUnits.volume, ??)

//TBD		var x10 = PrefUnits.weight
//TBD		PrefUnits.weight = ??
//TBD		compare(PrefUnits.weight, ??)
	}

	Item {
		id: spyCatcher

		property bool spy1 : false
		property bool spy5 : false
		property bool spy7 : false

		Connections {
			target: PrefUnits
			onCoordinates_traditionalChanged: {spyCatcher.spy1 = true }
			onShow_units_tableChanged: {spyCatcher.spy5 = true }
			onUnit_systemChanged: {spyCatcher.spy7 = true }
		}
	}

	function test_signals() {
		PrefUnits.coordinates_traditional = ! PrefUnits.coordinates_traditional
		PrefUnits.show_units_table = ! PrefUnits.show_units_table
		PrefUnits.unit_system = "qml" 

		compare(spyCatcher.spy1, true)
		compare(spyCatcher.spy5, true)
		compare(spyCatcher.spy7, true)
	}
}