Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/tests/test_GuiManager.h
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | void test_hotkeysState() | ||||
InitInput(); | InitInput(); | ||||
in_push_priority_event(&hotkeyNotification); | in_push_priority_event(&hotkeyNotification); | ||||
SDL_Event_ ev; | SDL_Event_ ev; | ||||
while (in_poll_event(&ev)) | while (in_poll_event(&ev)) | ||||
in_dispatch_event(&ev); | in_dispatch_event(&ev); | ||||
const ScriptInterface& pageScriptInterface = *(g_GUI->GetActiveGUI()->GetScriptInterface()); | const ScriptInterface& pageScriptInterface = *(g_GUI->GetActiveGUI()->GetScriptInterface()); | ||||
ScriptInterface::Request prq(pageScriptInterface); | ScriptInterface::Request prq(pageScriptInterface); | ||||
JS::RootedValue global(prq.cx, pageScriptInterface.GetGlobalObject()); | JS::RootedValue global(prq.cx, prq.globalValue()); | ||||
// Ensure that our hotkey state was synchronised with the event itself. | // Ensure that our hotkey state was synchronised with the event itself. | ||||
bool hotkey_pressed_value = false; | bool hotkey_pressed_value = false; | ||||
JS::RootedValue js_hotkey_pressed_value(prq.cx); | JS::RootedValue js_hotkey_pressed_value(prq.cx); | ||||
pageScriptInterface.GetProperty(global, "state_before", &js_hotkey_pressed_value); | pageScriptInterface.GetProperty(global, "state_before", &js_hotkey_pressed_value); | ||||
ScriptInterface::FromJSVal(prq, js_hotkey_pressed_value, hotkey_pressed_value); | ScriptInterface::FromJSVal(prq, js_hotkey_pressed_value, hotkey_pressed_value); | ||||
TS_ASSERT_EQUALS(hotkey_pressed_value, true); | TS_ASSERT_EQUALS(hotkey_pressed_value, true); | ||||
Show All 39 Lines |
Wildfire Games · Phabricator