SDL

Форк
0
/
testautomation_clipboard.c 
589 строк · 21.3 Кб
1
/**
2
 * New/updated tests: aschiffler at ferzkopp dot net
3
 */
4
#include <SDL3/SDL.h>
5
#include <SDL3/SDL_test.h>
6
#include "testautomation_suites.h"
7

8
/* ================= Test Case Implementation ================== */
9

10
static int clipboard_update_count;
11

12
static SDL_bool ClipboardEventWatch(void *userdata, SDL_Event *event)
13
{
14
    if (event->type == SDL_EVENT_CLIPBOARD_UPDATE) {
15
        ++clipboard_update_count;
16
    }
17
    return SDL_TRUE;
18
}
19

20
enum
21
{
22
    TEST_MIME_TYPE_TEXT,
23
    TEST_MIME_TYPE_CUSTOM_TEXT,
24
    TEST_MIME_TYPE_DATA,
25
    NUM_TEST_MIME_TYPES
26
};
27
static const char *test_mime_types[] = {
28
    "text/plain;charset=utf-8",
29
    "test/text",
30
    "test/data"
31
};
32
SDL_COMPILE_TIME_ASSERT(test_mime_types, SDL_arraysize(test_mime_types) == NUM_TEST_MIME_TYPES);
33

34
typedef struct
35
{
36
    const void *data;
37
    size_t data_size;
38
} TestClipboardData;
39

40
static int clipboard_callback_count;
41

42
static const void *ClipboardDataCallback(void *userdata, const char *mime_type, size_t *length)
43
{
44
    TestClipboardData *test_data = (TestClipboardData *)userdata;
45

46
    ++clipboard_callback_count;
47

48
    if (SDL_strcmp(mime_type, test_mime_types[TEST_MIME_TYPE_TEXT]) == 0) {
49
        /* We're returning the string "TEST", with no termination */
50
        static const char *test_text = "XXX TEST XXX";
51
        *length = 4;
52
        return test_text + 4;
53
    }
54
    if (SDL_strcmp(mime_type, test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT]) == 0) {
55
        /* We're returning the string "CUSTOM", with no termination */
56
        static const char *custom_text = "XXX CUSTOM XXX";
57
        *length = 6;
58
        return custom_text + 4;
59
    }
60
    if (SDL_strcmp(mime_type, test_mime_types[TEST_MIME_TYPE_DATA]) == 0) {
61
        *length = test_data->data_size;
62
        return test_data->data;
63
    }
64
    return NULL;
65
}
66

67
static int clipboard_cleanup_count;
68

69
static void ClipboardCleanupCallback(void *userdata)
70
{
71
    ++clipboard_cleanup_count;
72
}
73

74
/* Test case functions */
75

76
/**
77
 * End-to-end test of SDL_xyzClipboardData functions
78
 * \sa SDL_HasClipboardData
79
 * \sa SDL_GetClipboardData
80
 * \sa SDL_SetClipboardData
81
 */
