MODULE test_version ; (* m2-GTK4 test - GTK reports version 4 and every binding module links. Widget construction is guarded by gtk_init_check() so the test also runs (and passes) headless, where only the version/link part runs. *) FROM Gtk IMPORT gtk_init_check, gtk_get_major_version, gtk_get_minor_version; FROM GtkApplication IMPORT gtk_application_new; FROM GtkWindow IMPORT gtk_window_new, gtk_window_destroy; FROM GtkLabel IMPORT gtk_label_new; FROM GtkButton IMPORT gtk_button_new_with_label; FROM GtkEnums IMPORT GtkAlignCenter, GtkVertical; FROM GLib IMPORT g_get_monotonic_time; FROM SYSTEM IMPORT ADDRESS; FROM libc IMPORT printf; VAR major, minor: CARDINAL; ok: BOOLEAN; rc: INTEGER; app, window, label, button: ADDRESS; BEGIN major := gtk_get_major_version(); minor := gtk_get_minor_version(); printf("GTK version: %d.%d\n", major, minor); ok := (major = 4); IF g_get_monotonic_time() = 0 THEN ok := FALSE END; IF (GtkAlignCenter # 3) OR (GtkVertical # 1) THEN ok := FALSE END; rc := gtk_init_check(); IF rc # 0 THEN app := gtk_application_new("org.example.m2gtk4.Version", 0); IF app = NIL THEN ok := FALSE END; window := gtk_window_new(); IF window = NIL THEN ok := FALSE END; label := gtk_label_new("x"); IF label = NIL THEN ok := FALSE END; button := gtk_button_new_with_label("x"); IF button = NIL THEN ok := FALSE END; gtk_window_destroy(window) ELSE printf("(no display: widget construction skipped)\n") END; IF ok THEN printf("test_version: PASS\n"); HALT(0) ELSE printf("test_version: FAIL\n"); HALT(1) END END test_version.