mirror of
https://github.com/encounter/SDL.git
synced 2025-12-09 05:27:48 +00:00
WinRT: fixed bug whereby SDL would override an app's default orientation
WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
This commit is contained in:
1
visualtest/unittest/testquit.actions
Executable file
1
visualtest/unittest/testquit.actions
Executable file
@@ -0,0 +1 @@
|
||||
00:00:05 QUIT
|
||||
101
visualtest/unittest/testquit.c
Normal file
101
visualtest/unittest/testquit.c
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
Copyright (C) 2013 Apoorv Upreti <apoorvupreti@gmail.com>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely.
|
||||
*/
|
||||
/* Quits, hangs or crashes based on the command line options passed. */
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_test.h>
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
static int exit_code;
|
||||
static SDL_bool hang;
|
||||
static SDL_bool crash;
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
int i, done;
|
||||
SDL_Event event;
|
||||
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if(!state)
|
||||
return 1;
|
||||
|
||||
state->window_flags |= SDL_WINDOW_RESIZABLE;
|
||||
|
||||
exit_code = 0;
|
||||
hang = SDL_FALSE;
|
||||
crash = SDL_FALSE;
|
||||
|
||||
for(i = 1; i < argc; )
|
||||
{
|
||||
int consumed;
|
||||
consumed = SDLTest_CommonArg(state, i);
|
||||
if(consumed == 0)
|
||||
{
|
||||
consumed = -1;
|
||||
if(SDL_strcasecmp(argv[i], "--exit-code") == 0)
|
||||
{
|
||||
if(argv[i + 1])
|
||||
{
|
||||
exit_code = SDL_atoi(argv[i + 1]);
|
||||
consumed = 2;
|
||||
}
|
||||
}
|
||||
else if(SDL_strcasecmp(argv[i], "--hang") == 0)
|
||||
{
|
||||
hang = SDL_TRUE;
|
||||
consumed = 1;
|
||||
}
|
||||
else if(SDL_strcasecmp(argv[i], "--crash") == 0)
|
||||
{
|
||||
crash = SDL_TRUE;
|
||||
consumed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(consumed < 0)
|
||||
{
|
||||
SDLTest_Log("Usage: %s %s [--exit-code N] [--crash] [--hang]", argv[0], SDLTest_CommonUsage(state));
|
||||
SDLTest_CommonQuit(state);
|
||||
return 1;
|
||||
}
|
||||
i += consumed;
|
||||
}
|
||||
|
||||
if(!SDLTest_CommonInit(state))
|
||||
{
|
||||
SDLTest_CommonQuit(state);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* infinite loop to hang the process */
|
||||
while(hang)
|
||||
SDL_Delay(10);
|
||||
|
||||
/* dereference NULL pointer to crash process */
|
||||
if(crash)
|
||||
{
|
||||
int* p = NULL;
|
||||
*p = 5;
|
||||
}
|
||||
|
||||
/* event loop */
|
||||
done = 0;
|
||||
while(!done)
|
||||
{
|
||||
while(SDL_PollEvent(&event))
|
||||
SDLTest_CommonEvent(state, &event, &done);
|
||||
SDL_Delay(10);
|
||||
}
|
||||
|
||||
return exit_code;
|
||||
}
|
||||
5
visualtest/unittest/testquit.config
Executable file
5
visualtest/unittest/testquit.config
Executable file
@@ -0,0 +1,5 @@
|
||||
sutconfig=testquit.parameters
|
||||
action-config=testquit.actions
|
||||
variator=exhaustive
|
||||
sutapp=testquit
|
||||
timeout=00:00:10
|
||||
3
visualtest/unittest/testquit.parameters
Executable file
3
visualtest/unittest/testquit.parameters
Executable file
@@ -0,0 +1,3 @@
|
||||
--exit-code, integer, [-1 1], false, [] # The exit code returned by the executable
|
||||
--crash, boolean, [], false, [] # Crashes the SUT executable
|
||||
--hang, boolean, [], false, [] # Runs the SUT in the infinite loop and ignores all events
|
||||
Reference in New Issue
Block a user