v0.9.1: the window opens on the session the engine already has open
A workspace is never empty on the second run: cst_agent_open() resumes the last session of the store, so the engine holds a transcript before the window exists. The window only filled its view on a session *switch*, and a start is not a switch -- the pane came up empty next to a sidebar pointing at the very session it belonged to (on the phone: "hello, 6 messages" highlighted, no transcript under it). - Main.qml: Component.onCompleted reloads the session list and replays the open session, the same call the sessionChanged handler makes. - AgentCore::switchSession(): a click on the row of the session that is already open emits sessionChanged instead of returning quietly, so the row redraws its transcript rather than being a dead spot. - --uitest: the window is now created over a seeded session (a fixture is written and switched to before the QML loads, which is what a restart looks like) and the check "the open session is on screen at startup" pins it -- it failed with 0 rows before the fix. Two qWaits in the settings-dialog section, whose clicks were racing the dialog's layout: the extra startup work made that visible (5 failures that had nothing to do with sessions). Verified: --uitest 79/79 (the new check among them), cst-app-selftest OK, and on the phone -- the APK rebuilt and installed, a restart of the app draws the whole stored session (messages, tool cards, thinking blocks, copy icons). Version 0.9.1. mode = coding
This commit is contained in:
+8
-1
@@ -191,7 +191,14 @@ ApplicationWindow {
|
|||||||
settings.syncPick()
|
settings.syncPick()
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: win.reloadSessions()
|
/* The engine opens the workspace's last session (cst_agent_open()), so the
|
||||||
|
* window is created with a transcript already in it: draw it, or the pane
|
||||||
|
* starts empty while the sidebar points at the very session it belongs to.
|
||||||
|
* A switch draws it the same way (the sessionChanged handler below). */
|
||||||
|
Component.onCompleted: {
|
||||||
|
win.reloadSessions()
|
||||||
|
win.replay()
|
||||||
|
}
|
||||||
|
|
||||||
// ---- the shell -------------------------------------------------------
|
// ---- the shell -------------------------------------------------------
|
||||||
header: ToolBar {
|
header: ToolBar {
|
||||||
|
|||||||
@@ -551,8 +551,13 @@ bool AgentCore::newSession() {
|
|||||||
bool AgentCore::switchSession(const QString &id) {
|
bool AgentCore::switchSession(const QString &id) {
|
||||||
if (!m_agent || m_running || id.isEmpty())
|
if (!m_agent || m_running || id.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
if (id == sessionId())
|
if (id == sessionId()) {
|
||||||
|
/* A click on the row of the session that is already open: nothing to
|
||||||
|
* switch, but the window still wants the transcript (the row is not a
|
||||||
|
* dead spot), and sessionChanged is what draws it. */
|
||||||
|
emit sessionChanged();
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if (cst_agent_switch_session(m_agent, id.toUtf8().constData()) != 0)
|
if (cst_agent_switch_session(m_agent, id.toUtf8().constData()) != 0)
|
||||||
return false;
|
return false;
|
||||||
afterSessionChange();
|
afterSessionChange();
|
||||||
|
|||||||
@@ -196,6 +196,15 @@ int runUiTest(AgentCore &core, const QString &size) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A workspace is never empty on a second run: the engine opens the last
|
||||||
|
* session of the store (cst_agent_open()), so the window is created with a
|
||||||
|
* transcript already in the engine. Put one there before the QML loads,
|
||||||
|
* which is exactly what a restart looks like. */
|
||||||
|
const QString resumed =
|
||||||
|
writeFixtureSession(core.workspace(), QStringLiteral("20260101-115959-on"));
|
||||||
|
check(!resumed.isEmpty() && core.switchSession(resumed),
|
||||||
|
QStringLiteral("the engine has a session open before the window exists"));
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
installThemeIcons(&engine); /* the window's icons, same as main() */
|
installThemeIcons(&engine); /* the window's icons, same as main() */
|
||||||
/* image://cstattach/: the session's stored images, pointed at the session
|
/* image://cstattach/: the session's stored images, pointed at the session
|
||||||
@@ -219,6 +228,15 @@ int runUiTest(AgentCore &core, const QString &size) {
|
|||||||
}
|
}
|
||||||
QTest::qWait(250);
|
QTest::qWait(250);
|
||||||
|
|
||||||
|
/* --- the window opens on the session the engine already had ----------- */
|
||||||
|
{
|
||||||
|
QQuickItem *tr = item(win, QStringLiteral("transcript"));
|
||||||
|
const int rows = tr ? tr->property("count").toInt() : -1;
|
||||||
|
check(rows == 5,
|
||||||
|
QStringLiteral("the open session is on screen at startup (%1 rows)")
|
||||||
|
.arg(rows));
|
||||||
|
}
|
||||||
|
|
||||||
QQuickItem *docked = item(win, QStringLiteral("dockedSidebar"));
|
QQuickItem *docked = item(win, QStringLiteral("dockedSidebar"));
|
||||||
QQuickItem *navButton = item(win, QStringLiteral("navButton"));
|
QQuickItem *navButton = item(win, QStringLiteral("navButton"));
|
||||||
QQuickItem *navPanel = item(win, QStringLiteral("navPanel"));
|
QQuickItem *navPanel = item(win, QStringLiteral("navPanel"));
|
||||||
@@ -464,8 +482,10 @@ int runUiTest(AgentCore &core, const QString &size) {
|
|||||||
/* The dialog drives the same two engine calls: open it, fold the advanced
|
/* The dialog drives the same two engine calls: open it, fold the advanced
|
||||||
* section out and put a provider in through the form. */
|
* section out and put a provider in through the form. */
|
||||||
clickMouse(win, QStringLiteral("settingsButton"));
|
clickMouse(win, QStringLiteral("settingsButton"));
|
||||||
|
QTest::qWait(150); /* the dialog's layout settles before it is clicked into */
|
||||||
if (panel && mfield) {
|
if (panel && mfield) {
|
||||||
clickMouse(win, QStringLiteral("settingsAdvanced"));
|
clickMouse(win, QStringLiteral("settingsAdvanced"));
|
||||||
|
QTest::qWait(150); /* the fold-out re-lays the body out */
|
||||||
QQuickItem *nfield = item(win, QStringLiteral("advName"));
|
QQuickItem *nfield = item(win, QStringLiteral("advName"));
|
||||||
QQuickItem *bfield = item(win, QStringLiteral("advBase"));
|
QQuickItem *bfield = item(win, QStringLiteral("advBase"));
|
||||||
check(nfield && nfield->isVisible(), QStringLiteral("Advanced options opens in the dialog"));
|
check(nfield && nfield->isVisible(), QStringLiteral("Advanced options opens in the dialog"));
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#define CST_VERSION_MAJOR 0
|
#define CST_VERSION_MAJOR 0
|
||||||
#define CST_VERSION_MINOR 9
|
#define CST_VERSION_MINOR 9
|
||||||
#define CST_VERSION_PATCH 0
|
#define CST_VERSION_PATCH 1
|
||||||
|
|
||||||
#define CST_VERSION_STR_(x) #x
|
#define CST_VERSION_STR_(x) #x
|
||||||
#define CST_VERSION_STR(x) CST_VERSION_STR_(x)
|
#define CST_VERSION_STR(x) CST_VERSION_STR_(x)
|
||||||
|
|||||||
Reference in New Issue
Block a user