82
static int clipboard_testClipboardDataFunctions(void *arg)
83
{
84
    int result = -1;
85
    SDL_bool boolResult;
86
    int last_clipboard_update_count;
87
    int last_clipboard_callback_count;
88
    int last_clipboard_cleanup_count;
89
    void *data;
90
    size_t size;
91
    char *text;
92
    const char *expected_text;
93

94
    TestClipboardData test_data1 = {
95
        &test_data1,
96
        sizeof(test_data1)
97
    };
98
    TestClipboardData test_data2 = {
99
        &last_clipboard_callback_count,
100
        sizeof(last_clipboard_callback_count)
101
    };
102

103
    SDL_AddEventWatch(ClipboardEventWatch, NULL);
104

105
    /* Test clearing clipboard data */
106
    result = SDL_ClearClipboardData();
107
    SDLTest_AssertCheck(
108
        result == 0,
109
        "Validate SDL_ClearClipboardData result, expected 0, got %i",
110
        result);
111

112
    /* Test clearing clipboard data when it's already clear */
113
    last_clipboard_update_count = clipboard_update_count;
114
    result = SDL_ClearClipboardData();
115
    SDLTest_AssertCheck(
116
        result == 0,
117
        "Validate SDL_ClearClipboardData result, expected 0, got %i",
118
        result);
119
    SDLTest_AssertCheck(
120
        clipboard_update_count == last_clipboard_update_count,
121
        "Verify clipboard update unchanged, got %d",
122
        clipboard_update_count - last_clipboard_update_count);
123

124
    /* Validate error handling */
125
    last_clipboard_update_count = clipboard_update_count;
126
    result = SDL_SetClipboardData(NULL, NULL, NULL, test_mime_types, SDL_arraysize(test_mime_types));
127
    SDLTest_AssertCheck(
128
        result == -1,
129
        "Validate SDL_SetClipboardData(invalid) result, expected -1, got %i",
130
        result);
131
    SDLTest_AssertCheck(
132
        clipboard_update_count == last_clipboard_update_count,
133
        "Verify clipboard update count unchanged, got %d",
134
        clipboard_update_count - last_clipboard_update_count);
135

136
    last_clipboard_update_count = clipboard_update_count;
137
    result = SDL_SetClipboardData(ClipboardDataCallback, ClipboardCleanupCallback, NULL, NULL, 0);
138
    SDLTest_AssertCheck(
139
        result == -1,
140
        "Validate SDL_SetClipboardData(invalid) result, expected -1, got %i",
141
        result);
142
    SDLTest_AssertCheck(
143
        clipboard_update_count == last_clipboard_update_count,
144
        "Verify clipboard update count unchanged, got %d",
145
        clipboard_update_count - last_clipboard_update_count);
146

147
    /* Test setting and getting clipboard data */
148
    last_clipboard_update_count = clipboard_update_count;
149
    last_clipboard_callback_count = clipboard_callback_count;
150
    last_clipboard_cleanup_count = clipboard_cleanup_count;
151
    result = SDL_SetClipboardData(ClipboardDataCallback, ClipboardCleanupCallback, &test_data1, test_mime_types, SDL_arraysize(test_mime_types));
152
    SDLTest_AssertCheck(
153
        result == 0,
154
        "Validate SDL_SetClipboardData(test_data1) result, expected 0, got %i",
155
        result);
156
    SDLTest_AssertCheck(
157
        clipboard_update_count == last_clipboard_update_count + 1,
158
        "Verify clipboard update count incremented by 1, got %d",
159
        clipboard_update_count - last_clipboard_update_count);
160
    SDLTest_AssertCheck(
161
        clipboard_cleanup_count == last_clipboard_cleanup_count,
162
        "Verify clipboard cleanup count unchanged, got %d",
163
        clipboard_cleanup_count - last_clipboard_cleanup_count);
164

165
    expected_text = "TEST";
166
    text = SDL_GetClipboardText();
167
    SDLTest_AssertCheck(
168
        text && SDL_strcmp(text, expected_text) == 0,
169
        "Verify clipboard text, expected \"%s\", got \"%s\"",
170
        expected_text, text);
171
    SDL_free(text);
172

173
    boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT]);
174
    SDLTest_AssertCheck(
175
        boolResult,
176
        "Verify has test text data, expected SDL_TRUE, got SDL_FALSE");
177
    text = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT], &size);
178
    SDLTest_AssertCheck(
179
        text != NULL,
180
        "Verify has test text data, expected valid result, got NULL");
181
    if (text) {
182
        SDLTest_AssertCheck(
183
            text[size] == '\0',
184
            "Verify test text data, expected null termination, got %c",
185
            text[size]);
186
        SDLTest_AssertCheck(
187
            SDL_strcmp(text, expected_text) == 0,
188
            "Verify test text data, expected \"%s\", got \"%s\"",
189
            expected_text, text);
190
    }
191
    SDLTest_AssertCheck(
192
        size == SDL_strlen(expected_text),
193
        "Verify test text size, expected %d, got %d",
194
        (int)SDL_strlen(expected_text), (int)size);
195
    SDL_free(text);
196

197
    expected_text = "CUSTOM";
198
    boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT]);
199
    SDLTest_AssertCheck(
200
        boolResult,
201
        "Verify has test text data, expected SDL_TRUE, got SDL_FALSE");
202
    text = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT], &size);
203
    SDLTest_AssertCheck(
204
        text != NULL,
205
        "Verify has test text data, expected valid result, got NULL");
206
    if (text) {
207
        SDLTest_AssertCheck(
208
            text[size] == '\0',
209
            "Verify test text data, expected null termination, got %c",
210
            text[size]);
211
        SDLTest_AssertCheck(
212
            SDL_strcmp(text, expected_text) == 0,
213
            "Verify test text data, expected \"%s\", got \"%s\"",
214
            expected_text, text);
215
    }
