Debian Codegraph @

testsuite/gdk/clipboard.c

raw symbols SCIP
1 #cxx . . $ `<file>/testsuite/gdk/clipboard.c`/include <stdlib.h>
2
3 #include <gtk/gtk.h>cxx . . $ `<file>/gtk/gtk.h`/
4
5 static void
6 text_receivedcxx . . $ text_received(aa1d200d824d915d). (GObjectcxx . . $ GObject# *source,
7 GAsyncResultcxx . . $ GAsyncResult# *res,
8 gpointercxx . . $ gpointer# data)
9 {
10 GdkClipboardcxx . . $ GdkClipboard# *clipboard = GDK_CLIPBOARDcxx . . $ `gdk/gdkclipboard.h:30:9`! (source);
11 gbooleancxx . . $ gboolean# *done = data;
12 GErrorcxx . . $ GError# *error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
13 char *text;
14
15 text = gdk_clipboard_read_text_finishcxx . . $ gdk_clipboard_read_text_finish(54092aaf66d91230). (clipboard, res, &error);
16
17 g_assert_no_errorcxx . . $ `<external>/15287032793271088244/gtestutils.h:217:9`! (error);
18 g_assert_cmpstrcxx . . $ `<external>/15287032793271088244/gtestutils.h:46:9`! (text, ==, "testing, 1, 2");
19
20 g_freecxx . . $ g_free(5d22bdacc48458e8). (text);
21
22 *done = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
23
24 g_main_context_wakeupcxx . . $ g_main_context_wakeup(2c4f9bc69c34eb5d). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
25 }
26
27 static void
28 test_clipboard_basiccxx . . $ test_clipboard_basic(49f6e7a06ebc5aa8). (void)
29 {
30 GdkDisplaycxx . . $ GdkDisplay# *display;
31 GdkClipboardcxx . . $ GdkClipboard# *clipboard;
32 GdkContentFormatscxx . . $ GdkContentFormats# *formats;
33 GdkContentProvidercxx . . $ GdkContentProvider# *content;
34 gbooleancxx . . $ gboolean# done;
35 gbooleancxx . . $ gboolean# ret;
36 GValuecxx . . $ GValue# value = G_VALUE_INITcxx . . $ `<external>/17218264759549183453/gvalue.h:250:9`!;
37 GErrorcxx . . $ GError# *error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
38
39 display = gdk_display_get_defaultcxx . . $ gdk_display_get_default(b31d93ef98fc5572). ();
40 clipboard = gdk_display_get_clipboardcxx . . $ gdk_display_get_clipboard(d64e200b8dbcc2a2). (display);
41
42 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gdk_clipboard_get_display (clipboard) == display);
43
44 gdk_clipboard_set_textcxx . . $ gdk_clipboard_set_text(cd5df9b714d66581). (clipboard, "testing, 1, 2");
45
46 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gdk_clipboard_is_local (clipboard));
47
48 formats = gdk_clipboard_get_formatscxx . . $ gdk_clipboard_get_formats(cdb13c78b99f48d7). (clipboard);
49
50 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gdk_content_formats_contain_gtype (formats, G_TYPE_STRINGcxx . . $ `<external>/9567554376676449156/gtype.h:165:9`!));
51 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gdk_content_formats_contain_mime_type (formats, "text/plain"));
52
53 done = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
54
55 gdk_clipboard_read_text_asynccxx . . $ gdk_clipboard_read_text_async(4aa0f14124bbed7e). (clipboard, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, text_receivedcxx . . $ text_received(aa1d200d824d915d)., &done);
56
57 while (!done)
58 g_main_context_iterationcxx . . $ g_main_context_iteration(53f508c65b8b33ab). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!);
59
60 content = gdk_clipboard_get_contentcxx . . $ gdk_clipboard_get_content(f1f7a1fe02e36ae1). (clipboard);
61 g_assert_nonnullcxx . . $ `<external>/15287032793271088244/gtestutils.h:254:9`! (content);
62
63 g_value_initcxx . . $ g_value_init(afc049a76445919c). (&value, G_TYPE_STRINGcxx . . $ `<external>/9567554376676449156/gtype.h:165:9`!);
64 ret = gdk_content_provider_get_valuecxx . . $ gdk_content_provider_get_value(f131bc8b1035f9ef). (content, &value, &error);
65 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (ret);
66 g_assert_no_errorcxx . . $ `<external>/15287032793271088244/gtestutils.h:217:9`! (error);
67 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (G_VALUE_TYPEcxx . . $ `<external>/17218264759549183453/gvalue.h:66:9`! (&value) == G_TYPE_STRINGcxx . . $ `<external>/9567554376676449156/gtype.h:165:9`!);
68 g_assert_cmpstrcxx . . $ `<external>/15287032793271088244/gtestutils.h:46:9`! (g_value_get_string (&value), ==, "testing, 1, 2");
69
70 g_value_unsetcxx . . $ g_value_unset(15c06aff79890746). (&value);
71 }
72
73 static void
74 read_upto_donecxx . . $ read_upto_done(aa1d200d824d915d). (GObjectcxx . . $ GObject# *source,
75 GAsyncResultcxx . . $ GAsyncResult# *result,
76 gpointercxx . . $ gpointer# data)
77 {
78 GDataInputStreamcxx . . $ GDataInputStream# *out = G_DATA_INPUT_STREAMcxx . . $ `<external>/4516394901282207394/gdatainputstream.h:35:9`! (source);
79 gbooleancxx . . $ gboolean# *done = data;
80 char *str;
81 GErrorcxx . . $ GError# *error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
82
83 str = g_data_input_stream_read_upto_finishcxx . . $ g_data_input_stream_read_upto_finish(bc590701c49d51af). (out, result, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &error);
84 g_assert_no_errorcxx . . $ `<external>/15287032793271088244/gtestutils.h:217:9`! (error);
85
86 if (g_test_verbosecxx . . $ `<external>/15287032793271088244/gtestutils.h:388:9`! ())
87 g_test_messagecxx . . $ g_test_message(326aeb464d16410c). ("src formats: %s", str);
88
89 g_freecxx . . $ g_free(5d22bdacc48458e8). (str);
90
91 *done = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
92 g_main_context_wakeupcxx . . $ g_main_context_wakeup(2c4f9bc69c34eb5d). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
93 }
94
95 static void
96 compare_texturescxx . . $ compare_textures(a1ad75661b2f0214). (GdkTexturecxx . . $ GdkTexture# *t1,
97 GdkTexturecxx . . $ GdkTexture# *t2)
98 {
99 int width;
100 int height;
101 int stride;
102 gucharcxx . . $ guchar# *d1;
103 gucharcxx . . $ guchar# *d2;
104
105 width = gdk_texture_get_widthcxx . . $ gdk_texture_get_width(84a21f334421d5dd). (t1);
106 height = gdk_texture_get_heightcxx . . $ gdk_texture_get_height(84a21f334421d5dd). (t1);
107 stride = 4 * width;
108
109 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (width, ==, gdk_texture_get_width (t2));
110 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (height, ==, gdk_texture_get_height (t2));
111
112 d1 = g_malloccxx . . $ g_malloc(bfcfa4d6b7f7ef64). (stride * height);
113 d2 = g_malloccxx . . $ g_malloc(bfcfa4d6b7f7ef64). (stride * height);
114
115 gdk_texture_downloadcxx . . $ gdk_texture_download(81a0156881cae20a). (t1, d1, stride);
116 gdk_texture_downloadcxx . . $ gdk_texture_download(81a0156881cae20a). (t2, d2, stride);
117
118 g_assert_cmpmemcxx . . $ `<external>/15287032793271088244/gtestutils.h:105:9`! (d1, stride * height, d2, stride * height);
119
120 g_freecxx . . $ g_free(5d22bdacc48458e8). (d1);
121 g_freecxx . . $ g_free(5d22bdacc48458e8). (d2);
122 }
123
124 static void
125 compare_filescxx . . $ compare_files(2fa786934fe80e24). (const char *file1,
126 const char *file2)
127 {
128 char *m1, *m2;
129 gsizecxx . . $ gsize# l1, l2;
130 GErrorcxx . . $ GError# *error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
131
132 g_file_get_contentscxx . . $ g_file_get_contents(295e1f4744034d8a). (file1, &m1, &l1, &error);
133 g_assert_no_errorcxx . . $ `<external>/15287032793271088244/gtestutils.h:217:9`! (error);
134 g_file_get_contentscxx . . $ g_file_get_contents(295e1f4744034d8a). (file2, &m2, &l2, &error);
135 g_assert_no_errorcxx . . $ `<external>/15287032793271088244/gtestutils.h:217:9`! (error);
136
137 if (l1 != l2)
138 g_test_fail_printfcxx . . $ g_test_fail_printf(326aeb464d16410c). ("file length mismatch: %s %s\n", file1, file2);
139 else if (memcmpcxx . . $ memcmp(36f949851efa3055). (m1, m2, l1) != 0)
140 g_test_fail_printfcxx . . $ g_test_fail_printf(326aeb464d16410c). ("file mismatch: %s %s\n", file1, file2);
141
142 g_freecxx . . $ g_free(5d22bdacc48458e8). (m1);
143 g_freecxx . . $ g_free(5d22bdacc48458e8). (m2);
144 }
145
146 static void
147 test_clipboard_roundtripcxx . . $ test_clipboard_roundtrip(facfdab5246d4be7). (const char *type,
148 const char *value,
149 const char *result)
150 {
151 GSubprocesscxx . . $ GSubprocess# *source, *target;
152 char *clipboard_client;
153 GErrorcxx . . $ GError# *error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
154 GDataInputStreamcxx . . $ GDataInputStream# *out;
155 gbooleancxx . . $ gboolean# done = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
156 char *stdout_buf = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
157 char *stderr_buf = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
158
159 if (gdk_display_get_default_seatcxx . . $ gdk_display_get_default_seat(b8d4640ca7588d07). (gdk_display_get_defaultcxx . . $ gdk_display_get_default(b31d93ef98fc5572). ()) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
160 {
161 g_test_skipcxx . . $ g_test_skip(85c52e162fed56f9). ("we have no seat, so focus won't work");
162 return;
163 }
164
165 clipboard_client = g_test_build_filenamecxx . . $ g_test_build_filename(522294ea697604e8). (G_TEST_BUILTcxx . . $ G_TEST_BUILT., "/clipboard-client", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
166
167 source = g_subprocess_newcxx . . $ g_subprocess_new(bb54ba45fdd6b73d). (G_SUBPROCESS_FLAGS_STDOUT_PIPEcxx . . $ G_SUBPROCESS_FLAGS_STDOUT_PIPE.,
168 &error,
169 clipboard_client,
170 "set", type, value, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
171 g_assert_no_errorcxx . . $ `<external>/15287032793271088244/gtestutils.h:217:9`! (error);
172
173 /* Wait until the first child has claimed the clipboard */
174 out = g_data_input_stream_newcxx . . $ g_data_input_stream_new(167e1bc3d6371291). (g_subprocess_get_stdout_pipecxx . . $ g_subprocess_get_stdout_pipe(6cd50eee412f95e3). (source));
175 g_data_input_stream_read_upto_asynccxx . . $ g_data_input_stream_read_upto_async(22f3e2d85ed5ae4b). (out, "\n", 1, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, read_upto_donecxx . . $ read_upto_done(aa1d200d824d915d)., &done);
176
177 while (!done)
178 g_main_context_iterationcxx . . $ g_main_context_iteration(53f508c65b8b33ab). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!);
179
180 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (out);
181
182 target = g_subprocess_newcxx . . $ g_subprocess_new(bb54ba45fdd6b73d). (G_SUBPROCESS_FLAGS_STDOUT_PIPEcxx . . $ G_SUBPROCESS_FLAGS_STDOUT_PIPE.,
183 &error,
184 clipboard_client,
185 "get", type, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
186
187 g_freecxx . . $ g_free(5d22bdacc48458e8). (clipboard_client);
188
189 if (!target)
190 {
191 g_test_failcxx . . $ g_test_fail(49f6e7a06ebc5aa8). ();
192 g_error_freecxx . . $ g_error_free(2ff7d11a2ecc01bd). (error);
193
194 g_subprocess_force_exitcxx . . $ g_subprocess_force_exit(afe8e387dd96f194). (source);
195 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (source);
196
197 return;
198 }
199
200 g_subprocess_communicate_utf8cxx . . $ g_subprocess_communicate_utf8(acc98a193b52d5a4). (target, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &stdout_buf, &stderr_buf, &error);
201
202 g_subprocess_force_exitcxx . . $ g_subprocess_force_exit(afe8e387dd96f194). (source);
203 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (source);
204
205 g_assert_no_errorcxx . . $ `<external>/15287032793271088244/gtestutils.h:217:9`! (error);
206
207 if (result)
208 g_assert_cmpstrcxx . . $ `<external>/15287032793271088244/gtestutils.h:46:9`! (stdout_buf, ==, result);
209 else if (g_str_has_prefixcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:159:9`! (stdout_buf, "ERROR"))
210 {
211 g_test_fail_printfcxx . . $ g_test_fail_printf(326aeb464d16410c). ("dest error: %s", stdout_buf);
212 }
213 else if (g_str_equalcxx . . $ `<external>/7714589265505779806/ghash.h:175:9`! (type, "image"))
214 {
215 GFilecxx . . $ GFile# *f1, *f2;
216 GdkTexturecxx . . $ GdkTexture# *t1, *t2;
217
218 f1 = g_file_new_for_pathcxx . . $ g_file_new_for_path(ba1fd5950b7d7bd5). (value);
219 f2 = g_file_new_for_pathcxx . . $ g_file_new_for_path(ba1fd5950b7d7bd5). (stdout_buf);
220
221 t1 = gdk_texture_new_from_filecxx . . $ gdk_texture_new_from_file(75d6ad717551ba72). (f1, &error);
222 g_assert_no_errorcxx . . $ `<external>/15287032793271088244/gtestutils.h:217:9`! (error);
223 t2 = gdk_texture_new_from_filecxx . . $ gdk_texture_new_from_file(75d6ad717551ba72). (f2, &error);
224 g_assert_no_errorcxx . . $ `<external>/15287032793271088244/gtestutils.h:217:9`! (error);
225
226 compare_texturescxx . . $ compare_textures(a1ad75661b2f0214). (t1, t2);
227
228 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (t1);
229 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (t2);
230 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (f1);
231 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (f2);
232 }
233 else if (g_str_equalcxx . . $ `<external>/7714589265505779806/ghash.h:175:9`! (type, "file"))
234 {
235 compare_filescxx . . $ compare_files(2fa786934fe80e24). (value, stdout_buf);
236 }
237 else if (g_str_equalcxx . . $ `<external>/7714589265505779806/ghash.h:175:9`! (type, "files"))
238 {
239 char **in_files, **out_files;
240
241 in_files = g_strsplitcxx . . $ g_strsplit(656a2b498280081). (value, ":", -1);
242 out_files = g_strsplitcxx . . $ g_strsplit(656a2b498280081). (stdout_buf, ":", -1);
243
244 g_assert_cmpintcxx . . $ `<external>/15287032793271088244/gtestutils.h:53:9`! (g_strv_length (in_files), ==, g_strv_length (out_files));
245 for (int i = 0; in_files[i]; i++)
246 compare_filescxx . . $ compare_files(2fa786934fe80e24). (in_files[i], out_files[i]);
247
248 g_strfreevcxx . . $ g_strfreev(3ed91490e421178f). (in_files);
249 g_strfreevcxx . . $ g_strfreev(3ed91490e421178f). (out_files);
250 }
251
252 g_assert_nullcxx . . $ `<external>/15287032793271088244/gtestutils.h:250:9`! (stderr_buf);
253 g_freecxx . . $ g_free(5d22bdacc48458e8). (stdout_buf);
254 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (target);
255 }
256
257 static void
258 test_clipboard_stringcxx . . $ test_clipboard_string(49f6e7a06ebc5aa8). (void)
259 {
260 test_clipboard_roundtripcxx . . $ test_clipboard_roundtrip(facfdab5246d4be7). ("string", "abcdef1230", "abcdef1230");
261 }
262
263 static void
264 test_clipboard_textcxx . . $ test_clipboard_text(49f6e7a06ebc5aa8). (void)
265 {
266 char *filename;
267
268 filename = g_test_build_filenamecxx . . $ g_test_build_filename(522294ea697604e8). (G_TEST_DISTcxx . . $ G_TEST_DIST., "clipboard-data", "test.txt", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
269
270 test_clipboard_roundtripcxx . . $ test_clipboard_roundtrip(facfdab5246d4be7). ("text", filename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
271
272 g_freecxx . . $ g_free(5d22bdacc48458e8). (filename);
273 }
274
275 static void
276 test_clipboard_imagecxx . . $ test_clipboard_image(49f6e7a06ebc5aa8). (void)
277 {
278 char *filename;
279
280 filename = g_test_build_filenamecxx . . $ g_test_build_filename(522294ea697604e8). (G_TEST_DISTcxx . . $ G_TEST_DIST., "clipboard-data", "image.png", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
281
282 test_clipboard_roundtripcxx . . $ test_clipboard_roundtrip(facfdab5246d4be7). ("image", filename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
283 }
284
285 static void
286 test_clipboard_colorcxx . . $ test_clipboard_color(49f6e7a06ebc5aa8). (void)
287 {
288 test_clipboard_roundtripcxx . . $ test_clipboard_roundtrip(facfdab5246d4be7). ("color", "red", "rgb(255,0,0)");
289 }
290
291 static void
292 test_clipboard_filecxx . . $ test_clipboard_file(49f6e7a06ebc5aa8). (void)
293 {
294 char *filename;
295
296 filename = g_test_build_filenamecxx . . $ g_test_build_filename(522294ea697604e8). (G_TEST_DISTcxx . . $ G_TEST_DIST., "clipboard-data", "test.txt", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
297
298 test_clipboard_roundtripcxx . . $ test_clipboard_roundtrip(facfdab5246d4be7). ("file", filename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
299
300 g_freecxx . . $ g_free(5d22bdacc48458e8). (filename);
301 }
302
303 static void
304 test_clipboard_filescxx . . $ test_clipboard_files(49f6e7a06ebc5aa8). (void)
305 {
306 char **filenames;
307 char *string;
308
309 filenames = g_newcxx . . $ `<external>/1123956534522462559/gmem.h:318:9`! (char *, 3);
310 filenames[0] = g_test_build_filenamecxx . . $ g_test_build_filename(522294ea697604e8). (G_TEST_DISTcxx . . $ G_TEST_DIST., "clipboard-data", "image.png", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
311 filenames[1] = g_test_build_filenamecxx . . $ g_test_build_filename(522294ea697604e8). (G_TEST_DISTcxx . . $ G_TEST_DIST., "clipboard-data", "test.txt", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
312 filenames[2] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
313
314 string = g_strjoinvcxx . . $ g_strjoinv(3bdede71480c687a). (":", filenames);
315
316 test_clipboard_roundtripcxx . . $ test_clipboard_roundtrip(facfdab5246d4be7). ("files", string, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
317
318 g_freecxx . . $ g_free(5d22bdacc48458e8). (string);
319 g_strfreevcxx . . $ g_strfreev(3ed91490e421178f). (filenames);
320 }
321
322 static void
323 buffer_receivedcxx . . $ buffer_received(aa1d200d824d915d). (GObjectcxx . . $ GObject# *source,
324 GAsyncResultcxx . . $ GAsyncResult# *res,
325 gpointercxx . . $ gpointer# data)
326 {
327 GdkClipboardcxx . . $ GdkClipboard# *clipboard = GDK_CLIPBOARDcxx . . $ `gdk/gdkclipboard.h:30:9`! (source);
328 gbooleancxx . . $ gboolean# *done = data;
329 GErrorcxx . . $ GError# *error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
330 const GValuecxx . . $ GValue# *value;
331 GtkTextBuffercxx . . $ GtkTextBuffer# *buffer;
332 GtkTextItercxx . . $ GtkTextIter# start, end;
333 char *text;
334
335 value = gdk_clipboard_read_value_finishcxx . . $ gdk_clipboard_read_value_finish(708330c606b78864). (clipboard, res, &error);
336
337 g_assert_no_errorcxx . . $ `<external>/15287032793271088244/gtestutils.h:217:9`! (error);
338 buffer = g_value_get_objectcxx . . $ g_value_get_object(e12dff36056c2cce). (value);
339 gtk_text_buffer_get_boundscxx . . $ gtk_text_buffer_get_bounds(741f0515baba5eec). (buffer, &start, &end);
340 text = gtk_text_buffer_get_textcxx . . $ gtk_text_buffer_get_text(5f28688a806c8c70). (buffer, &start, &end, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!);
341
342 g_assert_cmpstrcxx . . $ `<external>/15287032793271088244/gtestutils.h:46:9`! (text, ==, "üäö");
343
344 g_freecxx . . $ g_free(5d22bdacc48458e8). (text);
345
346 *done = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
347
348 g_main_context_wakeupcxx . . $ g_main_context_wakeup(2c4f9bc69c34eb5d). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
349 }
350
351 static void
352 test_clipboard_string_to_buffercxx . . $ test_clipboard_string_to_buffer(49f6e7a06ebc5aa8). (void)
353 {
354 GdkDisplaycxx . . $ GdkDisplay# *display;
355 GdkClipboardcxx . . $ GdkClipboard# *clipboard;
356 gbooleancxx . . $ gboolean# done;
357 GtkTextBuffercxx . . $ GtkTextBuffer# *b;
358
359 b = gtk_text_buffer_newcxx . . $ gtk_text_buffer_new(539b20931c5c334d). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); // Just to register serializers
360
361 display = gdk_display_get_defaultcxx . . $ gdk_display_get_default(b31d93ef98fc5572). ();
362 clipboard = gdk_display_get_clipboardcxx . . $ gdk_display_get_clipboard(d64e200b8dbcc2a2). (display);
363
364 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gdk_clipboard_get_display (clipboard) == display);
365
366 gdk_clipboard_set_textcxx . . $ gdk_clipboard_set_text(cd5df9b714d66581). (clipboard, "üäö");
367
368 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gdk_clipboard_is_local (clipboard));
369
370 done = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
371
372 gdk_clipboard_read_value_asynccxx . . $ gdk_clipboard_read_value_async(c49ccd03e6b586be). (clipboard, GTK_TYPE_TEXT_BUFFERcxx . . $ `gtk/gtktextbuffer.h:39:9`!,
373 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, buffer_receivedcxx . . $ buffer_received(aa1d200d824d915d)., &done);
374
375 while (!done)
376 g_main_context_iterationcxx . . $ g_main_context_iteration(53f508c65b8b33ab). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!);
377
378 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (b);
379 }
380
381 static void
382 string_receivedcxx . . $ string_received(aa1d200d824d915d). (GObjectcxx . . $ GObject# *source,
383 GAsyncResultcxx . . $ GAsyncResult# *res,
384 gpointercxx . . $ gpointer# data)
385 {
386 GdkClipboardcxx . . $ GdkClipboard# *clipboard = GDK_CLIPBOARDcxx . . $ `gdk/gdkclipboard.h:30:9`! (source);
387 gbooleancxx . . $ gboolean# *done = data;
388 GErrorcxx . . $ GError# *error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
389 char *string;
390
391 string = gdk_clipboard_read_text_finishcxx . . $ gdk_clipboard_read_text_finish(54092aaf66d91230). (clipboard, res, &error);
392
393 g_assert_no_errorcxx . . $ `<external>/15287032793271088244/gtestutils.h:217:9`! (error);
394 g_assert_cmpstrcxx . . $ `<external>/15287032793271088244/gtestutils.h:46:9`! (string, ==, "üäö");
395
396 g_freecxx . . $ g_free(5d22bdacc48458e8). (string);
397
398 *done = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
399
400 g_main_context_wakeupcxx . . $ g_main_context_wakeup(2c4f9bc69c34eb5d). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
401 }
402
403 static void
404 test_clipboard_buffer_to_stringcxx . . $ test_clipboard_buffer_to_string(49f6e7a06ebc5aa8). (void)
405 {
406 GdkDisplaycxx . . $ GdkDisplay# *display;
407 GdkClipboardcxx . . $ GdkClipboard# *clipboard;
408 gbooleancxx . . $ gboolean# done;
409 GtkTextBuffercxx . . $ GtkTextBuffer# *buffer;
410 GtkTextItercxx . . $ GtkTextIter# start, end;
411 GdkContentFormatscxx . . $ GdkContentFormats# *formats;
412
413 buffer = gtk_text_buffer_newcxx . . $ gtk_text_buffer_new(539b20931c5c334d). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
414
415 gtk_text_buffer_set_textcxx . . $ gtk_text_buffer_set_text(976fd2fc6f1d498). (buffer, "üäö", -1);
416
417 gtk_text_buffer_get_boundscxx . . $ gtk_text_buffer_get_bounds(741f0515baba5eec). (buffer, &start, &end);
418 gtk_text_buffer_select_rangecxx . . $ gtk_text_buffer_select_range(649a8bab240be7e1). (buffer, &start, &end);
419
420 display = gdk_display_get_defaultcxx . . $ gdk_display_get_default(b31d93ef98fc5572). ();
421 clipboard = gdk_display_get_clipboardcxx . . $ gdk_display_get_clipboard(d64e200b8dbcc2a2). (display);
422
423 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gdk_clipboard_get_display (clipboard) == display);
424
425 gdk_clipboard_setcxx . . $ gdk_clipboard_set(bba2fd18b808f219). (clipboard, GTK_TYPE_TEXT_BUFFERcxx . . $ `gtk/gtktextbuffer.h:39:9`!, buffer);
426
427 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gdk_clipboard_is_local (clipboard));
428
429 formats = gdk_clipboard_get_formatscxx . . $ gdk_clipboard_get_formats(cdb13c78b99f48d7). (clipboard);
430 g_assert_truecxx . . $ `<external>/15287032793271088244/gtestutils.h:227:9`! (gdk_content_formats_contain_gtype (formats, G_TYPE_STRINGcxx . . $ `<external>/9567554376676449156/gtype.h:165:9`!));
431
432 done = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
433
434 gdk_clipboard_read_text_asynccxx . . $ gdk_clipboard_read_text_async(4aa0f14124bbed7e). (clipboard, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, string_receivedcxx . . $ string_received(aa1d200d824d915d)., &done);
435
436 while (!done)
437 g_main_context_iterationcxx . . $ g_main_context_iteration(53f508c65b8b33ab). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!);
438
439 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (buffer);
440 }
441
442 int
443 maincxx . . $ main(afcd3168fc1188a4). (int argc, char *argv[])
444 {
445 (g_test_initcxx . . $ g_test_init(b91bcc5cc1349d78).) (&argc, &argv, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
446
447 gtk_initcxx . . $ gtk_init(49f6e7a06ebc5aa8). ();
448
449 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/clipboard/basic", test_clipboard_basiccxx . . $ test_clipboard_basic(49f6e7a06ebc5aa8).);
450 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/clipboard/string", test_clipboard_stringcxx . . $ test_clipboard_string(49f6e7a06ebc5aa8).);
451 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/clipboard/text", test_clipboard_textcxx . . $ test_clipboard_text(49f6e7a06ebc5aa8).);
452 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/clipboard/image", test_clipboard_imagecxx . . $ test_clipboard_image(49f6e7a06ebc5aa8).);
453 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/clipboard/color", test_clipboard_colorcxx . . $ test_clipboard_color(49f6e7a06ebc5aa8).);
454 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/clipboard/file", test_clipboard_filecxx . . $ test_clipboard_file(49f6e7a06ebc5aa8).);
455 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/clipboard/files", test_clipboard_filescxx . . $ test_clipboard_files(49f6e7a06ebc5aa8).);
456 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/clipboard/string-to-buffer", test_clipboard_string_to_buffercxx . . $ test_clipboard_string_to_buffer(49f6e7a06ebc5aa8).);
457 g_test_add_funccxx . . $ g_test_add_func(18fee6cbb4bb18a4). ("/clipboard/buffer-to-string", test_clipboard_buffer_to_stringcxx . . $ test_clipboard_buffer_to_string(49f6e7a06ebc5aa8).);
458
459 return g_test_runcxx . . $ g_test_run(b126dc7c1de90089). ();
460 }