summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qmltests/data/tst_action.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qmltests/data/tst_action.qml')
-rw-r--r--tests/auto/quick/qmltests/data/tst_action.qml65
1 files changed, 22 insertions, 43 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_action.qml b/tests/auto/quick/qmltests/data/tst_action.qml
index 56a91d8d0..9e49c2dbf 100644
--- a/tests/auto/quick/qmltests/data/tst_action.qml
+++ b/tests/auto/quick/qmltests/data/tst_action.qml
@@ -1,34 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.2
-import QtTest 1.0
-import QtWebEngine 1.8
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import QtQuick
+import QtTest
+import QtWebEngine
TestWebEngineView {
id: webEngineView
@@ -41,7 +16,7 @@ TestWebEngineView {
}
TestCase {
- id: actionTests
+ id: testCase
name: "WebEngineAction"
when: windowShown
@@ -51,8 +26,8 @@ TestWebEngineView {
{ webAction: WebEngineView.Forward, text: "Forward", iconName: "go-next", enabled: false },
{ webAction: WebEngineView.Stop, text: "Stop", iconName: "", enabled: false },
{ webAction: WebEngineView.Reload, text: "Reload", iconName: "view-refresh", enabled: true },
- { webAction: WebEngineView.Cut, text: "Cut", iconName: "Cut", enabled: true },
- { webAction: WebEngineView.Copy, text: "Copy", iconName: "", enabled: true },
+ { webAction: WebEngineView.Cut, text: "Cut", iconName: "Cut", enabled: false },
+ { webAction: WebEngineView.Copy, text: "Copy", iconName: "", enabled: false },
{ webAction: WebEngineView.Paste, text: "Paste", iconName: "", enabled: true },
{ webAction: WebEngineView.Undo, text: "Undo", iconName: "", enabled: true },
{ webAction: WebEngineView.Redo, text: "Redo", iconName: "", enabled: true },
@@ -76,7 +51,7 @@ TestWebEngineView {
{ webAction: WebEngineView.InspectElement, text: "Inspect", iconName: "", enabled: true },
{ webAction: WebEngineView.ExitFullScreen, text: "Exit full screen", iconName: "", enabled: true },
{ webAction: WebEngineView.RequestClose, text: "Close Page", iconName: "", enabled: true },
- { webAction: WebEngineView.Unselect, text: "Unselect", iconName: "", enabled: true },
+ { webAction: WebEngineView.Unselect, text: "Unselect", iconName: "", enabled: false },
{ webAction: WebEngineView.SavePage, text: "Save page", iconName: "", enabled: true },
{ webAction: WebEngineView.ViewSource, text: "View page source", iconName: "view-source", enabled: true },
{ webAction: WebEngineView.ToggleBold, text: "&Bold", iconName: "", enabled: true },
@@ -90,7 +65,9 @@ TestWebEngineView {
{ webAction: WebEngineView.Indent, text: "&Indent", iconName: "", enabled: true },
{ webAction: WebEngineView.Outdent, text: "&Outdent", iconName: "", enabled: true },
{ webAction: WebEngineView.InsertOrderedList, text: "Insert &Ordered List", iconName: "", enabled: true },
- { webAction: WebEngineView.InsertUnorderedList, text: "Insert &Unordered List", iconName: "", enabled: true }
+ { webAction: WebEngineView.InsertUnorderedList, text: "Insert &Unordered List", iconName: "", enabled: true },
+ { webAction: WebEngineView.ChangeTextDirectionLTR, text: "Change text direction left to right", iconName: "", enabled: true },
+ { webAction: WebEngineView.ChangeTextDirectionRTL, text: "Change text direction right to left", iconName: "", enabled: true }
];
}
@@ -110,17 +87,17 @@ TestWebEngineView {
webEngineView.url = Qt.resolvedUrl("test1.html");
verify(webEngineView.waitForLoadSucceeded());
- var copyAction = webEngineView.action(WebEngineView.Copy);
- verify(copyAction);
+ var selectAction = webEngineView.action(WebEngineView.SelectAll);
+ verify(selectAction);
var stopAction = webEngineView.action(WebEngineView.Stop);
verify(stopAction);
- var triggerSpy = createTemporaryObject(signalSpy, actionTests, {target: copyAction, signalName: "triggered"});
- var stopTriggerSpy = createTemporaryObject(signalSpy, actionTests, {target: stopAction, signalName: "triggered"});
+ var triggerSpy = createTemporaryObject(signalSpy, testCase, {target: selectAction, signalName: "triggered"});
+ var stopTriggerSpy = createTemporaryObject(signalSpy, testCase, {target: stopAction, signalName: "triggered"});
- verify(copyAction.enabled);
- copyAction.trigger();
+ verify(selectAction.enabled);
+ selectAction.trigger();
compare(triggerSpy.count, 1);
verify(!stopAction.enabled);
@@ -148,7 +125,7 @@ TestWebEngineView {
compare(enabledSpy.count, 0);
selectAllAction.trigger();
compare(triggerSpy.count, 0);
- compare(getTextSelection(), "");
+ compare(webEngineView.getTextSelection(), "");
// Focus content by focusing window from JavaScript. Edit actions should be enabled and functional.
webView.runJavaScript("window.focus();");
@@ -157,6 +134,7 @@ TestWebEngineView {
selectAllAction.trigger();
compare(triggerSpy.count, 1);
tryVerify(function() { return webView.getTextSelection() === "foo bar" });
+ webView.destroy();
}
function test_editActionsWithInitialFocus() {
@@ -180,6 +158,7 @@ TestWebEngineView {
selectAllAction.trigger();
compare(triggerSpy.count, 1);
tryVerify(function() { return webView.getTextSelection() === "foo bar" });
+ webView.destroy();
}
}
}