216
    SDLTest_AssertCheck(
217
        size == SDL_strlen(expected_text),
218
        "Verify test text size, expected %d, got %d",
219
        (int)SDL_strlen(expected_text), (int)size);
220
    SDL_free(text);
221

222
    boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_DATA]);
223
    SDLTest_AssertCheck(
224
        boolResult,
225
        "Verify has test text data, expected SDL_TRUE, got SDL_FALSE");
226
    data = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_DATA], &size);
227
    SDLTest_AssertCheck(
228
        data && SDL_memcmp(data, test_data1.data, test_data1.data_size) == 0,
229
        "Verify test data");
230
    SDLTest_AssertCheck(
231
        size == test_data1.data_size,
232
        "Verify test data size, expected %d, got %d",
233
        (int)test_data1.data_size, (int)size);
234
    SDL_free(data);
235

236
    boolResult = SDL_HasClipboardData("test/invalid");
237
    SDLTest_AssertCheck(
238
        !boolResult,
239
        "Verify has test text data, expected SDL_FALSE, got SDL_TRUE");
240
    data = SDL_GetClipboardData("test/invalid", &size);
241
    SDLTest_AssertCheck(
242
        data == NULL,
243
        "Verify invalid data, expected NULL, got %p",
244
        data);
245
    SDLTest_AssertCheck(
246
        size == 0,
247
        "Verify invalid data size, expected 0, got %d",
248
        (int)size);
249
    SDL_free(data);
250

251
#if 0 /* There's no guarantee how or when the callback is called */
252
    SDLTest_AssertCheck(
253
        (clipboard_callback_count == last_clipboard_callback_count + 3) ||
254
        (clipboard_callback_count == last_clipboard_callback_count + 4),
255
        "Verify clipboard callback count incremented by 3 or 4, got %d",
256
        clipboard_callback_count - last_clipboard_callback_count);
257
#endif
258

259
    /* Test setting and getting clipboard data again */
260
    last_clipboard_update_count = clipboard_update_count;
261
    last_clipboard_callback_count = clipboard_callback_count;
262
    last_clipboard_cleanup_count = clipboard_cleanup_count;
263
    result = SDL_SetClipboardData(ClipboardDataCallback, ClipboardCleanupCallback, &test_data2, test_mime_types, SDL_arraysize(test_mime_types));
264
    SDLTest_AssertCheck(
265
        result == 0,
266
        "Validate SDL_SetClipboardData(test_data2) result, expected 0, got %i",
267
        result);
268
    SDLTest_AssertCheck(
269
        clipboard_update_count == last_clipboard_update_count + 1,
270
        "Verify clipboard update count incremented by 1, got %d",
271
        clipboard_update_count - last_clipboard_update_count);
272
    SDLTest_AssertCheck(
273
        clipboard_cleanup_count == last_clipboard_cleanup_count + 1,
274
        "Verify clipboard cleanup count incremented by 1, got %d",
275
        clipboard_cleanup_count - last_clipboard_cleanup_count);
276

277
    expected_text = "TEST";
278
    text = SDL_GetClipboardText();
279
    SDLTest_AssertCheck(
280
        text && SDL_strcmp(text, expected_text) == 0,
281
        "Verify clipboard text, expected \"%s\", got \"%s\"",
282
        expected_text, text);
283
    SDL_free(text);
284

285
    boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT]);
286
    SDLTest_AssertCheck(
287
        boolResult,
288
        "Verify has test text data, expected SDL_TRUE, got SDL_FALSE");
289
    text = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT], &size);
290
    SDLTest_AssertCheck(
291
        text != NULL,
292
        "Verify has test text data, expected valid result, got NULL");
293
    if (text) {
294
        SDLTest_AssertCheck(
295
            text[size] == '\0',
296
            "Verify test text data, expected null termination, got %c",
297
            text[size]);
298
        SDLTest_AssertCheck(
299
            SDL_strcmp(text, expected_text) == 0,
300
            "Verify test text data, expected \"%s\", got \"%s\"",
301
            expected_text, text);
302
    }
303
    SDLTest_AssertCheck(
304
        size == SDL_strlen(expected_text),
305
        "Verify test text size, expected %d, got %d",
306
        (int)SDL_strlen(expected_text), (int)size);
