diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/render_test_sc1.c | 63 |
1 files changed, 16 insertions, 47 deletions
diff --git a/tests/render_test_sc1.c b/tests/render_test_sc1.c index 25dccc0..bccc16a 100644 --- a/tests/render_test_sc1.c +++ b/tests/render_test_sc1.c @@ -3,7 +3,7 @@ * * Colloquium - A tiny presentation program * - * Copyright (c) 2012 Thomas White <taw@bitwiz.org.uk> + * Copyright (c) 2012-2014 Thomas White <taw@bitwiz.org.uk> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,12 +31,14 @@ #include <string.h> #include <assert.h> -#include "../src/storycode.h" +#include "../src/sc_parse.h" #include "../src/render.h" -#include "../src/stylesheet.h" #include "../src/frame.h" +const char *sc = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. \\f{\\bgcol{#ff00ff}Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros.} Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est."; + + static gint mw_destroy(GtkWidget *w, void *p) { exit(0); @@ -70,58 +72,25 @@ int main(int argc, char *argv[]) GtkWidget *window; GtkWidget *drawingarea; struct frame *fr; - struct style *sty; - struct style *sty2; struct slide s; struct presentation p; gtk_init(&argc, &argv); - fr = sc_unpack("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. \\f{\\bgcol{#ff00ff}Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros.} Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.", NULL); - - if ( fr == NULL ) { - fprintf(stderr, "sc_unpack() failed.\n"); + fr = calloc(1, sizeof(struct frame)); + if ( fr == NULL ) return 1; + fr->children = NULL; + fr->num_children = 0; + fr->scblocks = sc_parse(sc); + if ( fr->scblocks == NULL ) { + fprintf(stderr, "SC parse failed.\n"); return 1; } - sty = calloc(1, sizeof(struct style)); - sty->lop.pad_l = 10.0; - sty->lop.pad_r = 10.0; - sty->lop.pad_t = 10.0; - sty->lop.pad_b = 10.0; - sty->lop.margin_l = 0.0; - sty->lop.margin_r = 0.0; - sty->lop.margin_t = 0.0; - sty->lop.margin_b = 0.0; - sty->lop.x = 0.0; - sty->lop.y = 0.0; - sty->lop.w = 200.0; - sty->lop.h = 200.0; - sty->lop.w = 1.0; - sty->lop.w_units = UNITS_FRAC; - sty->lop.h = 1.0; - sty->lop.h_units = UNITS_FRAC; - sty->name = strdup("Default"); - - sty2 = calloc(1, sizeof(struct style)); - sty2->lop.pad_l = 0.0; - sty2->lop.pad_r = 0.0; - sty2->lop.pad_t = 0.0; - sty2->lop.pad_b = 0.0; - sty2->lop.margin_l = 20.0; - sty2->lop.margin_r = 20.0; - sty2->lop.margin_t = 20.0; - sty2->lop.margin_b = 20.0; - sty2->lop.w = 1.0; - sty2->lop.w_units = UNITS_FRAC; - sty2->lop.h = 1.0; - sty2->lop.h_units = UNITS_FRAC; - sty2->name = strdup("Subframe1"); - - fr->style = sty; - fr->lop_from_style = 1; - fr->children[0]->style = sty2; - fr->children[0]->lop_from_style = 1; + fr->pad_l = 20.0; + fr->pad_r = 20.0; + fr->pad_t = 20.0; + fr->pad_b = 20.0; s.top = fr; s.rendered_edit = NULL; |