gtktestutils.go RawHistoryFolder
1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8)
9
10var xTestInit func(int, []string, ...interface{})
11
12// This function is used to initialize a GTK test program.
13//
14// It will in turn call g_test_init() and gtk_init() to properly
15// initialize the testing framework and graphical toolkit. It’ll
16// also set the program’s locale to “C”. This is done to make test
17// program environments as deterministic as possible.
18//
19// Like gtk_init() and g_test_init(), any known arguments will be
20// processed and stripped from @argc and @argv.
21func TestInit(ArgcpVar int, ArgvpVar []string, varArgs ...interface{}) {
22
23 xTestInit(ArgcpVar, ArgvpVar, varArgs...)
24
25}
26
27var xTestListAllTypes func(*uint) uintptr
28
29// Return the type ids that have been registered after
30// calling gtk_test_register_all_types().
31func TestListAllTypes(NTypesVar *uint) uintptr {
32
33 cret := xTestListAllTypes(NTypesVar)
34 return cret
35}
36
37var xTestRegisterAllTypes func()
38
39// Force registration of all core GTK object types.
40//
41// This allows to refer to any of those object types via
42// g_type_from_name() after calling this function.
43func TestRegisterAllTypes() {
44
45 xTestRegisterAllTypes()
46
47}
48
49var xTestWidgetWaitForDraw func(uintptr)
50
51// Enters the main loop and waits for @widget to be “drawn”.
52//
53// In this context that means it waits for the frame clock of
54// @widget to have run a full styling, layout and drawing cycle.
55//
56// This function is intended to be used for syncing with actions that
57// depend on @widget relayouting or on interaction with the display
58// server.
59func TestWidgetWaitForDraw(WidgetVar *Widget) {
60
61 xTestWidgetWaitForDraw(WidgetVar.GoPointer())
62
63}
64
65func init() {
66 core.SetPackageName("GTK", "gtk4")
67 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
68 var libs []uintptr
69 for _, libPath := range core.GetPaths("GTK") {
70 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
71 if err != nil {
72 panic(err)
73 }
74 libs = append(libs, lib)
75 }
76
77 core.PuregoSafeRegister(&xTestInit, libs, "gtk_test_init")
78 core.PuregoSafeRegister(&xTestListAllTypes, libs, "gtk_test_list_all_types")
79 core.PuregoSafeRegister(&xTestRegisterAllTypes, libs, "gtk_test_register_all_types")
80 core.PuregoSafeRegister(&xTestWidgetWaitForDraw, libs, "gtk_test_widget_wait_for_draw")
81
82}