307
    SDL_free(text);
308

309
    expected_text = "CUSTOM";
310
    boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT]);
311
    SDLTest_AssertCheck(
312
        boolResult,
313
        "Verify has test text data, expected SDL_TRUE, got SDL_FALSE");
314
    text = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT], &size);
315
    SDLTest_AssertCheck(
316
        text != NULL,
317
        "Verify has test text data, expected valid result, got NULL");
318
    if (text) {
319
        SDLTest_AssertCheck(
320
            text[size] == '\0',
321
            "Verify test text data, expected null termination, got %c",
322
            text[size]);
323
        SDLTest_AssertCheck(
324
            SDL_strcmp(text, expected_text) == 0,
325
            "Verify test text data, expected \"%s\", got \"%s\"",
326
            expected_text, text);
327
    }
328
    SDLTest_AssertCheck(
329
        size == SDL_strlen(expected_text),
330
        "Verify test text size, expected %d, got %d",
331
        (int)SDL_strlen(expected_text), (int)size);
332
    SDL_free(text);
333

334
    data = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_DATA], &size);
335
    SDLTest_AssertCheck(
336
        data && SDL_memcmp(data, test_data2.data, test_data2.data_size) == 0,
337
        "Verify test data");
338
    SDLTest_AssertCheck(
339
        size == test_data2.data_size,
340
        "Verify test data size, expected %d, got %d",
341
        (int)test_data2.data_size, (int)size);
342
    SDL_free(data);
343

344
    data = SDL_GetClipboardData("test/invalid", &size);
345
    SDLTest_AssertCheck(
346
        data == NULL,
347
        "Verify invalid data, expected NULL, got %p",
348
        data);
349
    SDLTest_AssertCheck(
350
        size == 0,
351
        "Verify invalid data size, expected 0, got %d",
352
        (int)size);
353
    SDL_free(data);
354

355
#if 0 /* There's no guarantee how or when the callback is called */
356
    SDLTest_AssertCheck(
357
        (clipboard_callback_count == last_clipboard_callback_count + 3) ||
358
            (clipboard_callback_count == last_clipboard_callback_count + 4),
359
        "Verify clipboard callback count incremented by 3 or 4, got %d",
360
        clipboard_callback_count - last_clipboard_callback_count);
361
#endif
362

363
    /* Test clearing clipboard data when has data */
364
    last_clipboard_update_count = clipboard_update_count;
365
    last_clipboard_cleanup_count = clipboard_cleanup_count;
366
    result = SDL_ClearClipboardData();
367
    SDLTest_AssertCheck(
368
        result == 0,
369
        "Validate SDL_ClearClipboardData result, expected 0, got %i",
370
        result);
371
    SDLTest_AssertCheck(
372
        clipboard_update_count == last_clipboard_update_count + 1,
373
        "Verify clipboard update count incremented by 1, got %d",
374
        clipboard_update_count - last_clipboard_update_count);
375
    SDLTest_AssertCheck(
376
        clipboard_cleanup_count == last_clipboard_cleanup_count + 1,
377
        "Verify clipboard cleanup count incremented by 1, got %d",
378
        clipboard_cleanup_count - last_clipboard_cleanup_count);
379
    boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT]);
380
    SDLTest_AssertCheck(
381
        !boolResult,
382
        "Verify has test text data, expected SDL_FALSE, got SDL_TRUE");
383
    boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_DATA]);
384
    SDLTest_AssertCheck(
385
        !boolResult,
386
        "Verify has test text data, expected SDL_FALSE, got SDL_TRUE");
387
    boolResult = SDL_HasClipboardData("test/invalid");
388
    SDLTest_AssertCheck(
389
        !boolResult,
390
        "Verify has test text data, expected SDL_FALSE, got SDL_TRUE");
391

392
    SDL_DelEventWatch(ClipboardEventWatch, NULL);
393

394
    return TEST_COMPLETED;
395
}
396

397
/**
398
 * End-to-end test of SDL_xyzClipboardText functions
399
 * \sa SDL_HasClipboardText
400
 * \sa SDL_GetClipboardText
401
 * \sa SDL_SetClipboardText
402
 */
