~ubuntu-branches/ubuntu/trusty/geis/trusty

« back to all changes in this revision

Viewing changes to testsuite/geis2/check_region.c

  • Committer: Package Import Robot
  • Author(s): Chase Douglas
  • Date: 2012-07-30 08:51:42 UTC
  • Revision ID: package-import@ubuntu.com-20120730085142-jrc33ygjvt0ob1wl
Tags: upstream-2.2.11
ImportĀ upstreamĀ versionĀ 2.2.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * Unit tests for GEIS v2.0 region module
 
3
 */
 
4
#include <check.h>
 
5
 
 
6
#include <geis/geis.h>
 
7
#include "libgeis/geis_test_api.h"
 
8
#include <string.h>
 
9
 
 
10
 
 
11
/* fixtures */
 
12
static Geis g_geis;
 
13
 
 
14
/* fixture setup */
 
15
static void
 
16
construct_geis()
 
17
{
 
18
  g_geis = geis_new(GEIS_INIT_MOCK_BACKEND, NULL);
 
19
}
 
20
 
 
21
/* fixture teardown */
 
22
static void
 
23
destroy_geis()
 
24
{
 
25
  geis_delete(g_geis);
 
26
}
 
27
 
 
28
 
 
29
/* compile-time test to ensure required types are defined */
 
30
START_TEST(region_constants)
 
31
{
 
32
  GeisString ini;
 
33
  ini = GEIS_REGION_X11_ROOT;
 
34
  ini = GEIS_REGION_X11_WINDOWID;
 
35
}
 
36
END_TEST
 
37
 
 
38
START_TEST(construction)
 
39
{
 
40
  GeisRegion sub = geis_region_new(g_geis, "name", GEIS_REGION_X11_ROOT, NULL);
 
41
  fail_unless(sub != NULL,
 
42
              "failed to create region");
 
43
  fail_unless(0 == strcmp(geis_region_name(sub), "name"),
 
44
              "unexpected region name returned");
 
45
  geis_region_delete(sub);
 
46
}
 
47
END_TEST
 
48
 
 
49
/* boilerplate */
 
50
Suite *
 
51
geis2_region_suite_new()
 
52
{
 
53
  Suite *s = suite_create("geis2_region");
 
54
  TCase *creation;
 
55
  TCase *usage;
 
56
 
 
57
  creation = tcase_create("region-constants");
 
58
  tcase_add_test(creation, region_constants);
 
59
  suite_add_tcase(s, creation);
 
60
 
 
61
  usage = tcase_create("region-usage");
 
62
  tcase_add_checked_fixture(usage, construct_geis, destroy_geis);
 
63
  tcase_add_test(usage, construction);
 
64
  suite_add_tcase(s, usage);
 
65
 
 
66
  return s;
 
67
}
 
68