Added some test code.

This commit is contained in:
Markus Koch 2016-06-08 19:33:24 +02:00
parent 61eee61c51
commit ac2db1a174

View File

@ -1,7 +1,35 @@
#include <stdio.h>
#include "konaimage.h"
void cb_meta_changed(KonaImage* ki) {
kona_image_meta *meta;
meta = kona_image_get_meta_from_konaimage(ki);
printf("%s: META.ID = %d\n", __func__, meta->id);
}
int main(int argc, char *argv[])
{
printf("Hello world!\n");
KonaImage *ki;
ki = kona_image_new();
g_signal_connect(ki, "notify::meta", (GCallback)cb_meta_changed, NULL);
/* Testing callbacks */
GValue val = G_VALUE_INIT;
GValue sval = G_VALUE_INIT;
kona_image_meta meta;
meta.height = 100;
meta.width = 200;
meta.id = 42;
meta.image_url = "http://meow.cat/fullpic.png";
g_value_init(&sval, G_TYPE_STRING);
g_value_set_string(&sval, "/path/to/file.png");
g_object_set_property((GObject*) ki, "previewFile", &sval);
g_value_init(&val, G_TYPE_POINTER);
g_value_set_pointer(&val, (gpointer) &meta);
g_object_set_property((GObject*) ki, "meta", &val);
return 0;
}