Browse Source

fix tests

Andre Weissflog 1 year ago
parent
commit
24a0ea1a8c

+ 3 - 3
tests/compile/sokol_gfx_imgui.c

@@ -11,7 +11,7 @@
 #include "sokol_gfx_imgui.h"
 
 void use_gfx_imgui_impl(void) {
-    sg_imgui_t ctx = {0};
-    sg_imgui_init(&ctx, &(sg_imgui_desc_t){0});
-    sg_imgui_discard(&ctx);
+    sgimgui_t ctx = {0};
+    sgimgui_init(&ctx, &(sgimgui_desc_t){0});
+    sgimgui_discard(&ctx);
 }

+ 3 - 4
tests/compile/sokol_gfx_imgui.cc

@@ -6,8 +6,7 @@
 #include "sokol_gfx_imgui.h"
 
 void use_gfx_imgui_impl() {
-    sg_imgui_t ctx = {};
-    sg_imgui_init(&ctx, { });
-    sg_imgui_discard(&ctx);
+    sgimgui_t ctx = {};
+    sgimgui_init(&ctx, { });
+    sgimgui_discard(&ctx);
 }
-

+ 2 - 2
tests/compile/sokol_glue.c

@@ -4,6 +4,6 @@
 #include "sokol_glue.h"
 
 void use_glue_impl(void) {
-    const sg_context_desc ctx = sapp_sgcontext();
-    (void)ctx;
+    const sg_environment env = sglue_environment();
+    (void)env;
 }

+ 1 - 1
tests/compile/sokol_glue.cc

@@ -4,6 +4,6 @@
 #include "sokol_glue.h"
 
 void use_glue_impl() {
-    const sg_context_desc ctx = sapp_sgcontext();
+    const sg_environment ctx = sglue_environment();
     (void)ctx;
 }

+ 1 - 0
tests/functional/CMakeLists.txt

@@ -4,6 +4,7 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/assets/comsi.s3m DESTINATION ${CMAKE_BINAR
 file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/assets/comsi.s3m DESTINATION ${CMAKE_BINARY_DIR}/Debug)
 
 set(c_sources
+    sokol_log_test.c
     sokol_args_test.c
     sokol_audio_test.c
     sokol_debugtext_test.c

+ 12 - 3
tests/functional/sokol_debugtext_test.c

@@ -3,6 +3,7 @@
 //  For best results, run with ASAN and UBSAN.
 //------------------------------------------------------------------------------
 #include "sokol_gfx.h"
+#include "sokol_log.h"
 #define SOKOL_DEBUGTEXT_IMPL
 #include "sokol_debugtext.h"
 #include "utest.h"
@@ -11,8 +12,8 @@
 #define TFLT(f0,f1) {T(fabs((f0)-(f1))<=(0.000001));}
 
 static void init(void) {
-    sg_setup(&(sg_desc){0});
-    sdtx_setup(&(sdtx_desc_t){0});
+    sg_setup(&(sg_desc){ .logger = { .func = slog_func }});
+    sdtx_setup(&(sdtx_desc_t){ .logger = { .func = slog_func }});
 }
 
 static void init_with(const sdtx_desc_t* desc) {
@@ -401,7 +402,15 @@ UTEST(sokol_debugtext, rewind_after_draw) {
     T(_sdtx.cur_ctx->cur_font == 3);
     sdtx_printf("Hello World!\n");
     T(_sdtx.cur_ctx->vertices.next != 0);
-    sg_begin_default_pass(&(sg_pass_action){ 0 }, 256, 256);
+    sg_begin_pass(&(sg_pass){
+        .swapchain = {
+            .width = 256,
+            .height = 256,
+            .sample_count = 1,
+            .color_format = SG_PIXELFORMAT_RGBA8,
+            .depth_format = SG_PIXELFORMAT_DEPTH_STENCIL,
+        }
+    });
     sdtx_draw();
     sg_end_pass();
     sg_commit();

File diff suppressed because it is too large
+ 256 - 256
tests/functional/sokol_gfx_test.c


+ 2 - 0
tests/functional/sokol_log_test.c

@@ -0,0 +1,2 @@
+#define SOKOL_LOG_IMPL
+#include "sokol_log.h"

Some files were not shown because too many files changed in this diff