More demotification for CreateFSBDialog
[grace.git] / tests / check_grace.cpp
blobf4b6810648aa91706c290bc4995063658a1b37d6
1 extern "C" {
2 #include <grace/grace.h>
5 #include <gtest/gtest.h>
7 void errmsg(const char *msg)
9 fputs(msg, stderr);
10 fputc('\n', stderr);
13 TEST(ColorsMergeTest, NullArgumentsAreHandledCorrectly) {
14 ASSERT_FALSE(colorlists_are_equal(NULL, NULL));
17 TEST(ColorsMergeTest, EmptyColorListsAreNotEqual) {
18 ColorList clist1 = {NULL, 0};
19 ColorList clist2 = {NULL, 0};
21 ASSERT_FALSE(colorlists_are_equal(&clist1, &clist2));
24 //TEST(ColorsMergeTest, TestColorListsAreEqual) {
25 // ColorList clist1 = {NULL, 0};
26 // ColorList clist2 = {NULL, 0};
28 // ASSERT_TRUE(colorlists_are_equal(&clist1, &clist2));
29 //}
31 TEST(ColorsMergeTest, ThereAreNoDuplicateColors) {
32 QuarkFactory *qfactory = qfactory_new();
33 project_qf_register(qfactory);
34 Quark *pr1 = project_new(NULL, qfactory, AMEM_MODEL_SIMPLE);
35 Quark *pr2 = project_new(NULL, qfactory, AMEM_MODEL_SIMPLE);
37 char *black_name, *white_name, *red_name;
38 black_name = copy_string(NULL, "black");
39 white_name = copy_string(NULL, "white");
40 red_name = copy_string(NULL, "red");
41 Colordef color_black = {0, {0x0, 0x0, 0x0}, black_name};
42 Colordef color_white = {0, {0xff, 0xff, 0xff}, white_name};
43 Colordef color_red = {0, {0xff, 0x0, 0x0}, red_name};
45 project_add_color(pr1, &color_black);
46 project_add_color(pr1, &color_white);
47 project_add_color(pr1, &color_red);
49 project_add_color(pr2, &color_black);
50 project_add_color(pr2, &color_white);
51 project_add_color(pr2, &color_red);
53 ColorList clist1 = project_get_colorlist(pr1);
54 ColorList clist2 = project_get_colorlist(pr2);
56 ColorList *clist = colorlist_merge_colors(&clist1, &clist2);
58 ASSERT_TRUE(colorlists_are_equal(clist, &clist1));
60 xfree(black_name);
61 xfree(white_name);
62 xfree(red_name);
63 quark_free(pr1);
64 quark_free(pr2);
65 qfactory_free(qfactory);