Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/tests/test_GuiManager.h
Show First 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | void test_hotkeysState() | ||||
hotkey_pressed_value = true; | hotkey_pressed_value = true; | ||||
Script::GetProperty(prq, global, "state_after", &js_hotkey_pressed_value); | Script::GetProperty(prq, global, "state_after", &js_hotkey_pressed_value); | ||||
Script::FromJSVal(prq, js_hotkey_pressed_value, hotkey_pressed_value); | Script::FromJSVal(prq, js_hotkey_pressed_value, hotkey_pressed_value); | ||||
TS_ASSERT_EQUALS(hotkey_pressed_value, false); | TS_ASSERT_EQUALS(hotkey_pressed_value, false); | ||||
UnloadHotkeys(); | UnloadHotkeys(); | ||||
} | } | ||||
void test_PageRegainedFocusEvent() | |||||
{ | |||||
// Load up a test page. | |||||
const ScriptInterface& scriptInterface = *(g_GUI->GetScriptInterface()); | |||||
ScriptRequest rq(scriptInterface); | |||||
JS::RootedValue val(rq.cx); | |||||
Script::CreateObject(rq, &val); | |||||
Script::StructuredClone data = Script::WriteStructuredClone(rq, JS::NullHandleValue); | |||||
g_GUI->PushPage(L"regainFocus/page_emptyPage.xml", data, JS::UndefinedHandleValue); | |||||
const ScriptInterface& pageScriptInterface = *(g_GUI->GetActiveGUI()->GetScriptInterface()); | |||||
ScriptRequest prq(pageScriptInterface); | |||||
JS::RootedValue global(prq.cx, prq.globalValue()); | |||||
g_GUI->PushPage(L"regainFocus/page_emptyPage.xml", data, JS::UndefinedHandleValue); | |||||
g_GUI->PopPage(data); | |||||
// This page instantly pushes an empty page with a callback that pops another page again. | |||||
g_GUI->PushPage(L"regainFocus/page_pushWithPopOnInit.xml", data, JS::UndefinedHandleValue); | |||||
// Pop the empty page and trigger the callback (effectively pops twice). | |||||
g_GUI->PopPage(data); | |||||
} | |||||
}; | }; |
Wildfire Games · Phabricator