@@ -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