Compare commits
2 Commits
wip/matthi
...
tests-less
Author | SHA1 | Date | |
---|---|---|---|
|
c445db8f62 | ||
|
9b635cae28 |
@@ -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 ();
|
||||
}
|
||||
|
@@ -20,6 +20,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "gsk/gskrendernodeprivate.h"
|
||||
|
||||
#include "gskinternaltests.h"
|
||||
|
||||
static void
|
||||
test_can_diff_basic (void)
|
||||
{
|
||||
@@ -95,14 +97,9 @@ test_can_diff_transform (void)
|
||||
gsk_transform_unref (t2);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
void
|
||||
add_diff_tests (void)
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/node/can-diff/basic", test_can_diff_basic);
|
||||
g_test_add_func ("/node/can-diff/transform", test_can_diff_transform);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
36
testsuite/gsk/gskinternaltests.c
Normal file
36
testsuite/gsk/gskinternaltests.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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 "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gskinternaltests.h"
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
add_diff_tests ();
|
||||
add_half_float_tests ();
|
||||
add_rounded_rect_tests ();
|
||||
add_misc_tests ();
|
||||
|
||||
return g_test_run ();
|
||||
}
|
6
testsuite/gsk/gskinternaltests.h
Normal file
6
testsuite/gsk/gskinternaltests.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
void add_diff_tests (void);
|
||||
void add_half_float_tests (void);
|
||||
void add_rounded_rect_tests (void);
|
||||
void add_misc_tests (void);
|
34
testsuite/gsk/gsktests.c
Normal file
34
testsuite/gsk/gsktests.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 "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gsktests.h"
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
add_transform_tests ();
|
||||
add_shader_tests ();
|
||||
|
||||
return g_test_run ();
|
||||
}
|
4
testsuite/gsk/gsktests.h
Normal file
4
testsuite/gsk/gsktests.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
void add_transform_tests (void);
|
||||
void add_shader_tests (void);
|
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "gsk/gl/fp16private.h"
|
||||
|
||||
#include "gskinternaltests.h"
|
||||
|
||||
static void
|
||||
test_constants (void)
|
||||
{
|
||||
@@ -95,14 +97,10 @@ test_many (void)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_half_float_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/half-float/constants", test_constants);
|
||||
g_test_add_func ("/half-float/roundtrip", test_roundtrip);
|
||||
g_test_add_func ("/half-float/many", test_many);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
@@ -242,69 +242,52 @@ foreach test : node_parser_tests
|
||||
endif
|
||||
endforeach
|
||||
|
||||
tests = [
|
||||
['transform'],
|
||||
['shader'],
|
||||
test_sources = [
|
||||
'transform.c',
|
||||
'shader.c',
|
||||
'gsktests.c',
|
||||
]
|
||||
|
||||
test_cargs = []
|
||||
gsktests = executable('gsktests',
|
||||
test_sources,
|
||||
dependencies: libgtk_dep,
|
||||
c_args: common_cflags,
|
||||
)
|
||||
|
||||
foreach t : tests
|
||||
test_name = t.get(0)
|
||||
test_srcs = ['@0@.c'.format(test_name)] + t.get(1, [])
|
||||
test_extra_cargs = t.get(2, [])
|
||||
test_extra_ldflags = t.get(3, [])
|
||||
|
||||
test_exe = executable(test_name, test_srcs,
|
||||
dependencies : libgtk_dep,
|
||||
c_args : test_cargs + test_extra_cargs + common_cflags,
|
||||
link_args : test_extra_ldflags,
|
||||
)
|
||||
|
||||
test(test_name, test_exe,
|
||||
args: [ '--tap', '-k' ],
|
||||
protocol: 'tap',
|
||||
env: [
|
||||
test('gsktests', gsktests,
|
||||
args: [ '--tap', '-k' ],
|
||||
protocol: 'tap',
|
||||
env: [
|
||||
'GSK_RENDERER=cairo',
|
||||
'GTK_A11Y=test',
|
||||
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
|
||||
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
|
||||
],
|
||||
suite: 'gsk',
|
||||
)
|
||||
endforeach
|
||||
],
|
||||
suite: 'gsk',
|
||||
)
|
||||
|
||||
internal_tests = [
|
||||
[ 'diff' ],
|
||||
[ 'half-float' ],
|
||||
['rounded-rect'],
|
||||
['misc'],
|
||||
internal_test_sources = [
|
||||
'diff',
|
||||
'half-float',
|
||||
'rounded-rect',
|
||||
'misc',
|
||||
'gskinternaltests.c',
|
||||
]
|
||||
|
||||
foreach t : internal_tests
|
||||
test_name = t.get(0)
|
||||
test_srcs = ['@0@.c'.format(test_name)] + t.get(1, [])
|
||||
test_extra_cargs = t.get(2, [])
|
||||
test_extra_ldflags = t.get(3, [])
|
||||
gskinternaltests = executable('gskinternaltests',
|
||||
test_sources,
|
||||
dependencies: libgtk_static_dep,
|
||||
c_args: common_cflags,
|
||||
)
|
||||
|
||||
test_exe = executable(test_name,
|
||||
sources: test_srcs,
|
||||
dependencies : libgtk_static_dep,
|
||||
c_args : test_cargs + test_extra_cargs + common_cflags,
|
||||
link_args : test_extra_ldflags,
|
||||
)
|
||||
|
||||
test(test_name, test_exe,
|
||||
args: [ '--tap', '-k' ],
|
||||
protocol: 'tap',
|
||||
env: [
|
||||
test('gskinternaltests', gskinternaltests,
|
||||
args: [ '--tap', '-k' ],
|
||||
protocol: 'tap',
|
||||
env: [
|
||||
'GSK_RENDERER=cairo',
|
||||
'GTK_A11Y=test',
|
||||
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
|
||||
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
|
||||
],
|
||||
suite: 'gsk',
|
||||
)
|
||||
endforeach
|
||||
|
||||
|
||||
],
|
||||
suite: 'gsk',
|
||||
)
|
||||
|
@@ -1,6 +1,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "gsk/gskrendernodeprivate.h"
|
||||
|
||||
#include "gskinternaltests.h"
|
||||
|
||||
static void
|
||||
test_rendernode_gvalue (void)
|
||||
{
|
||||
@@ -82,15 +84,10 @@ test_conic_gradient_angle (void)
|
||||
gsk_render_node_unref (node);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
void
|
||||
add_misc_tests (void)
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
gtk_init ();
|
||||
|
||||
g_test_add_func ("/rendernode/gvalue", test_rendernode_gvalue);
|
||||
g_test_add_func ("/rendernode/border/uniform", test_bordernode_uniform);
|
||||
g_test_add_func ("/rendernode/conic-gradient/angle", test_conic_gradient_angle);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <gsk/gskroundedrectprivate.h>
|
||||
|
||||
#include "gskinternaltests.h"
|
||||
|
||||
static void
|
||||
test_contains_rect (void)
|
||||
{
|
||||
@@ -160,17 +162,12 @@ test_to_float (void)
|
||||
g_assert_true (flt[10] == 9. && flt[11] == 11.);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
void
|
||||
add_rounded_rect_tests (void)
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/rounded-rect/contains-rect", test_contains_rect);
|
||||
g_test_add_func ("/rounded-rect/intersects-rect", test_intersects_rect);
|
||||
g_test_add_func ("/rounded-rect/contains-point", test_contains_point);
|
||||
g_test_add_func ("/rounded-rect/is-circular", test_is_circular);
|
||||
g_test_add_func ("/rounded-rect/to-float", test_to_float);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gsktests.h"
|
||||
|
||||
/* shader fragment as found in nature */
|
||||
const char shader0[] =
|
||||
"// author: bobylito\n"
|
||||
@@ -290,16 +292,11 @@ test_compile (void)
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
void
|
||||
add_shader_tests (void)
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/shader/create/simple", test_create_simple);
|
||||
g_test_add_func ("/shader/create/data", test_create_data);
|
||||
g_test_add_func ("/shader/format-args", test_format_args);
|
||||
g_test_add_func ("/shader/compile", test_compile);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
@@ -21,6 +21,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gsktests.h"
|
||||
|
||||
#define EPSILON (1.f / 1024 / 32) /* 2^-15 */
|
||||
|
||||
/* macros stolen from graphene testsuite, so they get to keep their names */
|
||||
@@ -843,12 +845,9 @@ test_rotate3d_transform (void)
|
||||
gsk_transform_unref (t2);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
void
|
||||
add_transform_tests (void)
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/transform/conversions/simple", test_conversions_simple);
|
||||
g_test_add_func ("/transform/conversions/transformed", test_conversions_transformed);
|
||||
g_test_add_func ("/transform/identity", test_identity);
|
||||
@@ -865,6 +864,4 @@ main (int argc,
|
||||
g_test_add_func ("/transform/perspective", test_perspective_transform);
|
||||
g_test_add_func ("/transform/rotate", test_rotate_transform);
|
||||
g_test_add_func ("/transform/rotate3d", test_rotate3d_transform);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
Reference in New Issue
Block a user