Integrate AVA2 native shop and refine mobile controls and locale tooltips
This commit is contained in:
@@ -352,6 +352,7 @@ int main(int argc, char** argv)
|
||||
// by port. TChannelStatus::nPort is a short, so the fake server's ephemeral state port (> 32767)
|
||||
// never matches its own channel; offline the proof is the second channel (13002) it also lists.
|
||||
// Live the game port answers for the channels the db knows, the game port among them.
|
||||
if (!std::getenv("MT_TEST_PINCH"))
|
||||
{
|
||||
const int state_port = server ? server->StatePort() : game_port;
|
||||
const int key = server ? 2 : 1;
|
||||
@@ -501,6 +502,69 @@ int main(int argc, char** argv)
|
||||
return g_failures ? 1 : 0;
|
||||
}
|
||||
|
||||
if (mobile_test && std::getenv("MT_TEST_PINCH")) {
|
||||
CHECK(pump_until(5, [] { return py_true("not _stream.curtain.IsShow()"); }));
|
||||
CHECK(py("import mt_mobile_hud; _hud=mt_mobile_hud.g_hud\n"
|
||||
"assert not _hud.menuExpanded and all(not b.IsShow() for b in _hud.side)\n"
|
||||
"assert _hud.shop.IsShow() and _hud.more.IsShow()\n"
|
||||
"_hud.ToggleMore()\n"
|
||||
"assert _hud.menuExpanded and all(b.IsShow() for b in _hud.side)\n"
|
||||
"_hud.ToggleMore()\n"
|
||||
"assert not _hud.menuExpanded and all(not b.IsShow() for b in _hud.side)"));
|
||||
TouchController touch;
|
||||
touch.set_enabled(true);
|
||||
touch.update_screen_size(800, 600);
|
||||
// PORT scene pinch: start across both halves, spread closer, close farther.
|
||||
CHECK(!PythonBoot::IsPointInsideActiveUI(480, 240));
|
||||
CHECK(!PythonBoot::IsPointInsideActiveUI(320, 240));
|
||||
auto* camera = CCameraManager::Instance().GetCurrentCamera();
|
||||
const float originalDistance = camera->GetDistance();
|
||||
CHECK(touch.on_finger_down(201, 0.4f, 0.4f));
|
||||
CHECK(touch.on_finger_down(202, 0.6f, 0.4f));
|
||||
const float beforePinch = camera->GetDistance();
|
||||
touch.on_finger_motion(202, 0.7f, 0.4f);
|
||||
CHECK(camera->GetDistance() < beforePinch * 0.8f);
|
||||
const float closeDistance = camera->GetDistance();
|
||||
touch.on_finger_motion(202, 0.6f, 0.4f);
|
||||
CHECK(camera->GetDistance() > closeDistance * 1.2f);
|
||||
CHECK(std::abs(camera->GetDistance() - beforePinch) < 1.0f);
|
||||
touch.on_finger_up(201, 0.4f, 0.4f); // remaining finger becomes look, never tap
|
||||
touch.on_finger_motion(202, 0.62f, 0.4f);
|
||||
CHECK(std::abs(camera->GetDistance() - beforePinch) < 1.0f);
|
||||
touch.on_finger_up(202, 0.62f, 0.4f);
|
||||
touch.update();
|
||||
CHECK(std::abs(camera->GetDistance() - beforePinch) < 1.0f);
|
||||
|
||||
// Reverse ownership order; right scene finger plus left scene finger also pinches.
|
||||
touch.on_finger_down(203, 0.6f, 0.4f);
|
||||
touch.on_finger_down(204, 0.4f, 0.4f);
|
||||
touch.on_finger_motion(204, 0.3f, 0.4f);
|
||||
CHECK(camera->GetDistance() < beforePinch * 0.8f);
|
||||
touch.on_finger_up(204, 0.3f, 0.4f);
|
||||
touch.on_finger_up(203, 0.6f, 0.4f);
|
||||
camera->SetDistance(originalDistance);
|
||||
touch.on_finger_down(207, 0.6f, 0.4f);
|
||||
touch.on_finger_down(208, 0.4f, 0.4f);
|
||||
touch.cancel_gestures();
|
||||
touch.on_finger_motion(208, 0.2f, 0.4f);
|
||||
CHECK(std::abs(camera->GetDistance() - originalDistance) < 1.0f);
|
||||
|
||||
// A moving joystick is not stolen by a second thumb looking around.
|
||||
touch.on_finger_down(205, 0.3f, 0.45f);
|
||||
touch.on_finger_motion(205, 0.35f, 0.45f);
|
||||
touch.on_finger_down(206, 0.6f, 0.4f);
|
||||
touch.on_finger_motion(206, 0.7f, 0.4f);
|
||||
CHECK(std::abs(camera->GetDistance() - originalDistance) < 1.0f);
|
||||
touch.on_finger_up(205, 0.35f, 0.45f);
|
||||
touch.on_finger_up(206, 0.7f, 0.4f);
|
||||
CHECK(py("import app; app.Exit()"));
|
||||
pump_until(2, [] { return !PythonBoot::IsAppLooping(); });
|
||||
PythonBoot::Stop();
|
||||
if (server) server->Stop();
|
||||
std::printf("mobile scene pinch: %s\n", g_failures ? "FAILED" : "PASS");
|
||||
return g_failures ? 1 : 0;
|
||||
}
|
||||
|
||||
if (mobile_test) {
|
||||
// Input remains blocked by the original phase curtain until its fade finishes.
|
||||
CHECK(pump_until(5, [] { return py_true("not _stream.curtain.IsShow()"); }));
|
||||
@@ -511,7 +575,7 @@ int main(int argc, char** argv)
|
||||
"_hud.window.interface.wndInventory.Hide()"));
|
||||
CHECK(py_true("_hud.IsShow()"));
|
||||
CHECK(py_true("not ui.Window.IsShow(_hud.taskbar)"));
|
||||
CHECK(py_true("len(_hud.top) == 4 and len(_hud.side) == 3"));
|
||||
CHECK(py_true("len(_hud.top) == 4 and len(_hud.side) == 4"));
|
||||
CHECK(py_true("all(button.GetWidth() >= 48 for button in _hud.top + _hud.side)"));
|
||||
CHECK(py_true("_hud.status.values[0] == player.GetStatus(player.HP)"));
|
||||
CHECK(py_true("_hud.experience is _hud.taskbar.expGaugeBoard and _hud.experience.IsShow()"));
|
||||
@@ -1650,6 +1714,8 @@ int main(int argc, char** argv)
|
||||
CHECK(kept_origin);
|
||||
touch.on_finger_up(101, 0.325f, 0.46666667f);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
CHECK(py("import app\napp.Exit()"));
|
||||
|
||||
Reference in New Issue
Block a user