1 /* Copyright (C) 2013-2020 Roland Lutz
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software Foundation,
15 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
17 #include <xornstorage.h>
21 static struct xornsch_line line_data
;
22 static struct xornsch_box box_data
;
23 static struct xornsch_circle circle_data
;
24 static struct xornsch_net net_data
;
28 xorn_revision_t
*rev0
, xorn_revision_t
*rev1
,
29 xorn_revision_t
*rev2
, xorn_revision_t
*rev3
,
30 xorn_object_t
*ob0
, xorn_object_t
*ob1a
, xorn_object_t
*ob1b
)
32 *rev0
= xorn_new_revision(NULL
);
33 assert(*rev0
!= NULL
);
34 xorn_finalize_revision(*rev0
);
38 *rev1
= xorn_new_revision(*rev0
);
39 assert(*rev1
!= NULL
);
41 memset(&line_data
, 0, sizeof line_data
);
47 line_data
.line
.width
= 1;
49 *ob0
= xornsch_add_line(*rev1
, &line_data
, NULL
);
52 xorn_finalize_revision(*rev1
);
56 *rev2
= xorn_new_revision(*rev1
);
57 assert(*rev2
!= NULL
);
59 memset(&box_data
, 0, sizeof box_data
);
65 box_data
.line
.width
= 1;
67 *ob1a
= xornsch_add_box(*rev2
, &box_data
, NULL
);
68 assert(*ob1a
!= NULL
);
70 memset(&circle_data
, 0, sizeof circle_data
);
71 circle_data
.pos
.x
= -1;
72 circle_data
.pos
.y
= -1;
73 circle_data
.radius
= 2;
74 circle_data
.color
= 3;
75 circle_data
.line
.width
= 1;
76 circle_data
.fill
.type
= 1;
78 *ob1b
= xornsch_add_circle(*rev2
, &circle_data
, NULL
);
79 assert(*ob1b
!= NULL
);
81 xorn_finalize_revision(*rev2
);
85 *rev3
= xorn_new_revision(*rev2
);
86 assert(*rev3
!= NULL
);
88 memset(&net_data
, 0, sizeof net_data
);
95 assert(xornsch_set_net_data(*rev3
, *ob0
, &net_data
, NULL
) == 0);
97 assert(xorn_delete_object(*rev3
, *ob1a
, NULL
) == 0);
99 xorn_finalize_revision(*rev3
);