mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
Merge branch 'matthiasc/for-main' into 'main'
Add a README to examples/hello See merge request GNOME/gtk!5967
This commit is contained in:
commit
951b448e90
@ -24,7 +24,7 @@ stages:
|
||||
variables:
|
||||
COMMON_MESON_FLAGS: "-Dwerror=true -Dcairo:werror=false -Dgi-docgen:werror=false -Dgraphene:werror=false -Dlibepoxy:werror=false -Dlibsass:werror=false -Dpango:werror=false -Dsassc:werror=false -Dgdk-pixbuf:werror=false -Dglib:werror=false -Dlibcloudproviders:werror=false -Dlibpng:werror=false -Dlibtiff:werror=false -Dsysprof:werror=false -Dwayland-protocols:werror=false -Dharfbuzz:werror=false -Dfreetype2:werror=false -Dfontconfig:werror=false -Dfribidi:werror=false -Dlibffi:werror=false -Dlibjpeg-turbo:werror=false -Dmutest:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false"
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Ddemos=false -Dbuild-examples=false -Dbuild-tests=false -Dbuild-testsuite=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-demos=false -Dbuild-examples=false -Dbuild-tests=false -Dbuild-testsuite=true"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v46"
|
||||
|
||||
|
@ -288,7 +288,7 @@ support.
|
||||
If you want to run the testsuite to ensure that your GTK build
|
||||
works, you should enable it with this option.
|
||||
|
||||
### `build-tests`, `build-examples`, `demos`
|
||||
### `build-tests`, `build-examples`, `build-demos`
|
||||
|
||||
By default, GTK will build quite a few tests, examples and demos.
|
||||
While these are useful on a developer system, they are not
|
||||
|
7
examples/hello/README.md
Normal file
7
examples/hello/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
A trivial example
|
||||
=================
|
||||
|
||||
This is a very minimal example of an app that can be built against GTK.
|
||||
We use this in CI to test that building against the installed GTK works.
|
||||
|
||||
That is why there is a standalone meson.build in this subdirectory.
|
@ -711,6 +711,8 @@ gdk_texture_set_diff (GdkTexture *self,
|
||||
GdkTexture *previous,
|
||||
cairo_region_t *diff)
|
||||
{
|
||||
g_assert (self->diff_to_previous == NULL);
|
||||
|
||||
self->previous_texture = previous;
|
||||
self->diff_to_previous = diff;
|
||||
g_atomic_pointer_set (&previous->next_texture, self);
|
||||
|
BIN
testsuite/gdk/bad-image-data/CVE-2017-2862.jpg
Normal file
BIN
testsuite/gdk/bad-image-data/CVE-2017-2862.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 132 B |
BIN
testsuite/gdk/bad-image-data/bug780269.tif
Normal file
BIN
testsuite/gdk/bad-image-data/bug780269.tif
Normal file
Binary file not shown.
BIN
testsuite/gdk/bad-image-data/bug784903-overflow-dimensions.tiff
Normal file
BIN
testsuite/gdk/bad-image-data/bug784903-overflow-dimensions.tiff
Normal file
Binary file not shown.
BIN
testsuite/gdk/bad-image-data/bug793470-crasher.png
Normal file
BIN
testsuite/gdk/bad-image-data/bug793470-crasher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 95 B |
5
testsuite/gdk/bad-image-data/invalid.1.png
Normal file
5
testsuite/gdk/bad-image-data/invalid.1.png
Normal file
@ -0,0 +1,5 @@
|
||||
‰PNG
|
||||
|
||||
|
||||
y1 á§Oµ¼-¶>’ØGi›õ¢%|…ºà7Wm3‘hü>4½D‚}<7D>KDýâcþ “9à,üaÞ¦âTYzQ «š1A0Å
|
||||
ƒ…ÒLR&*Ð3r[W‹Z¨Ò¢Qí¼j,Aÿ ÙŒ<C399>‹þ‘š"ÚÂX|m
|
After Width: | Height: | Size: 132 B |
BIN
testsuite/gdk/bad-image-data/invalid.2.png
Normal file
BIN
testsuite/gdk/bad-image-data/invalid.2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
testsuite/gdk/bad-image-data/invalid.3.png
Normal file
BIN
testsuite/gdk/bad-image-data/invalid.3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 B |
747
testsuite/gdk/bad-image-data/invalid.4.png
Normal file
747
testsuite/gdk/bad-image-data/invalid.4.png
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 282 KiB |
@ -47,6 +47,7 @@ test_load_image (gconstpointer data)
|
||||
bytes = g_file_load_bytes (file, NULL, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
/* use the internal api, we want to avoid pixbuf fallback here */
|
||||
if (g_str_has_suffix (filename, ".png"))
|
||||
texture = gdk_load_png (bytes, &error);
|
||||
else if (g_str_has_suffix (filename, ".tiff"))
|
||||
@ -72,19 +73,18 @@ test_save_image (gconstpointer test_data)
|
||||
{
|
||||
const char *filename = test_data;
|
||||
char *path;
|
||||
GFile *file;
|
||||
GdkTexture *texture;
|
||||
GFile *file2;
|
||||
GFile *file;
|
||||
GdkTexture *texture2;
|
||||
GError *error = NULL;
|
||||
GBytes *bytes = NULL;
|
||||
GIOStream *stream;
|
||||
|
||||
path = g_test_build_filename (G_TEST_DIST, "image-data", filename, NULL);
|
||||
file = g_file_new_for_path (path);
|
||||
texture = gdk_texture_new_from_file (file, &error);
|
||||
texture = gdk_texture_new_from_filename (path, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
/* Test the internal apis here */
|
||||
if (g_str_has_suffix (filename, ".png"))
|
||||
bytes = gdk_save_png (texture);
|
||||
else if (g_str_has_suffix (filename, ".tiff"))
|
||||
@ -94,16 +94,16 @@ test_save_image (gconstpointer test_data)
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
file2 = g_file_new_tmp ("imageXXXXXX", (GFileIOStream **)&stream, NULL);
|
||||
file = g_file_new_tmp ("imageXXXXXX", (GFileIOStream **)&stream, NULL);
|
||||
g_object_unref (stream);
|
||||
g_file_replace_contents (file2,
|
||||
g_file_replace_contents (file,
|
||||
g_bytes_get_data (bytes, NULL),
|
||||
g_bytes_get_size (bytes),
|
||||
NULL, FALSE, 0,
|
||||
NULL, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
texture2 = gdk_texture_new_from_file (file2, &error);
|
||||
texture2 = gdk_texture_new_from_file (file, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
|
||||
@ -112,30 +112,66 @@ test_save_image (gconstpointer test_data)
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
g_object_unref (texture2);
|
||||
g_object_unref (file2);
|
||||
g_object_unref (texture);
|
||||
g_object_unref (file);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
static void
|
||||
test_load_image_fail (gconstpointer data)
|
||||
{
|
||||
const char *filename = data;
|
||||
char *path;
|
||||
GdkTexture *texture;
|
||||
GError *error = NULL;
|
||||
|
||||
path = g_test_build_filename (G_TEST_DIST, "bad-image-data", filename, NULL);
|
||||
texture = gdk_texture_new_from_filename (path, &error);
|
||||
g_assert_nonnull (error);
|
||||
g_assert_null (texture);
|
||||
|
||||
g_error_free (error);
|
||||
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
char *path;
|
||||
GDir *dir;
|
||||
GError *error = NULL;
|
||||
const char *name;
|
||||
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_data_func ("/image/load/png", "image.png", test_load_image);
|
||||
g_test_add_data_func ("/image/load/png2", "image-gray.png", test_load_image);
|
||||
g_test_add_data_func ("/image/load/png3", "image-palette.png", test_load_image);
|
||||
g_test_add_data_func ("/image/load/tiff", "image.tiff", test_load_image);
|
||||
g_test_add_data_func ("/image/load/tiff2", "image-unassoc.tiff", test_load_image);
|
||||
g_test_add_data_func ("/image/load/tiff3", "image-tile.tiff", test_load_image);
|
||||
g_test_add_data_func ("/image/load/tiff4", "image-float.tiff", test_load_image);
|
||||
g_test_add_data_func ("/image/load/jpeg", "image.jpeg", test_load_image);
|
||||
g_test_add_data_func ("/image/load/jpeg2", "image-cmyk.jpeg", test_load_image);
|
||||
g_test_add_data_func ("/image/load/jpeg3", "image-gray.jpeg", test_load_image);
|
||||
g_test_add_data_func ("/image/save/png", "image.png", test_save_image);
|
||||
g_test_add_data_func ("/image/save/tiff", "image.tiff", test_save_image);
|
||||
g_test_add_data_func ("/image/save/jpeg", "image.jpeg", test_save_image);
|
||||
path = g_test_build_filename (G_TEST_DIST, "image-data", NULL);
|
||||
dir = g_dir_open (path, 0, &error);
|
||||
g_assert_no_error (error);
|
||||
g_free (path);
|
||||
|
||||
while ((name = g_dir_read_name (dir)) != NULL)
|
||||
{
|
||||
char *test = g_strconcat ("/image/load/", name, NULL);
|
||||
g_test_add_data_func (test, name, test_load_image);
|
||||
g_free (test);
|
||||
}
|
||||
|
||||
path = g_test_build_filename (G_TEST_DIST, "bad-image-data", NULL);
|
||||
dir = g_dir_open (path, 0, &error);
|
||||
g_assert_no_error (error);
|
||||
g_free (path);
|
||||
|
||||
while ((name = g_dir_read_name (dir)) != NULL)
|
||||
{
|
||||
char *test = g_strconcat ("/image/fail/", name, NULL);
|
||||
g_test_add_data_func (test, name, test_load_image_fail);
|
||||
g_free (test);
|
||||
}
|
||||
|
||||
g_test_add_data_func ("/image/save/image.png", "image.png", test_save_image);
|
||||
g_test_add_data_func ("/image/save/image.tiff", "image.tiff", test_save_image);
|
||||
g_test_add_data_func ("/image/save/image.jpeg", "image.jpeg", test_save_image);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ tests = [
|
||||
{ 'name': 'rgba' },
|
||||
{ 'name': 'seat' },
|
||||
{ 'name': 'texture-threads' },
|
||||
{ 'name': 'toplevellayout' },
|
||||
{ 'name': 'popuplayout' },
|
||||
]
|
||||
|
||||
foreach t : tests
|
||||
|
63
testsuite/gdk/popuplayout.c
Normal file
63
testsuite/gdk/popuplayout.c
Normal file
@ -0,0 +1,63 @@
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
test_popup_layout_basic (void)
|
||||
{
|
||||
GdkPopupLayout *layout;
|
||||
GdkPopupLayout *layout2;
|
||||
GdkRectangle anchor = { 0, 0, 20, 20 };
|
||||
const GdkRectangle *rect;
|
||||
int dx, dy;
|
||||
int l, r, t, b;
|
||||
|
||||
layout = gdk_popup_layout_new (&anchor, GDK_GRAVITY_SOUTH, GDK_GRAVITY_NORTH);
|
||||
|
||||
rect = gdk_popup_layout_get_anchor_rect (layout);
|
||||
g_assert_true (gdk_rectangle_equal (&anchor, rect));
|
||||
|
||||
layout2 = gdk_popup_layout_copy (layout);
|
||||
|
||||
gdk_popup_layout_ref (layout2);
|
||||
g_assert_true (gdk_popup_layout_equal (layout, layout2));
|
||||
gdk_popup_layout_unref (layout2);
|
||||
|
||||
gdk_popup_layout_set_offset (layout, 10, 10);
|
||||
g_assert_false (gdk_popup_layout_equal (layout, layout2));
|
||||
gdk_popup_layout_get_offset (layout, &dx, &dy);
|
||||
g_assert_true (dx == 10 && dy == 10);
|
||||
|
||||
gdk_popup_layout_set_shadow_width (layout, 1, 2, 3, 4);
|
||||
gdk_popup_layout_get_shadow_width (layout, &l, &r, &t, &b);
|
||||
g_assert_true (l == 1 && r == 2 && t == 3 && b == 4);
|
||||
|
||||
anchor.x = 1;
|
||||
anchor.y = 2;
|
||||
gdk_popup_layout_set_anchor_rect (layout, &anchor);
|
||||
rect = gdk_popup_layout_get_anchor_rect (layout);
|
||||
g_assert_true (gdk_rectangle_equal (&anchor, rect));
|
||||
|
||||
gdk_popup_layout_set_rect_anchor (layout, GDK_GRAVITY_NORTH_WEST);
|
||||
g_assert_true (gdk_popup_layout_get_rect_anchor (layout) == GDK_GRAVITY_NORTH_WEST);
|
||||
|
||||
gdk_popup_layout_set_surface_anchor (layout, GDK_GRAVITY_SOUTH_EAST);
|
||||
g_assert_true (gdk_popup_layout_get_surface_anchor (layout) == GDK_GRAVITY_SOUTH_EAST);
|
||||
|
||||
gdk_popup_layout_set_anchor_hints (layout, GDK_ANCHOR_FLIP_X | GDK_ANCHOR_RESIZE_Y);
|
||||
g_assert_true (gdk_popup_layout_get_anchor_hints (layout) == (GDK_ANCHOR_FLIP_X | GDK_ANCHOR_RESIZE_Y));
|
||||
|
||||
gdk_popup_layout_unref (layout2);
|
||||
gdk_popup_layout_unref (layout);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
gtk_init ();
|
||||
|
||||
g_test_add_func ("/popuplayout/basic", test_popup_layout_basic);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
#include <gtk.h>
|
||||
|
||||
#include "gdk/gdkmemorytextureprivate.h"
|
||||
#include "gdk/gdktextureprivate.h"
|
||||
|
||||
static void
|
||||
compare_pixels (int width,
|
||||
@ -23,6 +24,36 @@ compare_pixels (int width,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
compare_textures (GdkTexture *texture1,
|
||||
GdkTexture *texture2)
|
||||
{
|
||||
int width, height;
|
||||
gsize stride;
|
||||
guchar *data1;
|
||||
guchar *data2;
|
||||
|
||||
g_assert_true (gdk_texture_get_width (texture1) == gdk_texture_get_width (texture2));
|
||||
g_assert_true (gdk_texture_get_height (texture1) == gdk_texture_get_height (texture2));
|
||||
|
||||
width = gdk_texture_get_width (texture1);
|
||||
height = gdk_texture_get_height (texture1);
|
||||
stride = 4 * width;
|
||||
|
||||
data1 = g_new0 (guchar, stride * height);
|
||||
gdk_texture_download (texture1, data1, stride);
|
||||
|
||||
data2 = g_new0 (guchar, stride * height);
|
||||
gdk_texture_download (texture2, data2, stride);
|
||||
|
||||
compare_pixels (width, height,
|
||||
data1, stride,
|
||||
data2, stride);
|
||||
|
||||
g_free (data1);
|
||||
g_free (data2);
|
||||
}
|
||||
|
||||
static void
|
||||
test_texture_from_pixbuf (void)
|
||||
{
|
||||
@ -106,6 +137,30 @@ test_texture_save_to_png (void)
|
||||
g_object_unref (file);
|
||||
g_assert_no_error (error);
|
||||
|
||||
compare_textures (texture, texture2);
|
||||
|
||||
g_object_unref (texture);
|
||||
g_object_unref (texture2);
|
||||
}
|
||||
|
||||
static void
|
||||
test_texture_save_to_tiff (void)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GError *error = NULL;
|
||||
GFile *file;
|
||||
GdkTexture *texture2;
|
||||
|
||||
texture = gdk_texture_new_from_resource ("/org/gtk/libgtk/icons/16x16/places/user-trash.png");
|
||||
|
||||
gdk_texture_save_to_tiff (texture, "test.tiff");
|
||||
file = g_file_new_for_path ("test.tiff");
|
||||
texture2 = gdk_texture_new_from_file (file, &error);
|
||||
g_object_unref (file);
|
||||
g_assert_no_error (error);
|
||||
|
||||
compare_textures (texture, texture2);
|
||||
|
||||
g_object_unref (texture);
|
||||
g_object_unref (texture2);
|
||||
}
|
||||
@ -160,6 +215,146 @@ test_texture_subtexture (void)
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
test_texture_icon (void)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GdkTexture *texture2;
|
||||
GInputStream *stream;
|
||||
GdkPixbuf *pixbuf;
|
||||
GError *error = NULL;
|
||||
|
||||
texture = gdk_texture_new_from_resource ("/org/gtk/libgtk/icons/16x16/places/user-trash.png");
|
||||
|
||||
stream = g_loadable_icon_load (G_LOADABLE_ICON (texture), 16, NULL, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_nonnull (stream);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_nonnull (pixbuf);
|
||||
|
||||
texture2 = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
|
||||
compare_textures (texture, texture2);
|
||||
|
||||
g_object_unref (texture2);
|
||||
g_object_unref (pixbuf);
|
||||
g_object_unref (stream);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_loaded (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GdkTexture *texture = GDK_TEXTURE (source);
|
||||
GError *error = NULL;
|
||||
GdkTexture *texture2;
|
||||
GdkPixbuf *pixbuf;
|
||||
GInputStream *stream;
|
||||
gboolean *done = (gboolean *)data;
|
||||
|
||||
stream = g_loadable_icon_load_finish (G_LOADABLE_ICON (texture), result, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_nonnull (stream);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_nonnull (pixbuf);
|
||||
|
||||
texture2 = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
|
||||
compare_textures (texture, texture2);
|
||||
|
||||
g_object_unref (texture2);
|
||||
g_object_unref (pixbuf);
|
||||
g_object_unref (stream);
|
||||
g_object_unref (texture);
|
||||
|
||||
*done = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
test_texture_icon_async (void)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
gboolean done = FALSE;
|
||||
|
||||
texture = gdk_texture_new_from_resource ("/org/gtk/libgtk/icons/16x16/places/user-trash.png");
|
||||
|
||||
g_loadable_icon_load_async (G_LOADABLE_ICON (texture), 16, NULL, icon_loaded, &done);
|
||||
|
||||
while (!done)
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
test_texture_icon_serialize (void)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GVariant *data;
|
||||
GIcon *icon;
|
||||
|
||||
texture = gdk_texture_new_from_resource ("/org/gtk/libgtk/icons/16x16/places/user-trash.png");
|
||||
|
||||
data = g_icon_serialize (G_ICON (texture));
|
||||
g_assert_nonnull (data);
|
||||
icon = g_icon_deserialize (data);
|
||||
g_assert_true (G_IS_BYTES_ICON (icon));
|
||||
|
||||
g_variant_unref (data);
|
||||
g_object_unref (icon);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
test_texture_diff (void)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GdkTexture *texture2;
|
||||
cairo_region_t *full;
|
||||
cairo_region_t *center;
|
||||
cairo_region_t *r;
|
||||
|
||||
texture = gdk_texture_new_from_resource ("/org/gtk/libgtk/icons/16x16/places/user-trash.png");
|
||||
texture2 = gdk_texture_new_from_resource ("/org/gtk/libgtk/icons/16x16/places/user-trash.png");
|
||||
|
||||
full = cairo_region_create_rectangle (&(cairo_rectangle_int_t) { 0, 0, 16, 16 });
|
||||
center = cairo_region_create_rectangle (&(cairo_rectangle_int_t) { 4, 4, 8 ,8 });
|
||||
|
||||
r = cairo_region_create ();
|
||||
gdk_texture_diff (texture, texture, r);
|
||||
|
||||
g_assert_true (cairo_region_is_empty (r));
|
||||
|
||||
gdk_texture_diff (texture, texture2, r);
|
||||
|
||||
/* No diff set, so we get the full area */
|
||||
g_assert_true (cairo_region_equal (r, full));
|
||||
cairo_region_destroy (r);
|
||||
|
||||
gdk_texture_set_diff (texture, texture2, cairo_region_copy (center));
|
||||
|
||||
r = cairo_region_create ();
|
||||
gdk_texture_diff (texture, texture2, r);
|
||||
|
||||
g_assert_true (cairo_region_equal (r, center));
|
||||
cairo_region_destroy (r);
|
||||
|
||||
r = cairo_region_create ();
|
||||
gdk_texture_diff (texture2, texture, r);
|
||||
|
||||
g_assert_true (cairo_region_equal (r, center));
|
||||
cairo_region_destroy (r);
|
||||
|
||||
cairo_region_destroy (full);
|
||||
cairo_region_destroy (center);
|
||||
g_object_unref (texture);
|
||||
g_object_unref (texture2);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@ -169,7 +364,12 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/texture/from-pixbuf", test_texture_from_pixbuf);
|
||||
g_test_add_func ("/texture/from-resource", test_texture_from_resource);
|
||||
g_test_add_func ("/texture/save-to-png", test_texture_save_to_png);
|
||||
g_test_add_func ("/texture/save-to-tiff", test_texture_save_to_tiff);
|
||||
g_test_add_func ("/texture/subtexture", test_texture_subtexture);
|
||||
g_test_add_func ("/texture/icon/load", test_texture_icon);
|
||||
g_test_add_func ("/texture/icon/load-async", test_texture_icon_async);
|
||||
g_test_add_func ("/texture/icon/serialize", test_texture_icon_serialize);
|
||||
g_test_add_func ("/texture/diff", test_texture_diff);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
53
testsuite/gdk/toplevellayout.c
Normal file
53
testsuite/gdk/toplevellayout.c
Normal file
@ -0,0 +1,53 @@
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
test_toplevel_layout_basic (void)
|
||||
{
|
||||
GdkToplevelLayout *layout;
|
||||
GdkToplevelLayout *layout2;
|
||||
gboolean max;
|
||||
gboolean full;
|
||||
GdkMonitor *monitor;
|
||||
|
||||
layout = gdk_toplevel_layout_new ();
|
||||
|
||||
g_assert_false (gdk_toplevel_layout_get_maximized (layout, &max));
|
||||
g_assert_false (gdk_toplevel_layout_get_fullscreen (layout, &full));
|
||||
|
||||
gdk_toplevel_layout_set_maximized (layout, TRUE);
|
||||
g_assert_true (gdk_toplevel_layout_get_maximized (layout, &max));
|
||||
g_assert_true (max);
|
||||
|
||||
layout2 = gdk_toplevel_layout_copy (layout);
|
||||
gdk_toplevel_layout_ref (layout2);
|
||||
g_assert_true (gdk_toplevel_layout_equal (layout, layout2));
|
||||
gdk_toplevel_layout_unref (layout2);
|
||||
|
||||
gdk_toplevel_layout_set_maximized (layout, FALSE);
|
||||
g_assert_false (gdk_toplevel_layout_equal (layout, layout2));
|
||||
|
||||
monitor = g_list_model_get_item (gdk_display_get_monitors (gdk_display_get_default ()), 0);
|
||||
gdk_toplevel_layout_set_fullscreen (layout, TRUE, monitor);
|
||||
|
||||
g_assert_true (gdk_toplevel_layout_get_fullscreen (layout, &full));
|
||||
g_assert_true (full);
|
||||
g_assert_true (monitor == gdk_toplevel_layout_get_fullscreen_monitor (layout));
|
||||
|
||||
g_object_unref (monitor);
|
||||
|
||||
gdk_toplevel_layout_unref (layout2);
|
||||
gdk_toplevel_layout_unref (layout);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
gtk_init ();
|
||||
|
||||
g_test_add_func ("/toplevellayout/basic", test_toplevel_layout_basic);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
Loading…
Reference in New Issue
Block a user