test/testautomation_syswm.c
author Alex Baines <alex@abaines.me.uk>
Tue, 19 Aug 2014 23:31:50 +0100
changeset 9097 56d712662a82
parent 7191 75360622e65f
child 9219 c65108ddbeb0
permissions -rw-r--r--
Add a SDL_IM_INTERNAL_EDITING event to make IMs like iBus render editing text in its own UI instead of sending TEXTEDITING events.
This is useful for applications that handle TEXTINPUT events but not TEXTEDITING events.
aschiffler@6800
     1
/**
aschiffler@6800
     2
 * SysWM test suite
aschiffler@6800
     3
 */
aschiffler@6800
     4
aschiffler@6800
     5
#include <stdio.h>
aschiffler@6800
     6
aschiffler@6800
     7
#include "SDL.h"
aschiffler@6800
     8
#include "SDL_syswm.h"
aschiffler@6800
     9
#include "SDL_test.h"
aschiffler@6800
    10
aschiffler@6800
    11
/* Test case functions */
aschiffler@6800
    12
aschiffler@6800
    13
/**
aschiffler@6800
    14
 * @brief Call to SDL_GetWindowWMInfo
aschiffler@6800
    15
 */
aschiffler@6800
    16
int
aschiffler@6800
    17
syswm_getWindowWMInfo(void *arg)
aschiffler@6800
    18
{
aschiffler@6800
    19
  SDL_bool result;
slouken@7191
    20
  SDL_Window *window;
aschiffler@6800
    21
  SDL_SysWMinfo info;
slouken@7191
    22
aschiffler@6800
    23
  window = SDL_CreateWindow("", 0, 0, 0, 0, SDL_WINDOW_HIDDEN);
aschiffler@6800
    24
  SDLTest_AssertPass("Call to SDL_CreateWindow()");
aschiffler@6800
    25
  SDLTest_AssertCheck(window != NULL, "Check that value returned from SDL_CreateWindow is not NULL");
aschiffler@6800
    26
  if (window == NULL) {
aschiffler@6800
    27
     return TEST_ABORTED;
aschiffler@6800
    28
  }
slouken@7191
    29
aschiffler@6800
    30
  /* Initialize info structure with SDL version info */
slouken@7191
    31
  SDL_VERSION(&info.version);
slouken@7191
    32
aschiffler@6800
    33
  /* Make call */
aschiffler@6800
    34
  result = SDL_GetWindowWMInfo(window, &info);
aschiffler@6800
    35
  SDLTest_AssertPass("Call to SDL_GetWindowWMInfo");
aschiffler@6800
    36
  SDLTest_Log((result == SDL_TRUE) ? "Got window information" : "Couldn't get window information");
slouken@7191
    37
aschiffler@6800
    38
  SDL_DestroyWindow(window);
aschiffler@6800
    39
  SDLTest_AssertPass("Call to SDL_DestroyWindow()");
slouken@7191
    40
aschiffler@6800
    41
  return TEST_COMPLETED;
aschiffler@6800
    42
}
aschiffler@6800
    43
aschiffler@6800
    44
/* ================= Test References ================== */
aschiffler@6800
    45
aschiffler@6800
    46
/* SysWM test cases */
aschiffler@6800
    47
static const SDLTest_TestCaseReference syswmTest1 =
slouken@7191
    48
        { (SDLTest_TestCaseFp)syswm_getWindowWMInfo, "syswm_getWindowWMInfo", "Call to SDL_GetWindowWMInfo", TEST_ENABLED };
aschiffler@6800
    49
aschiffler@6800
    50
/* Sequence of SysWM test cases */
aschiffler@6800
    51
static const SDLTest_TestCaseReference *syswmTests[] =  {
slouken@7191
    52
    &syswmTest1, NULL
aschiffler@6800
    53
};
aschiffler@6800
    54
aschiffler@6800
    55
/* SysWM test suite (global) */
aschiffler@6800
    56
SDLTest_TestSuiteReference syswmTestSuite = {
slouken@7191
    57
    "SysWM",
slouken@7191
    58
    NULL,
slouken@7191
    59
    syswmTests,
slouken@7191
    60
    NULL
aschiffler@6800
    61
};