summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_ecore_drm.c
blob: ac02f260b124c1e53caae9a7f17f38d39721491e (plain)
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
51
52
53
54
55
56
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <stdio.h>
#include <unistd.h>

#include <Ecore_Drm.h>

#include "ecore_suite.h"

#define MAX_ITER 10

START_TEST(ecore_test_ecore_drm_shutdown_bef_init)
{
   int ret = 0;

   ret = ecore_drm_shutdown();
   fprintf(stderr, "Calling ecore_drm_shutdown without calling ecore_drm_init.\n");
   fail_if(ret != 0);

   ret = ecore_drm_init();
   fprintf(stderr, "Calling ecore_drm_init.\n");
   fail_if(ret != 1);

   ret = ecore_drm_shutdown();
   fprintf(stderr, "Calling ecore_drm_shutdown after ecore_drm_init.\n");
   fail_if(ret != 0);
}
END_TEST

START_TEST(ecore_test_ecore_drm_init)
{
   int ret, i, j;

   for (i = 1; i <= MAX_ITER; i++)
     {
        ret = ecore_drm_init();
        fprintf(stderr, "Created %d ecore drm instance.\n", i);
        fail_if(ret != i);
     }

   for (j = MAX_ITER - 1; j >= 0; j--)
     {
        ret = ecore_drm_shutdown();
        fprintf(stderr, "Deleted %d ecore drm instance.\n", MAX_ITER - j);
        fail_if(ret != j);
     }
}
END_TEST

void ecore_test_ecore_drm(TCase *tc)
{
   tcase_add_test(tc, ecore_test_ecore_drm_init);
   tcase_add_test(tc, ecore_test_ecore_drm_shutdown_bef_init);
}