diff options
| author | Axel Spoerl <axel.spoerl@qt.io> | 2023-04-11 13:36:47 +0200 |
|---|---|---|
| committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-04-12 14:03:19 +0000 |
| commit | 9ed18f8c61a34553b61c55d70ca2bd9f39bccfac (patch) | |
| tree | 356b5de0019feb93d80c0589a4f924a015e34b12 /src/quicktestutils/qml | |
| parent | 9314538e6e609ccf08d27765058228076af5099f (diff) | |
tst_QQuickTextInput: Stabilize clipboard related functions on XCB
Even if compiled with QT_CONFIG(clipboard), a functional clipboard
might not be available on XCB (e.g. due to restrictions on CI VMs).
This patch adds an explicit test for XCB to platformquirks_p.h.
It skips the test functions canPaste() and canPasteEmpty().
As a drive-by it constifies local variables in canPaste() and
middleClickPaste() and unifies the skip message.
It also removes the BLACKLIST entries for clipboard-related tests on
opensuse.
Fixes: QTBUG-95940
Change-Id: If6da9b589e98c1f63435f3d444567ce310ddee8a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c6fdaa5ab049c7baf19a912118dd55b96ef540d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quicktestutils/qml')
| -rw-r--r-- | src/quicktestutils/qml/platformquirks_p.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/quicktestutils/qml/platformquirks_p.h b/src/quicktestutils/qml/platformquirks_p.h index beaf664f5d..0170d054e0 100644 --- a/src/quicktestutils/qml/platformquirks_p.h +++ b/src/quicktestutils/qml/platformquirks_p.h @@ -36,7 +36,19 @@ struct PlatformQuirks CFRelease(pasteboard); return status == noErr; #else - return true; + if (QGuiApplication::platformName() != QLatin1StringView("xcb")) + return true; + + // On XCB a clipboard may be dysfunctional due to platform restrictions + QClipboard *clipBoard = QGuiApplication::clipboard(); + if (!clipBoard) + return false; + const QString &oldText = clipBoard->text(); + QScopeGuard guard([&](){ clipBoard->setText(oldText); }); + const QLatin1StringView prefix("Something to prefix "); + const QString newText = prefix + oldText; + clipBoard->setText(newText); + return QTest::qWaitFor([&](){ return clipBoard->text() == newText; }); #endif } }; |
