2
* This file is part of Checkbox
4
* Copyright 2015 Canonical Ltd.
7
* - Maciej Kisielewski <maciej.kisielewski@canonical.com>
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; version 3.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
/*! \brief Page for Qml native test
26
import Ubuntu.Components 1.1
27
import Ubuntu.Components.Popups 0.1
28
import QtQuick.Layouts 1.1
29
import "ConfirmationLogic.js" as ConfirmationLogic
30
import Ubuntu.Content 1.1
34
property var test: { "name": "", "description": "", "test_number": 0, "tests_count": 0}
35
property var applicationVersion: ""
37
signal testDone(var test);
39
objectName: "qmlNativePage"
40
title: i18n.tr("Test Description")
42
/* testingShell serves as the interface to the external world from the
46
property string name: "Checkbox-touch qml confined shell"
47
property alias pageStack: qmlNativePage.pageStack
48
property string sessionDir: app.sessionDir
57
var resultFile = String(transfer.items[0].url).replace(
59
var xhr = new XMLHttpRequest;
60
xhr.open("GET", resultFile);
61
xhr.onreadystatechange = function() {
62
if (xhr.readyState === XMLHttpRequest.DONE) {
64
var result = JSON.parse(xhr.responseText);
65
test["outcome"] = result["outcome"];
68
console.error("ERROR when parsing result json obj.")
81
iconName: "document-new-symbolic"
82
text: i18n.tr("Add comment")
84
commentsDialog.commentDefaultText = test["comments"] || "";
85
commentsDialog.commentAdded.connect(function(comment) {
86
test["comments"] = comment;
88
PopupUtils.open(commentsDialog.dialogComponent);
93
iconName: "media-seek-forward"
96
var confirmationOptions = {
97
question : i18n.tr("Do you really want to skip this test?"),
100
ConfirmationLogic.confirmRequest(qmlNativePage,
101
confirmationOptions, function(res) {
103
test["outcome"] = "skip";
117
topMargin: units.gu(3)
118
bottomMargin: units.gu(3)
119
leftMargin: units.gu(1)
120
rightMargin: units.gu(1)
125
Layout.fillWidth: true
126
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
132
Layout.fillWidth: true
133
Layout.fillHeight: true
134
contentHeight: childrenRect.height
135
flickableDirection: Flickable.VerticalFlick
140
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
141
text: test["description"]
146
id: busyIndicatorGroup
148
Layout.fillWidth: true
149
Layout.fillHeight: true
153
Layout.fillWidth: true
154
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
155
text: i18n.tr("Waiting for the test to finish")
161
objectName: "continueButton"
162
color: UbuntuColors.green
163
Layout.fillWidth: true
164
text: i18n.tr("Continue")
166
busyIndicatorGroup.visible = true;
167
var appName = "com.ubuntu.checkbox_" + test["partial_id"] + "_" + applicationVersion + ".desktop";
168
console.log("Launching " + appName);
169
Qt.openUrlExternally("application:///" + appName);