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_text text_data
;
22 static const char *caption
= "Hello world";
27 xorn_revision_t rev0
, rev1
;
30 memset(&text_data
, 0, sizeof text_data
);
31 text_data
.text
.s
= caption
;
32 text_data
.text
.len
= strlen(caption
) + 1;
34 rev0
= xorn_new_revision(NULL
);
36 xorn_finalize_revision(rev0
);
38 rev1
= xorn_new_revision(rev0
);
40 ob
= xornsch_add_text(rev1
, &text_data
, NULL
);
42 xorn_finalize_revision(rev1
);
44 const struct xornsch_text
*text_return
=
45 xornsch_get_text_data(rev1
, ob
);
46 assert(text_return
!= NULL
);
47 assert(text_return
->text
.s
!= NULL
);
48 assert(text_return
->text
.s
!= caption
);
49 assert(text_return
->text
.len
== strlen(caption
) + 1);
50 assert(memcmp(text_return
->text
.s
, caption
,
51 text_return
->text
.len
) == 0);
53 xorn_free_revision(rev1
);
54 xorn_free_revision(rev0
);