diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/frameworks/7 gnome/resources/generated-main.c | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/frameworks/7 gnome/resources/generated-main.c')
-rw-r--r-- | meson/test cases/frameworks/7 gnome/resources/generated-main.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/meson/test cases/frameworks/7 gnome/resources/generated-main.c b/meson/test cases/frameworks/7 gnome/resources/generated-main.c new file mode 100644 index 000000000..fc9efbdae --- /dev/null +++ b/meson/test cases/frameworks/7 gnome/resources/generated-main.c @@ -0,0 +1,27 @@ +#include<stdio.h> +#include<string.h> +#include<gio/gio.h> +#include"generated-resources.h" + +#define EXPECTED "This is a generated resource.\n" + +int main(int argc, char **argv) { + GResource *res = generated_resources_get_resource(); + GError *err = NULL; + GBytes *data = g_resources_lookup_data("/com/example/myprog/res3.txt", + G_RESOURCE_LOOKUP_FLAGS_NONE, &err); + + if(data == NULL) { + fprintf(stderr, "Data lookup failed: %s\n", err->message); + return 1; + } + if(strcmp(g_bytes_get_data(data, NULL), EXPECTED) != 0) { + fprintf(stderr, "Resource contents are wrong:\n %s\n", + (const char*)g_bytes_get_data(data, NULL)); + return 1; + } + fprintf(stdout, "All ok.\n"); + g_bytes_unref(data); + g_resource_unref(res); + return 0; +} |