aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/sfwk-minimal.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/sfwk-minimal.c b/tests/sfwk-minimal.c
index e69de29..fe88174 100644
--- a/tests/sfwk-minimal.c
+++ b/tests/sfwk-minimal.c
@@ -0,0 +1,32 @@
+#include <saffron.h>
+#include <saffronwebkit.h>
+
+// store globals because yes
+SFWKContext* ctx;
+SFWKWebView* webview;
+
+bool hook_callback(SDL_Event* event) {
+ sfwk_process_event(ctx, webview, event);
+ return true;
+}
+
+int main() {
+ saffron_init();
+
+ ctx = sfwk_init();
+ if (!ctx) return 1;
+
+ SaffronWindow* window = saffron_window_new("SaffronWebKit Test", 1024, 768);
+ window->root->theme = SF_MACRO_DEFAULT_THEME;
+
+ SFWKWebView* webview = sfwk_webview_new(ctx, "https://arslaancodes.com", 900, 600);
+ saffron_widget_add_child(window->root, (SaffronWidget*)webview);
+
+ saffron_hook_sdl_all_events(window, hook_callback, 999);
+
+ saffron_window_main(window);
+
+ saffron_window_free(window);
+ saffron_quit();
+ return 0;
+}