void Test_GetKeyState() { HWND hwnd; MSG msg; hwnd = CreateTestWindow(); hKbdHook = SetWindowsHookEx(WH_KEYBOARD, KeyboardProc, GetModuleHandleA( NULL ), 0); hKbdLLHook = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, GetModuleHandleA( NULL ), 0); ok(hKbdHook!=NULL," \n"); ok(hKbdLLHook!=NULL," \n"); keybd_event(VK_LMENU, 0, 0,0); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); keybd_event(VK_LMENU, 0, KEYEVENTF_KEYUP,0); //fixme this hangs the test //while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE|PM_NOYIELD )) DispatchMessageA( &msg ); DestroyWindow(hwnd); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); UnhookWindowsHookEx (hKbdHook); UnhookWindowsHookEx (hKbdLLHook); }
bool ExpandoApp::OnInit(){ #if DBG_CONSOLE AllocConsole(); freopen("CONIN$", "rb", stdin); freopen("CONOUT$", "wb", stdout); freopen("CONOUT$", "wb", stderr); #endif CreateTestWindow(this, L"Test"); return true; }
void OnButton(wxCommandEvent &event){ int id = event.GetId(); long flags = 0; if(id == ID_GRTF){ wxString rtf = textctrl->GetRTF(); printf("%s\n\n", rtf.ToAscii()); output->SetValue(converter.Convert(rtf, encoder)); input->SetValue(rtf); }else if(id == ID_GVAL){ wxString text = textctrl->GetValue(); wxTextAttr style; textctrl->GetStyle(0, style); output->SetValue(converter.Convert(text, encoder, L"plaintext", &style)); input->SetValue(text); }else if(id == ID_SEPR){ printf("\n========\n\n"); }else if(id == ID_RSIZ){ #if USEEXPANDO textctrl->SetMinHeight(wxGetNumberFromUser(_T("Input Height:"), _T(""), _T("Set Input Height"), textctrl->GetMinHeight())); printf("%d\n", textctrl->GetMinSize().GetHeight()); #endif //USEEXPANDO }else if(id == ID_RTFG){ if(rtfTemp.IsEmpty()){ rtfTemp = textctrl->GetRTF(); textctrl->Clear(); }else{ textctrl->SetRTF(rtfTemp); rtfTemp.Clear(); } }else if(id == ID_SETV){ wxString v = wxGetTextFromUser(L"Text?"); textctrl->SetValue(v); }else if(id == ID_LINK){ wxString rtf(L"{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fswiss\\fcharset0 Comic Sans MS;}{\\f1\\fnil\\fcharset0 MS Shell Dlg 2;}}\r\n{\\colortbl ;\\red255\\green0\\blue255;\\red0\\green255\\blue255;}\r\n{\\*\\generator Msftedit 5.41.21.2509;}\\viewkind4\\uc1\\pard\\cf1\\highlight2\\ul\\b\\i\\f0\\fs44 test 123\\cf0\\highlight0\\ulnone\\b0\\i0\\f1\\fs17\\par\\par I use {\\hl {\\hlloc http://www.digsby.com/?utm_source=aim&utm_medium=aim&utm_campaign=aimprofilelink } {\\hlfr digsby} }\\par\r\n}"); //printf("%s\n\n", rtf.ToAscii()); output->SetValue(converter.Convert(rtf, encoder)); input->SetValue(rtf); }else if(id == ID_NEW){ CreateTestWindow((ExpandoApp*)wxTheApp, L"Spawn"); } textctrl->SetFocus(); }
int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdLine, int numCmd) { HWND hwnd = NULL; base_set_log_handler(do_log); try { hwnd = CreateTestWindow(instance); if (!hwnd) throw "Couldn't create main window"; /* ------------------------------------------------------ */ /* create OBS */ CreateOBS(hwnd); /* ------------------------------------------------------ */ /* load module */ if (obs_load_module("test-input") != 0) throw "Couldn't load module"; /* ------------------------------------------------------ */ /* create source */ SourceContext source = obs_source_create(SOURCE_INPUT, "random", "some randon source", NULL); if (!source) throw "Couldn't create random test source"; /* ------------------------------------------------------ */ /* create filter */ SourceContext filter = obs_source_create(SOURCE_FILTER, "test", "a nice little green filter", NULL); if (!filter) throw "Couldn't create test filter"; obs_source_filter_add(source, filter); /* ------------------------------------------------------ */ /* create scene and add source to scene (twice) */ SceneContext scene = obs_scene_create("test scene"); if (!scene) throw "Couldn't create scene"; AddTestItems(scene, source); /* ------------------------------------------------------ */ /* set the scene as the primary draw source and go */ obs_set_output_source(0, source); MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } } catch (char *error) { MessageBoxA(NULL, error, NULL, 0); } obs_shutdown(); blog(LOG_INFO, "Number of memory leaks: %llu", bnum_allocs()); DestroyWindow(hwnd); return 0; }
INT Test_NtUserSystemParametersInfo(PTESTINFO pti) { HWND hWnd; hWnd = CreateTestWindow(); ASSERT(hWnd); Test_NtUserSystemParametersInfo_Params(pti); Test_NtUserSystemParametersInfo_fWinIni(pti); Test_NtUserSystemParametersInfo_Winsta(pti); Test_SPI_SETBEEP(pti); Test_SPI_SETMOUSE(pti); Test_SPI_SETBORDER(pti); // Test_SPI_SETKEYBOARDSPEED(pti); // Test_SPI_LANGDRIVER(pti); // Test_SPI_ICONHORIZONTALSPACING(pti); // Test_SPI_SETSCREENSAVETIMEOUT(pti); // Test_SPI_SETSCREENSAVEACTIVE(pti); // Test_SPI_SETGRIDGRANULARITY(pti); Test_SPI_SETDESKWALLPAPER(pti); // Test_SPI_SETDESKPATTERN(pti); // Test_SPI_SETKEYBOARDDELAY(pti); // Test_SPI_ICONVERTICALSPACING(pti); // Test_SPI_SETICONTITLEWRAP(pti); // Test_SPI_SETMENUDROPALIGNMENT(pti); // Test_SPI_SETDOUBLECLKWIDTH(pti); // Test_SPI_SETDOUBLECLKHEIGHT(pti); // Test_SPI_SETDOUBLECLICKTIME(pti); Test_SPI_SETMOUSEBUTTONSWAP(pti); Test_SPI_SETICONTITLELOGFONT(pti); Test_SPI_SETFASTTASKSWITCH(pti); Test_SPI_SETDRAGFULLWINDOWS(pti); Test_SPI_SETNONCLIENTMETRICS(pti); Test_SPI_SETMINIMIZEDMETRICS(pti); Test_SPI_SETICONMETRICS(pti); Test_SPI_SETWORKAREA(pti); Test_SPI_SETPENWINDOWS(pti); Test_SPI_SETFILTERKEYS(pti); Test_SPI_SETTOGGLEKEYS(pti); Test_SPI_SETMOUSEKEYS(pti); Test_SPI_SETSHOWSOUNDS(pti); Test_SPI_SETSTICKYKEYS(pti); Test_SPI_SETACCESSTIMEOUT(pti); Test_SPI_SETSERIALKEYS(pti); Test_SPI_SETSOUNDSENTRY(pti); Test_SPI_SETHIGHCONTRAST(pti); Test_SPI_SETKEYBOARDPREF(pti); // Test_SPI_SETSCREENREADER(pti); /// Test_SPI_SETANIMATION(pti); // Test_SPI_SETFONTSMOOTHING(pti); // Test_SPI_SETDRAGWIDTH(pti); // Test_SPI_SETDRAGHEIGHT(pti); // Test_SPI_SETHANDHELD(pti); // Test_SPI_SETLOWPOWERTIMEOUT(pti); // Test_SPI_SETPOWEROFFTIMEOUT(pti); // Test_SPI_SETLOWPOWERACTIVE(pti); // Test_SPI_SETPOWEROFFACTIVE(pti); // Test_SPI_SETCURSORS(pti); // Test_SPI_SETICONS(pti); // Test_SPI_SETDEFAULTINPUTLANG(pti); // Test_SPI_SETLANGTOGGLE(pti); // Test_SPI_GETWINDOWSEXTENSION(pti); // Test_SPI_SETMOUSETRAILS(pti); // Test_SPI_SETSNAPTODEFBUTTON(pti); // Test_SPI_GETSCREENSAVERRUNNING(pti); // Test_SPI_SETMOUSEHOVERWIDTH(pti); // Test_SPI_SETMOUSEHOVERHEIGHT(pti); // Test_SPI_SETMOUSEHOVERTIME(pti); // Test_SPI_SETWHEELSCROLLLINES(pti); // Test_SPI_SETMENUSHOWDELAY(pti); // Test_SPI_SETWHEELSCROLLCHARS(pti); // Test_SPI_SETSHOWIMEUI(pti); // Test_SPI_SETMOUSESPEED(pti); // Test_SPI_GETSCREENSAVERRUNNING(pti); // Test_SPI_SETAUDIODESCRIPTION(pti); // Test_SPI_SETSCREENSAVESECURE(pti); // Test_SPI_SETACTIVEWINDOWTRACKING(pti); Test_SPI_SETMENUANIMATION(pti); // Test_SPI_SETCOMBOBOXANIMATION(pti); // Test_SPI_SETLISTBOXSMOOTHSCROLLING(pti); // Test_SPI_SETGRADIENTCAPTIONS(pti); Test_SPI_SETKEYBOARDCUES(pti); // Test_SPI_SETACTIVEWNDTRKZORDER(pti); // Test_SPI_SETHOTTRACKING(pti); // Test_SPI_SETMENUFADE(pti); // Test_SPI_SETSELECTIONFADE(pti); // Test_SPI_SETTOOLTIPANIMATION(pti); // Test_SPI_SETTOOLTIPFADE(pti); // Test_SPI_SETCURSORSHADOW(pti); // Test_SPI_SETMOUSESONAR(pti); Test_SPI_SETMOUSECLICKLOCK(pti); // Test_SPI_SETMOUSEVANISH(pti); // Test_SPI_SETFLATMENU(pti); // Test_SPI_SETDROPSHADOW(pti); // Test_SPI_SETBLOCKSENDINPUTRESETS(pti); // Test_SPI_GETSETUIEFFECTS(pti); // Test_SPI_SETDISABLEOVERLAPPEDCONTENT(pti); // Test_SPI_SETCLIENTAREAANIMATION(pti); // Test_SPI_SETCLEARTYPE(pti); // Test_SPI_SETSPEECHRECOGNITION(pti); // Test_SPI_SETFOREGROUNDLOCKTIMEOUT(pti); // Test_SPI_SETACTIVEWNDTRKTIMEOUT(pti); // Test_SPI_SETFOREGROUNDFLASHCOUNT(pti); // Test_SPI_SETCARETWIDTH(pti); // Test_SPI_SETMOUSECLICKLOCKTIME(pti); // Test_SPI_SETFONTSMOOTHINGTYPE(pti); // Test_SPI_SETFONTSMOOTHINGCONTRAST(pti); // Test_SPI_SETFOCUSBORDERWIDTH(pti); // Test_SPI_SETFOCUSBORDERHEIGHT(pti); // Test_SPI_SETFONTSMOOTHINGORIENTATION(pti); DestroyWindow(hWnd); return APISTATUS_NORMAL; }
void Test_SetCursorPos() { HWND hwnd; MSG msg; int i; memset(results, sizeof(results), 0); hMouseHookLL = SetWindowsHookEx(WH_MOUSE_LL, MouseLLHookProc, GetModuleHandleA( NULL ), 0); hMouseHook = SetWindowsHookExW(WH_MOUSE, MouseHookProc, GetModuleHandleW( NULL ), GetCurrentThreadId()); ok(hMouseHook!=NULL,"failed to set hook\n"); ok(hMouseHookLL!=NULL,"failed to set hook\n"); test_no = 0; SetCursorPos(1,1); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); test_no = 1; mouse_event(MOUSEEVENTF_MOVE, 2,2, 0,0); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); hwnd = CreateTestWindow(); SetCapture(hwnd); test_no = 2; SetCursorPos(50,50); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); test_no = 3; mouse_event(MOUSEEVENTF_MOVE, 100,100, 0,0); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); test_no = 4; SetCursorPos(50,50); SetCursorPos(60,60); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); test_no = 5; SetCursorPos(50,50); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); SetCursorPos(60,60); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); test_no = 6; mouse_event(MOUSEEVENTF_MOVE, 50,50, 0,0); mouse_event(MOUSEEVENTF_MOVE, 60,60, 0,0); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); test_no = 7; mouse_event(MOUSEEVENTF_MOVE, 50,50, 0,0); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); mouse_event(MOUSEEVENTF_MOVE, 60,60, 0,0); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); for(i = 0; i< 8; i++) { #define TEST(s,x,y) ok(y == x, "%d: %s called %d times instead of %d\n",i,s, y,x); TEST("WH_MOUSE_LL", info[i].ll_hook_called, results[i].ll_hook_called); /* WH_MOUSE results vary greatly among windows versions */ //TEST("WH_MOUSE", info[i].hook_called, results[i].hook_called); TEST("WM_MOUSEMOVE", info[i].mouse_move_called, results[i].mouse_move_called); } SetCapture(NULL); DestroyWindow(hwnd); UnhookWindowsHookEx (hMouseHook); UnhookWindowsHookEx (hMouseHookLL); }