test: login_flow waits out the 300 ms inventory/safebox refresh before dragging
CPythonNetworkStream::GamePhase throttles RefreshInventory/RefreshSafebox to one call per 300 ms, so the bag slot could still be empty in the UI when the test clicked it right after player state changed (~1 in 3 runs failed). Also drops a leftover debug printf from CWindowManager::RunMouseMove. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
75ea2703c6
commit
7e385f827b
@@ -808,13 +808,6 @@ namespace UI
|
||||
|
||||
SetMousePosition(x, y);
|
||||
CWindow * pPointWindow = __PickWindow(m_lMouseX, m_lMouseY);
|
||||
if (x == 470 && y == 380) {
|
||||
std::printf(">>> C++ RunMouseMove(470, 380): m_lMouse=(%ld, %ld), pPointWindow=%s (type=%s, is_show=%d)\n",
|
||||
m_lMouseX, m_lMouseY,
|
||||
pPointWindow ? pPointWindow->GetName() : "NULL",
|
||||
pPointWindow ? typeid(*pPointWindow).name() : "none",
|
||||
pPointWindow ? pPointWindow->IsShow() : 0);
|
||||
}
|
||||
|
||||
if (g_bShowOverInWindowName)
|
||||
{
|
||||
|
||||
@@ -164,6 +164,13 @@ static bool pump_until(double seconds, const std::function<bool()>& done)
|
||||
|
||||
// Runs a fixed number of frames: the wait between a mouse move and its click must not depend on how
|
||||
// many frames a loaded machine fits into a wall-clock slice (ctest -j).
|
||||
// CPythonNetworkStream::GamePhase (40250) refreshes the inventory/safebox windows at most every 300 ms,
|
||||
// so a slot can still be empty in the UI after player/safebox state already holds the item.
|
||||
static void pump_ui_refresh()
|
||||
{
|
||||
pump_until(0.35, [] { return false; });
|
||||
}
|
||||
|
||||
static void pump_frames(int count)
|
||||
{
|
||||
for (int i = 0; i < count && PythonBoot::IsAppLooping(); ++i)
|
||||
@@ -881,6 +888,7 @@ int main(int argc, char** argv)
|
||||
return py_true(("__import__('player').GetItemIndex(0) == " + std::to_string(FakeLoginServer::kShopItemVnum) +
|
||||
" and __import__('player').GetElk() == " + bought_gold).c_str());
|
||||
}));
|
||||
pump_ui_refresh();
|
||||
click(1, bag0);
|
||||
CHECK(py_true("__import__('mouseModule').mouseController.isAttached()"));
|
||||
click(1, std::make_pair(shelf0.first + 32, shelf0.second));
|
||||
@@ -1067,6 +1075,7 @@ int main(int argc, char** argv)
|
||||
std::printf("port_login_flow_test: safebox slot 0 at %d %d, bag slot 0 at %d %d\n", safe0.first, safe0.second, bag0.first, bag0.second);
|
||||
|
||||
// Checkout: drag from safebox slot 0 to inventory slot 0
|
||||
pump_ui_refresh();
|
||||
click(1, safe0);
|
||||
CHECK(py_true("__import__('mouseModule').mouseController.isAttached()"));
|
||||
click(1, bag0);
|
||||
@@ -1077,6 +1086,7 @@ int main(int argc, char** argv)
|
||||
}));
|
||||
|
||||
// Checkin: drag from inventory slot 0 back to safebox slot 0
|
||||
pump_ui_refresh();
|
||||
click(1, bag0);
|
||||
CHECK(py_true("__import__('mouseModule').mouseController.isAttached()"));
|
||||
click(1, safe0);
|
||||
|
||||
Reference in New Issue
Block a user