uitest: no clipboard on Android, and say which event got through

The two clipboard-image checks failed on the phone for a reason that is not
a defect: Android's clipboard carries text and URIs, not images -- setImage
does nothing there -- so they are skipped on Android with a note saying so,
instead of reporting a phone that is broken because it is a phone.

Open and Share still fail on the device, and now say how far they got:
neither the synthesized mouse click nor a touch tap leaves a line on the
card's buttons, while the same click reaches the header and the sidebar.
The engine's own path is fine (openArtifact() called directly answers as it
should), and the only way for the header to stay empty is openArtifact()'s
early return for a name it cannot resolve -- so what is left to look at is
the name the card hands over (the model's `rel`) and whether the card is
inside the visible part of the scrolled transcript at that moment, since
QQuickItem::isVisible() does not account for clipping.

Device run after this: 95 ok, 2 FAIL (was 17 before this session's fixes).
This commit is contained in:
WHC
2026-10-11 21:05:21 +08:00
parent 8e5bdd0c9d
commit a99f78134a
+24 -2
View File
@@ -438,13 +438,27 @@ int runUiTest(AgentCore &core, const QString &size) {
QStringLiteral("the card carries open and share"));
win->setProperty("statusText", QString());
clickMouse(win, QStringLiteral("fileOpen0"));
/* This button lives in the scrolling transcript, and on the NX789J the
* synthesized mouse click does not reach a button there -- the same click
* lands in the header and in the sidebar. What a phone has is a finger, so
* try that too, and say in the message which one it took: neither is a
* failure to hide. */
const bool byMouse = !win->property("statusText").toString().isEmpty();
if (!byMouse)
tapTouch(win, touch, QStringLiteral("fileOpen0"));
const QString opened = win->property("statusText").toString();
check(opened.startsWith(QLatin1String("opened ")),
QStringLiteral("Open hands the file to the system (%1)").arg(opened));
QStringLiteral("Open hands the file to the system (%1%2)")
.arg(opened, byMouse ? QString() : QStringLiteral(" after a tap")));
win->setProperty("statusText", QString());
clickMouse(win, QStringLiteral("fileShare0"));
const bool shareByMouse = !win->property("statusText").toString().isEmpty();
if (!shareByMouse)
tapTouch(win, touch, QStringLiteral("fileShare0"));
const QString shared = win->property("statusText").toString();
check(shared.contains(QLatin1String("report.md")),
QStringLiteral("Share names the file (%1)").arg(shared));
QStringLiteral("Share names the file (%1%2)")
.arg(shared, shareByMouse ? QString() : QStringLiteral(" after a tap")));
const QString refused =
core.openArtifact(QStringLiteral("art-not-one-of-ours.md"));
check(refused.contains(QLatin1String("no such file")),
@@ -877,6 +891,7 @@ int runUiTest(AgentCore &core, const QString &size) {
/* the paste path: an image on the clipboard becomes an attachment */
QGuiApplication *gui = qobject_cast<QGuiApplication *>(QCoreApplication::instance());
#if !defined(Q_OS_ANDROID)
if (gui && gui->clipboard()) {
QImage img(8, 8, QImage::Format_RGB32);
img.fill(Qt::red);
@@ -889,6 +904,13 @@ int runUiTest(AgentCore &core, const QString &size) {
} else {
check(false, QStringLiteral("there is a clipboard to paste from"));
}
#else
/* Android's clipboard carries text and URIs, not images: setting one there
* does nothing, and a phone that "fails" this is not a phone that is
* broken. The paste path itself is the same code the desktop runs. */
(void)gui;
note(QStringLiteral("clipboard image checks skipped (Android)"));
#endif
/* --- tool calls: two calls of one tool are two cards ------------------ */
const int rows0 = list ? list->property("count").toInt() : -1;