403
static int clipboard_testClipboardTextFunctions(void *arg)
404
{
405
    char *textRef = SDLTest_RandomAsciiString();
406
    char *text = SDL_strdup(textRef);
407
    SDL_bool boolResult;
408
    int intResult;
409
    char *charResult;
410
    int last_clipboard_update_count;
411

412
    SDL_AddEventWatch(ClipboardEventWatch, NULL);
413

414
    /* Empty clipboard text */
415
    last_clipboard_update_count = clipboard_update_count;
416
    intResult = SDL_SetClipboardText(NULL);
417
    SDLTest_AssertCheck(
418
        intResult == 0,
419
        "Verify result from SDL_SetClipboardText(NULL), expected 0, got %i",
420
        intResult);
421
    charResult = SDL_GetClipboardText();
422
    SDLTest_AssertCheck(
423
        charResult && SDL_strcmp(charResult, "") == 0,
424
        "Verify SDL_GetClipboardText returned \"\", got %s",
425
        charResult);
426
    SDL_free(charResult);
427
    boolResult = SDL_HasClipboardText();
428
    SDLTest_AssertCheck(
429
        boolResult == SDL_FALSE,
430
        "Verify SDL_HasClipboardText returned SDL_FALSE, got %s",
431
        (boolResult) ? "SDL_TRUE" : "SDL_FALSE");
432
    SDLTest_AssertCheck(
433
        clipboard_update_count == last_clipboard_update_count,
434
        "Verify clipboard update unchanged, got %d",
435
        clipboard_update_count - last_clipboard_update_count);
436

437

438
    /* Set clipboard text  */
439
    last_clipboard_update_count = clipboard_update_count;
440
    intResult = SDL_SetClipboardText(text);
441
    SDLTest_AssertCheck(
442
        intResult == 0,
443
        "Verify result from SDL_SetClipboardText(%s), expected 0, got %i", text,
444
        intResult);
445
    SDLTest_AssertCheck(
446
        SDL_strcmp(textRef, text) == 0,
447
        "Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'",
448
        textRef, text);
449
    boolResult = SDL_HasClipboardText();
450
    SDLTest_AssertCheck(
451
        boolResult == SDL_TRUE,
452
        "Verify SDL_HasClipboardText returned SDL_TRUE, got %s",
453
        (boolResult) ? "SDL_TRUE" : "SDL_FALSE");
454
    charResult = SDL_GetClipboardText();
455
    SDLTest_AssertCheck(
456
        charResult && SDL_strcmp(textRef, charResult) == 0,
457
        "Verify SDL_GetClipboardText returned correct string, expected '%s', got '%s'",
458
        textRef, charResult);
459
    SDL_free(charResult);
460
    SDLTest_AssertCheck(
461
        clipboard_update_count == last_clipboard_update_count + 1,
462
        "Verify clipboard update count incremented by 1, got %d",
463
        clipboard_update_count - last_clipboard_update_count);
464

465
    /* Reset clipboard text */
466
    intResult = SDL_SetClipboardText(NULL);
467
    SDLTest_AssertCheck(
468
        intResult == 0,
469
        "Verify result from SDL_SetClipboardText(NULL), expected 0, got %i",
470
        intResult);
471

472
    /* Cleanup */
473
    SDL_free(textRef);
474
    SDL_free(text);
475

476
    SDL_DelEventWatch(ClipboardEventWatch, NULL);
477

478
    return TEST_COMPLETED;
479
}
480

481
/**
482
 * End-to-end test of SDL_xyzPrimarySelectionText functions
483
 * \sa SDL_HasPrimarySelectionText
484
 * \sa SDL_GetPrimarySelectionText
485
 * \sa SDL_SetPrimarySelectionText
486
 */
