tests: Less linking
Build just a few binaries for the gdk tests, avoiding the overhead of linking each one.
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
static void
|
||||
int_free_func (int data)
|
||||
{
|
||||
@@ -78,12 +80,9 @@ int_free_func (int data)
|
||||
#define GDK_ARRAY_NULL_TERMINATED 1
|
||||
#include "arrayimpl.c"
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_array_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
setlocale (LC_ALL, "C");
|
||||
|
||||
g_test_add_func ("/intarray/simple", int_array_test_simple);
|
||||
g_test_add_func ("/intarray/prealloc/simple", pre_int_array_test_simple);
|
||||
g_test_add_func ("/intarray/freefunc/simple", free_int_array_test_simple);
|
||||
@@ -100,6 +99,4 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/intarray/null/prealloc/splice", null_pre_int_array_test_splice);
|
||||
g_test_add_func ("/intarray/null/freefunc/splice", null_free_int_array_test_splice);
|
||||
g_test_add_func ("/intarray/null/prealloc/freefunc/splice", null_pre_free_int_array_test_splice);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "gdktests.h"
|
||||
|
||||
static void
|
||||
test_set_source_big_pixbuf (void)
|
||||
@@ -28,13 +29,8 @@ test_set_source_big_pixbuf (void)
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_cairo_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
gtk_init ();
|
||||
|
||||
g_test_add_func ("/drawing/set-source-big-pixbuf", test_set_source_big_pixbuf);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
static GType
|
||||
string_type (void)
|
||||
{
|
||||
@@ -218,17 +220,11 @@ test_parse_fail (void)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_content_formats_tests (void)
|
||||
{
|
||||
gsize i;
|
||||
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
gtk_init ();
|
||||
|
||||
/* Ensure all the types we care about to exist */
|
||||
for (i = 0; i < G_N_ELEMENTS(possible_types); i++)
|
||||
for (gsize i = 0; i < G_N_ELEMENTS(possible_types); i++)
|
||||
{
|
||||
if (possible_types[i].type_func)
|
||||
g_type_ensure (possible_types[i].type_func ());
|
||||
@@ -238,6 +234,4 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/contentformats/parse_fail", test_parse_fail);
|
||||
g_test_add_func ("/contentformats/print_and_parse", test_print_and_parse);
|
||||
g_test_add_func ("/contentformats/union", test_union);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
typedef gboolean (* ValueCompareFunc) (GValue *v1, GValue *v2);
|
||||
|
||||
typedef struct {
|
||||
@@ -463,13 +465,9 @@ test_custom_format (void)
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_content_serializer_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
gtk_init ();
|
||||
|
||||
g_test_add_func ("/content/text_plain_utf8", test_content_text_plain_utf8);
|
||||
g_test_add_func ("/content/text_plain", test_content_text_plain);
|
||||
g_test_add_func ("/content/color", test_content_color);
|
||||
@@ -478,6 +476,4 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/content/file", test_content_file);
|
||||
g_test_add_func ("/content/files", test_content_files);
|
||||
g_test_add_func ("/content/custom", test_custom_format);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <cairo-gobject.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
static void
|
||||
test_cursor_named (void)
|
||||
{
|
||||
@@ -54,16 +56,10 @@ test_cursor_fallback (void)
|
||||
g_object_unref (fallback);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_cursor_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
gtk_init ();
|
||||
|
||||
g_test_add_func ("/cursor/named", test_cursor_named);
|
||||
g_test_add_func ("/cursor/texture", test_cursor_texture);
|
||||
g_test_add_func ("/cursor/fallback", test_cursor_fallback);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
static void
|
||||
test_unset_display_subprocess1 (void)
|
||||
{
|
||||
GdkDisplayManager *manager;
|
||||
|
||||
gdk_set_allowed_backends ("x11");
|
||||
g_unsetenv ("DISPLAY");
|
||||
|
||||
g_assert_false (gtk_init_check ());
|
||||
@@ -18,6 +21,7 @@ test_unset_display_subprocess1 (void)
|
||||
static void
|
||||
test_unset_display_subprocess2 (void)
|
||||
{
|
||||
gdk_set_allowed_backends ("x11");
|
||||
g_unsetenv ("DISPLAY");
|
||||
|
||||
gtk_init ();
|
||||
@@ -39,6 +43,7 @@ test_bad_display_subprocess1 (void)
|
||||
{
|
||||
GdkDisplayManager *manager;
|
||||
|
||||
gdk_set_allowed_backends ("x11");
|
||||
g_setenv ("DISPLAY", "poo", TRUE);
|
||||
|
||||
g_assert_false (gtk_init_check ());
|
||||
@@ -50,6 +55,7 @@ test_bad_display_subprocess1 (void)
|
||||
static void
|
||||
test_bad_display_subprocess2 (void)
|
||||
{
|
||||
gdk_set_allowed_backends ("x11");
|
||||
g_setenv ("DISPLAY", "poo", TRUE);
|
||||
gtk_init ();
|
||||
}
|
||||
@@ -65,19 +71,13 @@ test_bad_display (void)
|
||||
g_test_trap_assert_stderr ("*cannot open display*");
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_display_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
gdk_set_allowed_backends ("x11");
|
||||
|
||||
g_test_add_func ("/display/unset-display", test_unset_display);
|
||||
g_test_add_func ("/display/unset-display/subprocess/1", test_unset_display_subprocess1);
|
||||
g_test_add_func ("/display/unset-display/subprocess/2", test_unset_display_subprocess2);
|
||||
g_test_add_func ("/display/bad-display", test_bad_display);
|
||||
g_test_add_func ("/display/bad-display/subprocess/1", test_bad_display_subprocess1);
|
||||
g_test_add_func ("/display/bad-display/subprocess/2", test_bad_display_subprocess2);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
static void
|
||||
test_basic (void)
|
||||
{
|
||||
@@ -40,16 +42,9 @@ test_set_default (void)
|
||||
g_assert_true (d == d2);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_display_manager_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
/* Open default display */
|
||||
gdk_display_open (NULL);
|
||||
|
||||
g_test_add_func ("/displaymanager/basic", test_basic);
|
||||
g_test_add_func ("/displaymanager/set-default", test_set_default);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <gdk/x11/gdkx.h>
|
||||
#endif
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
static void
|
||||
test_to_text_list (void)
|
||||
{
|
||||
@@ -34,13 +36,8 @@ test_to_text_list (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_encoding_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
gtk_init ();
|
||||
|
||||
g_test_add_func ("/encoding/to-text-list", test_to_text_list);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
34
testsuite/gdk/gdkinternaltests.c
Normal file
34
testsuite/gdk/gdkinternaltests.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright © 2023 Matthias Clasen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gdkinternaltests.h"
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
gtk_init ();
|
||||
|
||||
add_image_tests ();
|
||||
add_texture_tests ();
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
4
testsuite/gdk/gdkinternaltests.h
Normal file
4
testsuite/gdk/gdkinternaltests.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
void add_image_tests (void);
|
||||
void add_texture_tests (void);
|
||||
51
testsuite/gdk/gdktests.c
Normal file
51
testsuite/gdk/gdktests.c
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright © 2023 Matthias Clasen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
/* display tests need this */
|
||||
if (!g_test_subprocess ())
|
||||
gtk_init ();
|
||||
|
||||
add_array_tests ();
|
||||
add_cairo_tests ();
|
||||
add_content_formats_tests ();
|
||||
add_content_serializer_tests ();
|
||||
add_cursor_tests ();
|
||||
add_display_tests ();
|
||||
add_display_manager_tests ();
|
||||
add_encoding_tests ();
|
||||
add_glcontext_tests ();
|
||||
add_keysyms_tests ();
|
||||
add_memory_texture_tests ();
|
||||
add_pixbuf_tests ();
|
||||
add_rectangle_tests ();
|
||||
add_rgba_tests ();
|
||||
add_seat_tests ();
|
||||
add_texture_threads_tests ();
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
18
testsuite/gdk/gdktests.h
Normal file
18
testsuite/gdk/gdktests.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
void add_array_tests (void);
|
||||
void add_cairo_tests (void);
|
||||
void add_content_formats_tests (void);
|
||||
void add_content_serializer_tests (void);
|
||||
void add_cursor_tests (void);
|
||||
void add_display_tests (void);
|
||||
void add_display_manager_tests (void);
|
||||
void add_encoding_tests (void);
|
||||
void add_glcontext_tests (void);
|
||||
void add_keysyms_tests (void);
|
||||
void add_memory_texture_tests (void);
|
||||
void add_pixbuf_tests (void);
|
||||
void add_rectangle_tests (void);
|
||||
void add_rgba_tests (void);
|
||||
void add_seat_tests (void);
|
||||
void add_texture_threads_tests (void);
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
#define ALL_APIS (GDK_GL_API_GL | GDK_GL_API_GLES)
|
||||
|
||||
static GdkGLAPI
|
||||
@@ -68,15 +70,11 @@ test_allowed_backends (gconstpointer data)
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_glcontext_tests (void)
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_data_func ("/allowed-apis/none", GSIZE_TO_POINTER (0), test_allowed_backends);
|
||||
g_test_add_data_func ("/allowed-apis/gl", GSIZE_TO_POINTER (GDK_GL_API_GL), test_allowed_backends);
|
||||
g_test_add_data_func ("/allowed-apis/gles", GSIZE_TO_POINTER (GDK_GL_API_GLES), test_allowed_backends);
|
||||
g_test_add_data_func ("/allowed-apis/all", GSIZE_TO_POINTER (GDK_GL_API_GL | GDK_GL_API_GLES), test_allowed_backends);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "gdk/loaders/gdktiffprivate.h"
|
||||
#include "gdk/loaders/gdkjpegprivate.h"
|
||||
|
||||
#include "gdkinternaltests.h"
|
||||
|
||||
static void
|
||||
assert_texture_equal (GdkTexture *t1,
|
||||
GdkTexture *t2)
|
||||
@@ -118,11 +120,9 @@ test_save_image (gconstpointer test_data)
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_image_tests (void)
|
||||
{
|
||||
(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);
|
||||
@@ -136,6 +136,4 @@ main (int argc, char *argv[])
|
||||
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);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <locale.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
static void
|
||||
test_keysyms_basic (void)
|
||||
{
|
||||
@@ -123,19 +125,12 @@ test_key_unicode (void)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_keysyms_tests (void)
|
||||
{
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
gtk_init ();
|
||||
|
||||
g_test_add_func ("/keysyms/basic", test_keysyms_basic);
|
||||
g_test_add_func ("/keysyms/void", test_keysyms_void);
|
||||
g_test_add_func ("/keysyms/xf86", test_keysyms_xf86);
|
||||
g_test_add_func ("/keys/case", test_key_case);
|
||||
g_test_add_func ("/keys/unicode", test_key_unicode);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "gsk/gl/gskglrenderer.h"
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
#define N 20
|
||||
|
||||
static GskRenderer *gl_renderer = NULL;
|
||||
@@ -636,31 +638,30 @@ add_test (const char *name,
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
static void
|
||||
clear_gl_renderer (void)
|
||||
{
|
||||
int result;
|
||||
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
add_test ("/memorytexture/download_1x1", test_download_1x1);
|
||||
add_test ("/memorytexture/download_4x4", test_download_4x4);
|
||||
add_test ("/memorytexture/download_192x192", test_download_192x192);
|
||||
|
||||
gl_renderer = gsk_gl_renderer_new ();
|
||||
if (!gsk_renderer_realize (gl_renderer, NULL, NULL))
|
||||
{
|
||||
g_clear_object (&gl_renderer);
|
||||
}
|
||||
|
||||
result = g_test_run ();
|
||||
|
||||
if (gl_renderer)
|
||||
{
|
||||
gsk_renderer_unrealize (gl_renderer);
|
||||
g_clear_object (&gl_renderer);
|
||||
}
|
||||
gdk_gl_context_clear_current ();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
add_memory_texture_tests (void)
|
||||
{
|
||||
add_test ("/memorytexture/download_1x1", test_download_1x1);
|
||||
add_test ("/memorytexture/download_4x4", test_download_4x4);
|
||||
add_test ("/memorytexture/download_192x192", test_download_192x192);
|
||||
|
||||
if (!g_test_subprocess ())
|
||||
{
|
||||
gl_renderer = gsk_gl_renderer_new ();
|
||||
if (!gsk_renderer_realize (gl_renderer, NULL, NULL))
|
||||
g_clear_object (&gl_renderer);
|
||||
|
||||
atexit (clear_gl_renderer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,70 +6,84 @@ clipboard_client = executable('clipboard-client',
|
||||
install: false,
|
||||
)
|
||||
|
||||
tests = [
|
||||
{ 'name': 'array' },
|
||||
{ 'name': 'cairo' },
|
||||
{ 'name': 'clipboard', 'parallel': false, },
|
||||
{ 'name': 'contentformats' },
|
||||
{ 'name': 'contentserializer' },
|
||||
{ 'name': 'cursor' },
|
||||
{ 'name': 'display' },
|
||||
{ 'name': 'displaymanager' },
|
||||
{ 'name': 'encoding' },
|
||||
{ 'name': 'glcontext' },
|
||||
{ 'name': 'keysyms' },
|
||||
{ 'name': 'memorytexture' },
|
||||
{ 'name': 'pixbuf' },
|
||||
{ 'name': 'rectangle' },
|
||||
{ 'name': 'rgba' },
|
||||
{ 'name': 'seat' },
|
||||
{ 'name': 'texture-threads' },
|
||||
]
|
||||
clipboard_test = executable('clipboard',
|
||||
sources: 'clipboard.c',
|
||||
c_args: common_cflags,
|
||||
dependencies: libgtk_dep,
|
||||
install: false,
|
||||
)
|
||||
|
||||
foreach t : tests
|
||||
test_name = t.get('name')
|
||||
test_exe = executable(test_name,
|
||||
sources: '@0@.c'.format(test_name),
|
||||
c_args: common_cflags,
|
||||
dependencies: libgtk_dep,
|
||||
install: false,
|
||||
)
|
||||
|
||||
suites = ['gdk'] + t.get('suites', [])
|
||||
|
||||
test(test_name, test_exe,
|
||||
args: [ '--tap', '-k' ],
|
||||
protocol: 'tap',
|
||||
is_parallel: t.get('parallel', false),
|
||||
env: [
|
||||
test('clipboard', clipboard_test,
|
||||
args: [ '--tap', '-k' ],
|
||||
protocol: 'tap',
|
||||
is_parallel: false,
|
||||
env: [
|
||||
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
|
||||
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
|
||||
'DBUS_SESSION_BUS_ADDRESS=',
|
||||
],
|
||||
suite: suites,
|
||||
)
|
||||
endforeach
|
||||
],
|
||||
suite: 'gdk',
|
||||
)
|
||||
|
||||
internal_tests = [
|
||||
'image',
|
||||
'texture',
|
||||
test_sources = [
|
||||
'array.c',
|
||||
'cairo.c',
|
||||
'contentformats.c',
|
||||
'contentserializer.c',
|
||||
'cursor.c',
|
||||
'display.c',
|
||||
'displaymanager.c',
|
||||
'encoding.c',
|
||||
'glcontext.c',
|
||||
'keysyms.c',
|
||||
'memorytexture.c',
|
||||
'pixbuf.c',
|
||||
'rectangle.c',
|
||||
'rgba.c',
|
||||
'seat.c',
|
||||
'texture-threads.c',
|
||||
'gdktests.c'
|
||||
]
|
||||
|
||||
foreach t : internal_tests
|
||||
test_exe = executable(t, '@0@.c'.format(t),
|
||||
c_args: common_cflags,
|
||||
dependencies: libgtk_static_dep,
|
||||
install: false,
|
||||
)
|
||||
gdktests = executable('gdktests',
|
||||
sources: test_sources,
|
||||
c_args: common_cflags,
|
||||
dependencies: libgtk_dep,
|
||||
install: false,
|
||||
)
|
||||
|
||||
test(t, test_exe,
|
||||
args: [ '--tap', '-k' ],
|
||||
protocol: 'tap',
|
||||
env: [
|
||||
test('gdktests', gdktests,
|
||||
args: [ '--tap', '-k' ],
|
||||
protocol: 'tap',
|
||||
is_parallel: true,
|
||||
env: [
|
||||
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
|
||||
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
|
||||
'DBUS_SESSION_BUS_ADDRESS=',
|
||||
],
|
||||
suite: 'gdk',
|
||||
)
|
||||
endforeach
|
||||
],
|
||||
suite: 'gdk',
|
||||
)
|
||||
|
||||
internal_test_sources = [
|
||||
'image.c',
|
||||
'texture.c',
|
||||
'gdkinternaltests.c',
|
||||
]
|
||||
|
||||
gdkinternaltests = executable('gdkinternaltests',
|
||||
sources: internal_test_sources,
|
||||
c_args: common_cflags,
|
||||
dependencies: libgtk_static_dep,
|
||||
install: false,
|
||||
)
|
||||
|
||||
test('gdkinternaltests', gdkinternaltests,
|
||||
args: [ '--tap', '-k' ],
|
||||
protocol: 'tap',
|
||||
env: [
|
||||
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
|
||||
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
|
||||
'DBUS_SESSION_BUS_ADDRESS=',
|
||||
],
|
||||
suite: 'gdk',
|
||||
)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
static void
|
||||
test_format (gconstpointer d)
|
||||
{
|
||||
@@ -29,14 +31,9 @@ test_format (gconstpointer d)
|
||||
g_assert_true (found);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_pixbuf_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_data_func ("/pixbuf/format/png", "png", test_format);
|
||||
g_test_add_data_func ("/pixbuf/format/jpeg", "jpeg", test_format);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <cairo-gobject.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
static void
|
||||
test_rectangle_equal (void)
|
||||
{
|
||||
@@ -107,18 +109,12 @@ test_rectangle_contains (void)
|
||||
g_assert_false (gdk_rectangle_contains_point (&b, 10, 6));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_rectangle_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
gtk_init ();
|
||||
|
||||
g_test_add_func ("/rectangle/equal", test_rectangle_equal);
|
||||
g_test_add_func ("/rectangle/intersect", test_rectangle_intersect);
|
||||
g_test_add_func ("/rectangle/union", test_rectangle_union);
|
||||
g_test_add_func ("/rectangle/type", test_rectangle_type);
|
||||
g_test_add_func ("/rectangle/contains", test_rectangle_contains);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <locale.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
static void
|
||||
test_color_parse (void)
|
||||
{
|
||||
@@ -207,16 +209,12 @@ test_color_hash (void)
|
||||
g_assert_cmpuint (hash1, !=, hash2);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_rgba_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/rgba/parse", test_color_parse);
|
||||
g_test_add_func ("/rgba/parse/nonsense", test_color_parse_nonsense);
|
||||
g_test_add_func ("/rgba/to-string", test_color_to_string);
|
||||
g_test_add_func ("/rgba/copy", test_color_copy);
|
||||
g_test_add_func ("/rgba/hash", test_color_hash);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
static void
|
||||
test_list_seats (void)
|
||||
{
|
||||
@@ -124,15 +126,9 @@ test_default_seat (void)
|
||||
g_list_free (tools);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_seat_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
gtk_init ();
|
||||
|
||||
g_test_add_func ("/seat/list", test_list_seats);
|
||||
g_test_add_func ("/seat/default", test_default_seat);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "gsk/gl/gskglrenderer.h"
|
||||
|
||||
#include "gdktests.h"
|
||||
|
||||
/* This function will be called from a thread and/or the main loop.
|
||||
* Textures are threadsafe after all. */
|
||||
static void
|
||||
@@ -111,12 +113,8 @@ texture_threads (void)
|
||||
gdk_gl_context_clear_current ();
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_texture_threads_tests (void)
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/texture-threads", texture_threads);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "gdk/gdkmemorytextureprivate.h"
|
||||
|
||||
#include "gdkinternaltests.h"
|
||||
|
||||
static void
|
||||
compare_pixels (int width,
|
||||
int height,
|
||||
@@ -160,16 +162,11 @@ test_texture_subtexture (void)
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_texture_tests (void)
|
||||
{
|
||||
/* We want to use resources from libgtk, so we need gtk initialized */
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
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/subtexture", test_texture_subtexture);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user