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 #define NO_ERROR ((xorn_error_t) -1)
26 xorn_revision_t rev0
, rev1
, rev2
;
27 struct xornsch_line line_data
;
31 rev0
= xorn_new_revision(NULL
);
33 xorn_finalize_revision(rev0
);
35 rev1
= xorn_new_revision(rev0
);
38 memset(&line_data
, 0, sizeof line_data
);
44 line_data
.line
.width
= 1;
47 ob
= xorn_add_object(rev1
, xorn_obtype_none
, &line_data
, &err
);
49 assert(err
== xorn_error_invalid_argument
);
52 ob
= xorn_add_object(rev1
, xornsch_obtype_line
, &line_data
, &err
);
54 assert(err
== NO_ERROR
);
56 xorn_finalize_revision(rev1
);
58 rev2
= xorn_new_revision(rev1
);
62 assert(xorn_set_object_data(
63 rev2
, ob
, xorn_obtype_none
, &line_data
, &err
) == -1);
64 assert(err
== xorn_error_invalid_argument
);
67 assert(xorn_set_object_data(
68 rev2
, ob
, xornsch_obtype_line
, &line_data
, &err
) == 0);
69 assert(err
== NO_ERROR
);
71 xorn_finalize_revision(rev2
);
73 xorn_free_revision(rev2
);
74 xorn_free_revision(rev1
);
75 xorn_free_revision(rev0
);