utest: Add 33 tests cases for tdm_helper
[platform/core/uifw/libtdm.git] / utests / src / ut_tdm_helper.cpp
1 #include "gtest/gtest.h"
2 #include "ut_common.h"
3 #include "stdint.h"
4 #include <stdio.h>
5 #include <ftw.h>
6 #include <unistd.h>
7
8 extern "C" {
9 #include "tdm.h"
10 #include "tdm_helper.h"
11 #include "tdm_backend.h"
12 #include "tbm_bufmgr.h"
13 #include "tbm_surface.h"
14 #include "tbm_surface_internal.h"
15 #include "tbm_drm_helper.h"
16 }
17
18 #define TMP_PATH_FOR_UTEST "tmp_utest_helper"
19 #define STR_LEN 8192
20
21 class TDMHelper : public ::testing::Test {
22 protected:
23         tdm_display *dpy = NULL;
24         tbm_bufmgr bufmgr = NULL;
25         int master_fd = -42;
26         /*list of connected outputs*/
27         int output_count = 0;
28         const tdm_output_mode **preferred_mode_array = NULL;
29         tdm_output **outputs;
30         tdm_error error ;
31         tbm_surface_h surface;
32         virtual void SetEnv()
33         {
34                 setenv("TDM_THREAD", "0", 1);
35                 setenv("TDM_COMMIT_PER_VBLANK", "1", 1);
36                 setenv("XDG_RUNTIME_DIR", ".", 1);
37                 setenv("TBM_DISPLAY_SERVER", "1", 1);
38         }
39
40         void UnsetEnv()
41         {
42                 unsetenv("TDM_THREAD");
43                 unsetenv("TDM_COMMIT_PER_VBLANK");
44                 unsetenv("XDG_RUNTIME_DIR");
45                 unsetenv("TBM_DISPLAY_SERVER");
46         }
47
48         void SetUp(void)
49         {
50                 const tdm_output_mode *preferred_mode = NULL;
51                 tdm_error error = TDM_ERROR_NONE;
52                 int all_output_count = 0;
53
54                 SetEnv();
55
56                 bufmgr = tbm_bufmgr_init(-1);
57                 ASSERT_FALSE(bufmgr == NULL);
58
59                 dpy = tdm_display_init(&error);
60                 ASSERT_TRUE(error == TDM_ERROR_NONE);
61                 ASSERT_FALSE(dpy == NULL);
62
63                 master_fd = tbm_drm_helper_get_master_fd();
64                 ASSERT_TRUE(tdm_display_get_output_count(dpy, &all_output_count) == TDM_ERROR_NONE);
65
66                 outputs = (tdm_output **)calloc(all_output_count, sizeof(tdm_output *));
67                 ASSERT_FALSE(NULL == outputs);
68
69                 preferred_mode_array = (const tdm_output_mode **)calloc(all_output_count, sizeof(tdm_output_mode *));
70                 ASSERT_FALSE(NULL == preferred_mode_array);
71
72                 output_count = 0;
73
74                 for (int i = 0; i < all_output_count; i++) {
75                         tdm_output *output = tdm_display_get_output(dpy, i, &error);
76                         int output_modes_cnt = 0;
77                         const tdm_output_mode *output_modes;
78
79                         if (TDM_ERROR_NONE != error || NULL == output)
80                                 continue;
81
82                         tdm_output_conn_status status = TDM_OUTPUT_CONN_STATUS_DISCONNECTED;
83                         if (TDM_ERROR_NONE != tdm_output_get_conn_status(output, &status))
84                                 continue;
85
86                         if (status == TDM_OUTPUT_CONN_STATUS_DISCONNECTED)
87                                 continue;
88
89                         error = tdm_output_get_available_modes(output, &output_modes, &output_modes_cnt);
90                         if (TDM_ERROR_NONE != error)
91                                 continue;
92                         if (output_modes_cnt <= 0) {
93                                 continue;
94                         }
95
96                         for(int j = 0; j < output_modes_cnt; j++)
97                                 if(output_modes[j].type & TDM_OUTPUT_MODE_TYPE_PREFERRED)
98                                         preferred_mode = &output_modes[j];
99
100                         if (!preferred_mode)
101                                 continue;
102
103                         if (preferred_mode_array)
104                                 preferred_mode_array[output_count] = preferred_mode;
105                         if (outputs)
106                                 outputs[output_count] = output;
107                         output_count++;
108
109                         error = tdm_output_set_mode(output, preferred_mode);
110                         ASSERT_EQ(TDM_ERROR_NONE, error);
111                 }
112                 surface = tbm_surface_create(256, 256, TBM_FORMAT_ARGB8888);
113                 ASSERT_TRUE(surface != NULL);
114         }
115
116         void TearDown(void)
117         {
118                 if (surface) {
119                         while (tbm_surface_internal_is_valid(surface))
120                                 tbm_surface_destroy(surface);
121                 }
122                 tdm_display_deinit(dpy);
123                 dpy = NULL;
124                 tbm_bufmgr_deinit(bufmgr);
125                 bufmgr = NULL;
126                 if (outputs)
127                         free(outputs);
128                 if (preferred_mode_array)
129                         free(preferred_mode_array);
130                 if (master_fd > -1) {
131                         int temp_master_fd = tbm_drm_helper_get_master_fd();
132                         EXPECT_EQ(temp_master_fd, -1) << "Fatal Error. Can't deinit tdm/tbm" << std::endl;
133                         if (temp_master_fd > -1)
134                                 exit(1);
135                         close(master_fd);
136                 }
137
138                 UnsetEnv();
139         }
140 };
141
142 int remove_cb(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf)
143 {
144         int rv = remove(fpath);
145         if (rv)
146                 perror(fpath);
147         return rv;
148 }
149
150 int rmrf(const char *path)
151 {
152         return nftw(path, remove_cb, 64, FTW_DEPTH | FTW_PHYS);
153 }
154
155 class TDMHelperSurface: public TDMHelper
156 {
157 protected:
158
159         void SetUp()
160         {
161                 TDMHelper::SetUp();
162                 ASSERT_EQ(0, mkdir(TMP_PATH_FOR_UTEST, 0755)) << "error: " <<  strerror(errno);
163         }
164         void TearDown()
165         {
166
167                 rmrf(TMP_PATH_FOR_UTEST);
168                 TDMHelper::TearDown();
169         }
170 };
171
172 class TDMHelperDisplay: public TDMHelper {
173 };
174
175 class TDMHelperOutput: public TDMHelper {
176 };
177
178
179 /* double tdm_helper_get_time(void); */
180 TEST(TDMHelper, GetTime)
181 {
182         double time;
183         time = tdm_helper_get_time();
184         EXPECT_GT(time, 0);
185 }
186
187 /* void tdm_helper_dump_start(char *dumppath, int *count); */
188 TEST(TDMHelper, DumpStartFailNull)
189 {
190         int count = 100;
191         tdm_helper_dump_start(NULL, &count);
192
193         tdm_helper_dump_start((char *)TMP_PATH_FOR_UTEST, NULL);
194 }
195
196 TEST(TDMHelper, DumpStartSuccessful)
197 {
198         int count = 100;
199         tdm_helper_dump_start((char *)TMP_PATH_FOR_UTEST, &count);
200 }
201
202 /* void tdm_helper_dump_stop(void); */
203 TEST(TDMHelper, DumpStopSuccessful)
204 {
205         tdm_helper_dump_stop();
206 }
207
208 /* void tdm_helper_dump_buffer(tbm_surface_h buffer, const char *file); */
209 TEST_F(TDMHelperSurface, DumpBufferFailNull)
210 {
211         tdm_helper_dump_buffer(NULL, TMP_PATH_FOR_UTEST "/tmp");
212 }
213
214 TEST_F(TDMHelperSurface, DumpBufferFailInvalideOutput)
215 {
216         int invalid_surface;
217         tdm_helper_dump_buffer((tbm_surface_h)&invalid_surface, TMP_PATH_FOR_UTEST "/xyz.png");
218
219         /* file name mast have an extension ".png" */
220         tdm_helper_dump_buffer(surface, TMP_PATH_FOR_UTEST "/tmp.xyz");
221 }
222
223 TEST_F(TDMHelperSurface, DumpBufferFailUnknownFormat)
224 {
225         tbm_surface_h surf;
226         surf = tbm_surface_create(256, 256, TBM_FORMAT_YUV444);
227         ASSERT_TRUE(surf != NULL);
228         tdm_helper_dump_buffer(surface, TMP_PATH_FOR_UTEST "/xyz.png");
229         tbm_surface_destroy(surf);
230 }
231
232 TEST_F(TDMHelperSurface, DumpBufferSuccessful)
233 {
234         tbm_surface_h surf;
235
236         tdm_helper_dump_buffer(surface, TMP_PATH_FOR_UTEST "/rgb.png");
237
238         surf = tbm_surface_create(256, 256, TBM_FORMAT_YUV420);
239         ASSERT_TRUE(surf != NULL);
240         tdm_helper_dump_buffer(surf, TMP_PATH_FOR_UTEST "/YUV.yuv");
241         tbm_surface_destroy(surf);
242
243         surf = tbm_surface_create(256, 256, TBM_FORMAT_NV12);
244         ASSERT_TRUE(surf != NULL);
245         tdm_helper_dump_buffer(surf, TMP_PATH_FOR_UTEST "/NV.yuv");
246         tbm_surface_destroy(surf);
247
248         surf = tbm_surface_create(256, 256, TBM_FORMAT_YUYV);
249         ASSERT_TRUE(surf != NULL);
250         tdm_helper_dump_buffer(surf, TMP_PATH_FOR_UTEST "/YUYV.yuv");
251         tbm_surface_destroy(surf);
252 }
253
254 /* void tdm_helper_clear_buffer_color(tbm_surface_h buffer, tdm_pos *pos, unsigned int color); */
255 TEST_F(TDMHelperSurface, ClearBufferColorFailNull)
256 {
257         tdm_pos pos;
258         tdm_helper_clear_buffer_color(NULL, &pos, 0x0F0F0F);
259 }
260
261 TEST_F(TDMHelperSurface, ClearBufferColorInvalideOutput)
262 {
263         int invalid_surface;
264         tdm_pos pos;
265         tdm_helper_clear_buffer_color((tbm_surface_h)&invalid_surface, &pos, 0x0F0F0F);
266 }
267
268 TEST_F(TDMHelperSurface, ClearBufferColorUnknownFormat)
269 {
270         tdm_pos pos = { .x = 0, .y = 0, .w = 10, .h = 10 };
271         tbm_surface_h surf;
272         surf = tbm_surface_create(256, 256, TBM_FORMAT_YUV444);
273         ASSERT_TRUE(surf != NULL);
274         tdm_helper_clear_buffer_color(surf, &pos, 0x0F0F0F);
275         tbm_surface_destroy(surf);
276 }
277
278 TEST_F(TDMHelperSurface, ClearBufferColorSuccessful)
279 {
280         tdm_pos pos = { .x = 0, .y = 0, .w = 10, .h = 10 };
281         tbm_surface_h surf;
282
283         tdm_helper_clear_buffer_color(surface, &pos, 0x0F0F0F);
284
285         surf = tbm_surface_create(256, 256, TBM_FORMAT_YVU420);
286         ASSERT_TRUE(surf != NULL);
287         tdm_helper_clear_buffer_color(surf, &pos, 0x0F0F0F);
288         tbm_surface_destroy(surf);
289
290         surf = tbm_surface_create(256, 256, TBM_FORMAT_NV12);
291         ASSERT_TRUE(surf != NULL);
292         tdm_helper_clear_buffer_color(surf, &pos, 0x0F0F0F);
293         tbm_surface_destroy(surf);
294
295         surf = tbm_surface_create(256, 256, TBM_FORMAT_YUYV);
296         ASSERT_TRUE(surf != NULL);
297         tdm_helper_clear_buffer_color(surf, &pos, 0x0F0F0F);
298         tbm_surface_destroy(surf);
299
300         surf = tbm_surface_create(256, 256, TBM_FORMAT_UYVY);
301         ASSERT_TRUE(surf != NULL);
302         tdm_helper_clear_buffer_color(surf, &pos, 0x0F0F0F);
303         tbm_surface_destroy(surf);
304 }
305
306 /* void tdm_helper_clear_buffer_pos(tbm_surface_h buffer, tdm_pos *pos); */
307 TEST_F(TDMHelperSurface, ClearBufferPosFailNull)
308 {
309         tdm_pos pos;
310         tdm_helper_clear_buffer_pos(NULL, &pos);
311 }
312
313 TEST_F(TDMHelperSurface, ClearBufferPosInvalideOutput)
314 {
315         int invalid_surface;
316         tdm_pos pos;
317         tdm_helper_clear_buffer_pos((tbm_surface_h)&invalid_surface, &pos);
318 }
319
320 TEST_F(TDMHelperSurface, ClearBufferPosUnknownFormat)
321 {
322         tdm_pos pos = { .x = 0, .y = 0, .w = 10, .h = 10 };
323         tbm_surface_h surf;
324         surf = tbm_surface_create(256, 256, TBM_FORMAT_YUV444);
325         ASSERT_TRUE(surf != NULL);
326         tdm_helper_clear_buffer_pos(surf, &pos);
327         tbm_surface_destroy(surf);
328 }
329
330 TEST_F(TDMHelperSurface, ClearBufferPosSuccessful)
331 {
332         tdm_pos pos = { .x = 0, .y = 0, .w = 10, .h = 10 };
333         tbm_surface_h surf;
334
335         tdm_helper_clear_buffer_pos(surface, &pos);
336
337         surf = tbm_surface_create(256, 256, TBM_FORMAT_YVU420);
338         ASSERT_TRUE(surf != NULL);
339         tdm_helper_clear_buffer_pos(surf, &pos);
340         tbm_surface_destroy(surf);
341
342         surf = tbm_surface_create(256, 256, TBM_FORMAT_NV12);
343         ASSERT_TRUE(surf != NULL);
344         tdm_helper_clear_buffer_pos(surf, &pos);
345         tbm_surface_destroy(surf);
346
347         surf = tbm_surface_create(256, 256, TBM_FORMAT_YUYV);
348         ASSERT_TRUE(surf != NULL);
349         tdm_helper_clear_buffer_pos(surf, &pos);
350         tbm_surface_destroy(surf);
351
352         surf = tbm_surface_create(256, 256, TBM_FORMAT_UYVY);
353         ASSERT_TRUE(surf != NULL);
354         tdm_helper_clear_buffer_pos(surf, &pos);
355         tbm_surface_destroy(surf);
356 }
357
358 /* void tdm_helper_clear_buffer(tbm_surface_h buffer); */
359 TEST_F(TDMHelperSurface, ClearBufferFailNull)
360 {
361         tdm_helper_clear_buffer(NULL);
362 }
363
364 TEST_F(TDMHelperSurface, ClearBufferInvalideOutput)
365 {
366         int invalid_surface;
367         tdm_helper_clear_buffer((tbm_surface_h)&invalid_surface);
368 }
369
370 TEST_F(TDMHelperSurface, ClearBufferUnknownFormat)
371 {
372         tbm_surface_h surf;
373
374         surf = tbm_surface_create(256, 256, TBM_FORMAT_YUV444);
375         ASSERT_TRUE(surf != NULL);
376         tdm_helper_clear_buffer(surf);
377         tbm_surface_destroy(surf);
378 }
379
380 TEST_F(TDMHelperSurface, ClearBufferSuccessful)
381 {
382         tbm_surface_h surf;
383
384         tdm_helper_clear_buffer(surface);
385
386         surf = tbm_surface_create(256, 256, TBM_FORMAT_YVU420);
387         ASSERT_TRUE(surf != NULL);
388         tdm_helper_clear_buffer(surf);
389         tbm_surface_destroy(surf);
390
391         surf = tbm_surface_create(256, 256, TBM_FORMAT_NV12);
392         ASSERT_TRUE(surf != NULL);
393         tdm_helper_clear_buffer(surf);
394         tbm_surface_destroy(surf);
395
396         surf = tbm_surface_create(256, 256, TBM_FORMAT_YUYV);
397         ASSERT_TRUE(surf != NULL);
398         tdm_helper_clear_buffer(surf);
399         tbm_surface_destroy(surf);
400
401         surf = tbm_surface_create(256, 256, TBM_FORMAT_UYVY);
402         ASSERT_TRUE(surf != NULL);
403         tdm_helper_clear_buffer(surf);
404         tbm_surface_destroy(surf);
405 }
406
407 /* void tdm_helper_get_buffer_full_size(tbm_surface_h buffer, int *buffer_w, int *buffer_h); */
408 TEST_F(TDMHelperSurface, GetBufferFullSizeFailNull)
409 {
410         int buffer_w;
411         int buffer_h;
412         tdm_helper_get_buffer_full_size(NULL, &buffer_w, &buffer_h);
413 }
414
415 TEST_F(TDMHelperSurface, GetBufferFullSizeFailinvalidBuffer)
416 {
417         int invalid_surface;
418         int buffer_w;
419         int buffer_h;
420         tdm_helper_get_buffer_full_size((tbm_surface_h)&invalid_surface, &buffer_w, &buffer_h);
421 }
422
423 TEST_F(TDMHelperSurface, GetBufferFullSizeSuccessful)
424 {
425         int buffer_w = 0;
426         int buffer_h = 0;
427         tdm_helper_get_buffer_full_size(surface, &buffer_w, &buffer_h);
428         ASSERT_GE(buffer_w, 0);
429         ASSERT_GE(buffer_h, 0);
430 }
431
432 /* tdm_error tdm_helper_convert_buffer(tbm_surface_h srcbuf, tbm_surface_h dstbuf,
433                                                   tdm_pos *srcpos, tdm_pos *dstpos,
434                                                   tdm_transform transform, int over); */
435 TEST_F(TDMHelperSurface, ConvertBufferFailNull)
436 {
437         tdm_pos srcpos = { 0, 0, 256, 256 };
438         tdm_pos dstpos = { 0, 0, 256, 256 };
439         tbm_surface_h dstbuf;
440         tdm_error error;
441
442         dstbuf = tbm_surface_create(256, 256, TBM_FORMAT_ARGB8888);
443         ASSERT_TRUE(dstbuf != NULL);
444
445         error = tdm_helper_convert_buffer(NULL, dstbuf, &srcpos, &dstpos, TDM_TRANSFORM_NORMAL, 0);
446         tbm_surface_destroy(dstbuf);
447         ASSERT_NE(TDM_ERROR_NONE, error);
448
449         error = tdm_helper_convert_buffer(surface, NULL, &srcpos, &dstpos, TDM_TRANSFORM_NORMAL, 0);
450         ASSERT_NE(TDM_ERROR_NONE, error);
451 }
452
453 TEST_F(TDMHelperSurface, ConvertBufferFailinvalidBuffer)
454 {
455         int invalid_surface;
456         tdm_pos srcpos = { 0, 0, 256, 256 };
457         tdm_pos dstpos = { 0, 0, 256, 256 };
458         tbm_surface_h dstbuf;
459         tdm_error error;
460
461         dstbuf = tbm_surface_create(256, 256, TBM_FORMAT_ARGB8888);
462         ASSERT_TRUE(dstbuf != NULL);
463
464         error = tdm_helper_convert_buffer((tbm_surface_h)&invalid_surface, dstbuf, &srcpos, &dstpos, TDM_TRANSFORM_NORMAL, 0);
465         tbm_surface_destroy(dstbuf);
466         ASSERT_NE(TDM_ERROR_NONE, error);
467
468         error = tdm_helper_convert_buffer(surface, (tbm_surface_h)&invalid_surface, &srcpos, &dstpos, TDM_TRANSFORM_NORMAL, 0);
469         ASSERT_NE(TDM_ERROR_NONE, error);
470 }
471
472 TEST_F(TDMHelperSurface, ConvertBufferSuccessful)
473 {
474         tdm_pos srcpos = { 0, 0, 256, 256 };
475         tdm_pos dstpos = { 0, 0, 256, 256 };
476         tbm_surface_h dstbuf;
477         tdm_error error;
478
479         dstbuf = tbm_surface_create(256, 256, TBM_FORMAT_ARGB8888);
480         ASSERT_TRUE(dstbuf != NULL);
481
482         error = tdm_helper_convert_buffer(surface, dstbuf, &srcpos, &dstpos, TDM_TRANSFORM_NORMAL, 0);
483         tbm_surface_destroy(dstbuf);
484         ASSERT_EQ(TDM_ERROR_NONE, error);
485 }
486
487
488 /* void tdm_helper_get_display_information(tdm_display *dpy, char *reply, int *len); */
489 TEST_F(TDMHelperDisplay, GetDisplayInformationFailNull)
490 {
491         char reply[STR_LEN] = {0};
492         int len = STR_LEN;
493         tdm_helper_get_display_information(NULL, reply, &len);
494         ASSERT_LT(len, STR_LEN);
495         ASSERT_EQ((STR_LEN - len), strlen(reply));
496
497         len = STR_LEN;
498         tdm_helper_get_display_information(dpy, NULL, &len);
499         ASSERT_EQ(STR_LEN, len);
500
501         reply[0] = '\0';
502         tdm_helper_get_display_information(dpy, reply, NULL);
503         ASSERT_EQ(0, reply[0]);
504 }
505
506 TEST_F(TDMHelperDisplay, GetDisplayInformationSuccessful)
507 {
508         char reply[STR_LEN] = {0};
509         int len = STR_LEN;
510         tdm_helper_get_display_information(dpy, reply, &len);
511         ASSERT_LT(len, STR_LEN);
512         ASSERT_EQ((STR_LEN - len), strlen(reply));
513 }
514 int capture_handler_is_called = 0;
515 void capture_handler(tbm_surface_h buffer, void *user_data)
516 {
517         if (&capture_handler_is_called == user_data)
518                 capture_handler_is_called = 1;
519 }
520 /* tdm_error tdm_helper_capture_output(...); */
521 TEST_F(TDMHelperOutput, CaptureOutputFailNull)
522 {
523         int output_count = 0;
524         tdm_output *output = NULL;
525         tdm_error error;
526         tbm_surface_h buffer = NULL;
527
528         error = tdm_display_get_output_count(dpy, &output_count);
529         ASSERT_EQ(TDM_ERROR_NONE, error);
530         for (int i = 0; i < output_count; i++) {
531
532                 output = tdm_display_get_output(dpy, i, &error);
533                 ASSERT_NE(NULL, output);
534
535                 error = tdm_helper_capture_output(NULL, buffer, 0, 0, 0, 0, capture_handler, &capture_handler_is_called);
536                 ASSERT_NE(TDM_ERROR_NONE, error);
537                 error = tdm_helper_capture_output(output, NULL, 0, 0, 0, 0, capture_handler, &capture_handler_is_called);
538                 ASSERT_NE(TDM_ERROR_NONE, error);
539                 error = tdm_helper_capture_output(output, buffer, 0, 0, 0, 0, NULL, &capture_handler_is_called);
540                 ASSERT_NE(TDM_ERROR_NONE, error);
541                 error = tdm_helper_capture_output(output, buffer, 0, 0, 0, 0, capture_handler, NULL);
542                 ASSERT_NE(TDM_ERROR_NONE, error);
543         }
544 }
545
546 TEST_F(TDMHelperOutput, CaptureOutputFailInvalidInputs)
547 {
548         for (int i = 0; i < output_count; i++) {
549                 error = tdm_helper_capture_output(outputs[i], surface, -1, 0, 0, 0, capture_handler, &capture_handler_is_called);
550                 ASSERT_NE(TDM_ERROR_NONE, error);
551                 error = tdm_helper_capture_output(outputs[i], surface, 0, -1, 0, 0, capture_handler, &capture_handler_is_called);
552                 ASSERT_NE(TDM_ERROR_NONE, error);
553                 error = tdm_helper_capture_output(outputs[i], surface, 0, 0, -1, 0, capture_handler, &capture_handler_is_called);
554                 ASSERT_NE(TDM_ERROR_NONE, error);
555                 error = tdm_helper_capture_output(outputs[i], surface, 0, 0, 0, -1, capture_handler, &capture_handler_is_called);
556                 ASSERT_NE(TDM_ERROR_NONE, error);
557         }
558 }
559
560 TEST_F(TDMHelperOutput, CaptureOutputSuccessful)
561 {
562         error = tdm_display_get_output_count(dpy, &output_count);
563         ASSERT_EQ(TDM_ERROR_NONE, error);
564         for (int i = 0; i < output_count; i++) {
565                 error = tdm_helper_capture_output(outputs[i], surface, 0, 0, 255, 255, capture_handler, &capture_handler_is_called);
566                 ASSERT_EQ(TDM_ERROR_NONE, error);
567         }
568 }
569
570 /* int tdm_helper_output_commit_per_vblank_enabled(tdm_output *output); */
571 TEST_F(TDMHelperOutput, CommitPerVblankEnabledFailNull)
572 {
573         int state;
574         state = tdm_helper_output_commit_per_vblank_enabled(NULL);
575         ASSERT_EQ(-1, state);
576 }
577
578 TEST_F(TDMHelperOutput, CommitPerVblankEnabledSuccessful)
579 {
580         int state;
581
582         for (int i = 0; i < output_count; i++) {
583                 state = tdm_helper_output_commit_per_vblank_enabled(outputs[i]);
584                 ASSERT_EQ(1, state);
585         }
586 }
587