diff options
Diffstat (limited to 'tests/common/test_surface_integration.c')
| -rw-r--r-- | tests/common/test_surface_integration.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/common/test_surface_integration.c b/tests/common/test_surface_integration.c index 2752208..7cc938a 100644 --- a/tests/common/test_surface_integration.c +++ b/tests/common/test_surface_integration.c @@ -1,6 +1,7 @@ #define _POSIX_C_SOURCE 200809L #include <yasl/yasl.h> #include <yasl/cpu.h> +#include <yasl/gl.h> #include "common/backend.h" #include <assert.h> #include <pthread.h> @@ -8,6 +9,9 @@ #include <string.h> #include <time.h> #include <stdio.h> +#if YASL_HAS_COCOA +void yasl_test_frame_tick(struct yasl_surface *surface); +#endif static void drain(void) { yasl_event e;int n=0; @@ -32,6 +36,15 @@ int main(int argc,char **argv) yasl_surface *s=yasl_surface_create("CPU contract",96,80,YASL_SURFACE_CPU); if(!s){const char *why;yasl_get_error(&why);fprintf(stderr,"surface: %s native=%d\n",why,yasl_get_native_error());return 1;} assert(yasl_surface_backend(s)==backend); + if(backend==YASL_BACKEND_COCOA) { + assert(!(yasl_surface_features(s)&YASL_CAP_OPENGL)); + assert(!yasl_gl_surface_create("unsupported GL",64,64,0,NULL,NULL)); + assert(yasl_get_error(NULL)==YASL_ERROR_UNSUPPORTED); + assert(!yasl_gl_make_current(NULL)); + assert(yasl_get_error(NULL)==YASL_ERROR_UNSUPPORTED); + assert(!yasl_gl_get_proc_address("glClear")); + assert(yasl_get_error(NULL)==YASL_ERROR_UNSUPPORTED); + } /* The first events report the window size, then ask for a frame. */ yasl_event e;int fw=0,fh=0;bool window=false; for(int i=0;i<1000;i++) { @@ -79,7 +92,12 @@ int main(int argc,char **argv) assert(yasl_wait_event(&e,0)==1&&e.type==YASL_EVENT_DROP&&e.drop.action==YASL_DROP_LEAVE); yasl_surface_set_refresh_callback(s,refresh,NULL); assert(yasl_cpu_present(s)); - drain();assert(refreshes>0); +#if YASL_HAS_COCOA + yasl_test_frame_tick(s); +#endif + uint64_t deadline=yasl_private_loop_now_ns()+3000000000ull; + while(!refreshes && yasl_private_loop_now_ns()<deadline)assert(yasl_wait_event(&e,20)>=0); + assert(refreshes>0); yasl_surface_set_refresh_callback(s,NULL,NULL); yasl_surface_destroy(s); assert(!yasl_set_backend(backend)); |
