on xenial help sign in
adding tests
commit614e7b178ec0e257301a41f61946984409598355 authorDiego Sarmentero <diego.sarmentero@gmail.com> dateWed 27 Aug 2014, 11:56 (12 years ago) parent2ec1733
2 files changed+32
qml/Dash/Previews/PreviewPayments.qml+1 tests/qmltests/Dash/Previews/tst_PreviewPayments.qml+31
qml/Dash/Previews/PreviewPayments.qml+1
@@ -49,6 +49,7 @@ PreviewWidget {
4949
5050 Payments {
5151 id: paymentClient
52+ objectName: "paymentClient"
5253
5354 property var source: widgetData["source"]
5455
tests/qmltests/Dash/Previews/tst_PreviewPayments.qml+31
@@ -103,6 +103,37 @@ Rectangle {
103103 tryCompare(button, "opacity", 0);
104104 }
105105
106+ function test_progress_show_cancel() {
107+ // Make sure the progress bar is shown.
108+ previewPayments.widgetData = jsonPurchase;
109+
110+ var button = findChild(root, "paymentButton");
111+ var progress = findChild(root, "loadingBar");
112+
113+ tryCompare(progress, "visible", false);
114+ tryCompare(progress, "opacity", 0);
115+ tryCompare(button, "visible", true);
116+ tryCompare(button, "opacity", 1);
117+
118+ mouseClick(button, button.width / 2, button.height / 2);
119+
120+ spy.wait();
121+
122+ tryCompare(progress, "visible", true);
123+ tryCompare(progress, "opacity", 1);
124+ tryCompare(button, "visible", false);
125+ tryCompare(button, "opacity", 0);
126+
127+ var paymentClient = findChild(root, "paymentClient");
128+ paymentClient.storeItemId = "com.example.invalid";
129+ paymentClient.start();
130+
131+ tryCompare(progress, "visible", false);
132+ tryCompare(progress, "opacity", 0);
133+ tryCompare(button, "visible", true);
134+ tryCompare(button, "opacity", 1);
135+ }
136+
106137 function test_purchase_error() {
107138 // The mock Payments triggers an error when com.example.invalid is
108139 // passed to it as store_item_id. Exercise it here