aboutsummaryrefslogtreecommitdiff
path: root/tests/tst_PressureModel.qml
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2013-12-08 14:46:45 +0200
committerOskari Timperi <oskari.timperi@iki.fi>2013-12-08 14:46:45 +0200
commit6e444978a1c327c7cd98ded195478dc6906dc1b7 (patch)
treecd80a2e1074d1840fb2e516f44a2af16a92b3418 /tests/tst_PressureModel.qml
parent647eefc8eb6201807418d62d07618bf87e212de6 (diff)
downloadunitmaster-6e444978a1c327c7cd98ded195478dc6906dc1b7.tar.gz
unitmaster-6e444978a1c327c7cd98ded195478dc6906dc1b7.zip
add tests for other units too
Diffstat (limited to 'tests/tst_PressureModel.qml')
-rw-r--r--tests/tst_PressureModel.qml46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/tst_PressureModel.qml b/tests/tst_PressureModel.qml
new file mode 100644
index 0000000..e25f89f
--- /dev/null
+++ b/tests/tst_PressureModel.qml
@@ -0,0 +1,46 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+import "../harbour-unitmaster/qml/pages"
+
+TestCase {
+ name: "PressureModelTest"
+
+ PressureModel {
+ id: model
+ }
+
+ function test_to_data() {
+ return [
+ { to: "kilopascal", value: 1234, res: 1.234 },
+ { to: "bar", value: 1, res: 1e-5 },
+ { to: "millibar", value: 1, res: 0.01 },
+ { to: "pounds per square inch", value: 1, res: 1.450377e-4 },
+ { to: "technical atmosphere", value: 1, res: 1.0197e-5 },
+ { to: "standard atmosphere", value: 1, res: 9.8692e-6 },
+ { to: "torr", value: 1, res: 7.5006e-3 }
+ ];
+ }
+
+ function test_to(data) {
+ var result = model.to(data.to, data.value);
+ compare(result, data.res);
+ }
+
+ function test_from_data() {
+ return [
+ { from: "kilopascal", value: 1, res: 1000 },
+ { from: "bar", value: 1, res: 1e5 },
+ { from: "millibar", value: 1, res: 100 },
+ { from: "pounds per square inch", value: 1, res: 6.8948e3 },
+ { from: "technical atmosphere", value: 1, res: 0.980665e5 },
+ { from: "standard atmosphere", value: 1, res: 1.01325e5 },
+ { from: "torr", value: 1, res: 133.3224 }
+ ];
+ }
+
+ function test_from(data) {
+ var result = model.from(data.from, data.value);
+ compare(result, data.res);
+ }
+}