File: test-style.c

package info (click to toggle)
libgedit-gtksourceview 299.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 7,536 kB
  • sloc: ansic: 48,501; xml: 2,620; perl: 206; sh: 51; yacc: 45; makefile: 35; cobol: 20; objc: 19; javascript: 16; fortran: 14; python: 13; cpp: 8; ml: 3
file content (50 lines) | stat: -rw-r--r-- 965 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* SPDX-FileCopyrightText: 2023 - Sébastien Wilmet
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#include <gtksourceview/gtksource.h>

static void
test_basics (void)
{
	GtkSourceStyle *style;
	GtkTextTag *tag;
	PangoStyle pango_style = PANGO_STYLE_NORMAL;
	gboolean pango_style_set = FALSE;

	style = gtk_source_style_new ();
	g_assert_false (style->use_italic);

	style->italic = TRUE;
	style->use_italic = TRUE;

	tag = gtk_text_tag_new (NULL);
	gtk_source_style_apply (style, tag);

	g_object_get (tag,
		      "style", &pango_style,
		      "style-set", &pango_style_set,
		      NULL);
	g_assert_true (pango_style == PANGO_STYLE_ITALIC);
	g_assert_true (pango_style_set);

	gtk_source_style_unref (style);
	g_object_unref (tag);
}

int
main (int    argc,
      char **argv)
{
	gint ret;

	gtk_test_init (&argc, &argv);
	gtk_source_init ();

	g_test_add_func ("/Style/basics", test_basics);

	ret = g_test_run ();
	gtk_source_finalize ();

	return ret;
}