def test_SDL_LogSetAllPriority(self): assert log.SDL_LogGetPriority(log.SDL_LOG_CATEGORY_APPLICATION) == \ log.SDL_LOG_PRIORITY_VERBOSE assert log.SDL_LogGetPriority(log.SDL_LOG_CATEGORY_SYSTEM) == \ log.SDL_LOG_PRIORITY_VERBOSE log.SDL_LogSetAllPriority(log.SDL_LOG_PRIORITY_WARN) assert log.SDL_LogGetPriority(log.SDL_LOG_CATEGORY_APPLICATION) == \ log.SDL_LOG_PRIORITY_WARN assert log.SDL_LogGetPriority(log.SDL_LOG_CATEGORY_SYSTEM) == \ log.SDL_LOG_PRIORITY_WARN # self.assertRaises(ValueError, log.SDL_LogSetAllPriority, 123) # self.assertRaises(TypeError, log.SDL_LogSetAllPriority, None) # self.assertRaises(TypeError, log.SDL_LogSetAllPriority, "test") # Reset to the setUp() value, so other tests do not fail log.SDL_LogSetAllPriority(log.SDL_LOG_PRIORITY_VERBOSE)
def setUp(self): self.logdata = [] def logfunc(userdata, category, priority, message): if userdata: userdata = ctypes.cast(userdata, ctypes.c_char_p).value self.logdata.append((userdata, category, priority, message,)) # bind to the TestCase, so we do not loose the reference. self.funcptr = log.SDL_LogOutputFunction(logfunc) log.SDL_LogSetOutputFunction(self.funcptr, None) log.SDL_LogSetAllPriority(log.SDL_LOG_PRIORITY_VERBOSE)
def test_SDL_LogResetPriorities(self): # set in setUp() defpriority = log.SDL_LOG_PRIORITY_VERBOSE categories = (log.SDL_LOG_CATEGORY_APPLICATION, log.SDL_LOG_CATEGORY_ERROR, log.SDL_LOG_CATEGORY_SYSTEM, log.SDL_LOG_CATEGORY_AUDIO, log.SDL_LOG_CATEGORY_VIDEO, log.SDL_LOG_CATEGORY_RENDER, log.SDL_LOG_CATEGORY_INPUT, log.SDL_LOG_CATEGORY_CUSTOM) for cat in categories: priority = log.SDL_LogGetPriority(cat) assert priority == defpriority log.SDL_LogResetPriorities() for cat in categories: priority = log.SDL_LogGetPriority(cat) assert priority != defpriority log.SDL_LogSetAllPriority(log.SDL_LOG_PRIORITY_VERBOSE)