def print_gl_version(): backend = cgl_get_backend_name() Logger.info('GL: Backend used <{}>'.format(backend)) version = glGetString(GL_VERSION) vendor = glGetString(GL_VENDOR) renderer = glGetString(GL_RENDERER) Logger.info('GL: OpenGL version <{0}>'.format(version)) Logger.info('GL: OpenGL vendor <{0}>'.format(vendor)) Logger.info('GL: OpenGL renderer <{0}>'.format(renderer)) # Let the user know if his graphics hardware/drivers are too old major, minor = gl_get_version() Logger.info('GL: OpenGL parsed version: %d, %d' % (major, minor)) if ((major, minor) < MIN_REQUIRED_GL_VERSION and backend != "mock"): if hasattr(sys, "_kivy_opengl_required_func"): sys._kivy_opengl_required_func(major, minor, version, vendor, renderer) else: msg = ( 'GL: Minimum required OpenGL version (2.0) NOT found!\n\n' 'OpenGL version detected: {0}.{1}\n\n' 'Version: {2}\nVendor: {3}\nRenderer: {4}\n\n' 'Try upgrading your graphics drivers and/or your ' 'graphics hardware in case of problems.\n\n' 'The application will leave now.').format( major, minor, version, vendor, renderer) Logger.critical(msg) msgbox(msg) if platform != 'android': # XXX in the android emulator (latest version at 22 march 2013), # this call was segfaulting the gl stack. Logger.info('GL: Shading version <{0}>'.format(glGetString( GL_SHADING_LANGUAGE_VERSION))) Logger.info('GL: Texture max size <{0}>'.format(glGetIntegerv( GL_MAX_TEXTURE_SIZE)[0])) Logger.info('GL: Texture max units <{0}>'.format(glGetIntegerv( GL_MAX_TEXTURE_IMAGE_UNITS)[0]))
def print_gl_version(): backend = cgl_get_backend_name() Logger.info('GL: Backend used <{}>'.format(backend)) version = glGetString(GL_VERSION) vendor = glGetString(GL_VENDOR) renderer = glGetString(GL_RENDERER) Logger.info('GL: OpenGL version <{0}>'.format(version)) Logger.info('GL: OpenGL vendor <{0}>'.format(vendor)) Logger.info('GL: OpenGL renderer <{0}>'.format(renderer)) # Let the user know if his graphics hardware/drivers are too old major, minor = gl_get_version() Logger.info('GL: OpenGL parsed version: %d, %d' % (major, minor)) if ((major, minor) < MIN_REQUIRED_GL_VERSION and backend != "mock"): if hasattr(sys, "_kivy_opengl_required_func"): sys._kivy_opengl_required_func(major, minor, version, vendor, renderer) else: msg = ( 'GL: Minimum required OpenGL version (2.0) NOT found!\n\n' 'OpenGL version detected: {0}.{1}\n\n' 'Version: {2}\nVendor: {3}\nRenderer: {4}\n\n' 'Try upgrading your graphics drivers and/or your ' 'graphics hardware in case of problems.\n\n' 'The application will leave now.').format( major, minor, version, vendor, renderer) Logger.critical(msg) msgbox(msg) if platform != 'android': # XXX in the android emulator (latest version at 22 march 2013), # this call was segfaulting the gl stack. Logger.info('GL: Shading version <{0}>'.format( glGetString(GL_SHADING_LANGUAGE_VERSION))) Logger.info('GL: Texture max size <{0}>'.format( glGetIntegerv(GL_MAX_TEXTURE_SIZE)[0])) Logger.info('GL: Texture max units <{0}>'.format( glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS)[0]))
def inner_func(func): if 'mock' == cgl_get_backend_name(): return pytest.mark.skip( reason='Skipping because gl backend is set to mock')(func) if sys.version_info[0] < 3 or sys.version_info[1] <= 5: return pytest.mark.skip( reason='Skipping because graphics tests are not supported on ' 'py3.5, only on py3.6+')(func) if app_cls_func is not None: func = pytest.mark.parametrize("kivy_app", [ [app_cls_func], ], indirect=True)(func) if kivy_eventloop == 'asyncio': try: import pytest_asyncio return pytest.mark.asyncio(func) except ImportError: return pytest.mark.skip( reason='KIVY_EVENTLOOP == "asyncio" but ' '"pytest-asyncio" is not installed')(func) elif kivy_eventloop == 'trio': try: import trio from pytest_trio import trio_fixture func._force_trio_fixture = True return func except ImportError: return pytest.mark.skip(reason='KIVY_EVENTLOOP == "trio" but ' '"pytest-trio" is not installed')(func) else: return pytest.mark.skip( reason='KIVY_EVENTLOOP must be set to either of "asyncio" or ' '"trio" to run async tests')(func)
__all__ = ('GraphicUnitTest', 'UnitTestTouch', 'UTMotionEvent', 'async_run') import unittest import logging import pytest import sys from functools import partial import os import threading from kivy.graphics.cgl import cgl_get_backend_name from kivy.input.motionevent import MotionEvent log = logging.getLogger('unittest') _base = object if 'mock' != cgl_get_backend_name(): # check what the gl backend might be, we can't know for sure # what it'll be untill actually initialized by the window. _base = unittest.TestCase make_screenshots = os.environ.get('KIVY_UNITTEST_SCREENSHOTS') http_server = None http_server_ready = threading.Event() kivy_eventloop = os.environ.get('KIVY_EVENTLOOP', 'asyncio') def ensure_web_server(root=None): if http_server is not None: return True if not root:
320x240 pixels. ''' __all__ = ('GraphicUnitTest', 'UTMotionEvent') import unittest import logging import os import threading from kivy.graphics.cgl import cgl_get_backend_name from kivy.input.motionevent import MotionEvent log = logging.getLogger('unittest') _base = object if 'mock' != cgl_get_backend_name(): _base = unittest.TestCase make_screenshots = os.environ.get('KIVY_UNITTEST_SCREENSHOTS') http_server = None http_server_ready = threading.Event() def ensure_web_server(): if http_server is not None: return True def _start_web_server(): global http_server try: from SimpleHTTPServer import SimpleHTTPRequestHandler
def requires_graphics(func): if 'mock' == cgl_get_backend_name(): return pytest.mark.skip( reason='Skipping because gl backend is set to mock')(func) return func