487
static int clipboard_testPrimarySelectionTextFunctions(void *arg)
488
{
489
    char *textRef = SDLTest_RandomAsciiString();
490
    char *text = SDL_strdup(textRef);
491
    SDL_bool boolResult;
492
    int intResult;
493
    char *charResult;
494
    int last_clipboard_update_count;
495

496
    SDL_AddEventWatch(ClipboardEventWatch, NULL);
497

498
    /* Empty primary selection */
499
    last_clipboard_update_count = clipboard_update_count;
500
    intResult = SDL_SetPrimarySelectionText(NULL);
501
    SDLTest_AssertCheck(
502
        intResult == 0,
503
        "Verify result from SDL_SetPrimarySelectionText(NULL), expected 0, got %i",
504
        intResult);
505
    charResult = SDL_GetPrimarySelectionText();
506
    SDLTest_AssertCheck(
507
        charResult && SDL_strcmp(charResult, "") == 0,
508
        "Verify SDL_GetPrimarySelectionText returned \"\", got %s",
509
        charResult);
510
    SDL_free(charResult);
511
    boolResult = SDL_HasPrimarySelectionText();
512
    SDLTest_AssertCheck(
513
        boolResult == SDL_FALSE,
514
        "Verify SDL_HasPrimarySelectionText returned SDL_FALSE, got %s",
515
        (boolResult) ? "SDL_TRUE" : "SDL_FALSE");
516
    SDLTest_AssertCheck(
517
        clipboard_update_count == last_clipboard_update_count + 1,
518
        "Verify clipboard update count incremented by 1, got %d",
519
        clipboard_update_count - last_clipboard_update_count);
520

521
    /* Set primary selection  */
522
    last_clipboard_update_count = clipboard_update_count;
523
    intResult = SDL_SetPrimarySelectionText(text);
524
    SDLTest_AssertCheck(
525
        intResult == 0,
526
        "Verify result from SDL_SetPrimarySelectionText(%s), expected 0, got %i", text,
527
        intResult);
528
    SDLTest_AssertCheck(
529
        SDL_strcmp(textRef, text) == 0,
530
        "Verify SDL_SetPrimarySelectionText did not modify input string, expected '%s', got '%s'",
531
        textRef, text);
532
    boolResult = SDL_HasPrimarySelectionText();
533
    SDLTest_AssertCheck(
534
        boolResult == SDL_TRUE,
535
        "Verify SDL_HasPrimarySelectionText returned SDL_TRUE, got %s",
536
        (boolResult) ? "SDL_TRUE" : "SDL_FALSE");
537
    charResult = SDL_GetPrimarySelectionText();
538
    SDLTest_AssertCheck(
539
        charResult && SDL_strcmp(textRef, charResult) == 0,
540
        "Verify SDL_GetPrimarySelectionText returned correct string, expected '%s', got '%s'",
541
        textRef, charResult);
542
    SDL_free(charResult);
543
    SDLTest_AssertCheck(
544
        clipboard_update_count == last_clipboard_update_count + 1,
545
        "Verify clipboard update count incremented by 1, got %d",
546
        clipboard_update_count - last_clipboard_update_count);
547

548
    /* Reset primary selection */
549
    intResult = SDL_SetPrimarySelectionText(NULL);
550
    SDLTest_AssertCheck(
551
        intResult == 0,
552
        "Verify result from SDL_SetPrimarySelectionText(NULL), expected 0, got %i",
553
        intResult);
554

555
    /* Cleanup */
556
    SDL_free(textRef);
557
    SDL_free(text);
558

559
    SDL_DelEventWatch(ClipboardEventWatch, NULL);
560

561
    return TEST_COMPLETED;
562
}
563

564
/* ================= Test References ================== */
565

566
static const SDLTest_TestCaseReference clipboardTest1 = {
567
    (SDLTest_TestCaseFp)clipboard_testClipboardDataFunctions, "clipboard_testClipboardDataFunctions", "End-to-end test of SDL_xyzClipboardData functions", TEST_ENABLED
568
};
569

570
static const SDLTest_TestCaseReference clipboardTest2 = {
571
    (SDLTest_TestCaseFp)clipboard_testClipboardTextFunctions, "clipboard_testClipboardTextFunctions", "End-to-end test of SDL_xyzClipboardText functions", TEST_ENABLED
572
};
573

574
static const SDLTest_TestCaseReference clipboardTest3 = {
575
    (SDLTest_TestCaseFp)clipboard_testPrimarySelectionTextFunctions, "clipboard_testPrimarySelectionTextFunctions", "End-to-end test of SDL_xyzPrimarySelectionText functions", TEST_ENABLED
576
};
577

578
/* Sequence of Clipboard test cases */
579
static const SDLTest_TestCaseReference *clipboardTests[] = {
580
    &clipboardTest1, &clipboardTest2, &clipboardTest3,  NULL
581
};
582

583
/* Clipboard test suite (global) */
584
SDLTest_TestSuiteReference clipboardTestSuite = {
585
    "Clipboard",
586
    NULL,
587
    clipboardTests,
588
    NULL
589
};
590

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.