Test plan for relative mode.
authorJørgen P. Tjernø <jorgen@valvesoftware.com>
Wed, 24 Apr 2013 12:20:44 -0700
changeset 71050de0f099cfd6
parent 7104 4e4ca313000c
child 7106 31f8acac196b
Test plan for relative mode.
test/relative_mode.markdown
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/relative_mode.markdown	Wed Apr 24 12:20:44 2013 -0700
     1.3 @@ -0,0 +1,56 @@
     1.4 +Relative mode testing
     1.5 +=====================
     1.6 +
     1.7 +See test program at the bottom of this file.
     1.8 +
     1.9 +Initial tests:
    1.10 +
    1.11 + - When in relative mode, the mouse shouldn't be moveable outside of the window.
    1.12 + - When the cursor is outside the window when relative mode is enabled, mouse
    1.13 +   clicks should not go to whatever app was under the cursor previously.
    1.14 + - When alt/cmd-tabbing between a relative mode app and another app, clicks when
    1.15 +   in the relative mode app should also not go to whatever app was under the
    1.16 +   cursor previously.
    1.17 +
    1.18 +
    1.19 +Code
    1.20 +====
    1.21 +
    1.22 +    #include <SDL.h>
    1.23 +
    1.24 +    int PollEvents()
    1.25 +    {
    1.26 +        SDL_Event event;
    1.27 +        while (SDL_PollEvent(&event))
    1.28 +        {
    1.29 +            switch (event.type)
    1.30 +            {
    1.31 +                case SDL_QUIT:
    1.32 +                    return 1;
    1.33 +                default:
    1.34 +                    break;
    1.35 +            }
    1.36 +        }
    1.37 +
    1.38 +        return 0;
    1.39 +    }
    1.40 +
    1.41 +    int main(int argc, char *argv[])
    1.42 +    {
    1.43 +        SDL_Init(SDL_INIT_VIDEO);
    1.44 +
    1.45 +        SDL_Window *win = SDL_CreateWindow("Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, 0);
    1.46 +        SDL_SetRelativeMouseMode(SDL_TRUE);
    1.47 +
    1.48 +        while (1)
    1.49 +        {
    1.50 +            if (PollEvents())
    1.51 +                break;
    1.52 +        }
    1.53 +
    1.54 +        SDL_DestroyWindow(win);
    1.55 +
    1.56 +        SDL_Quit();
    1.57 +
    1.58 +        return 0;
    1.59 +    }