aboutsummaryrefslogtreecommitdiff
path: root/tests/render_test.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2012-08-12 17:40:20 +0200
committerThomas White <taw@bitwiz.org.uk>2012-08-12 17:40:20 +0200
commit2fd37a95bd5fe109a62917eca483b36a18a74777 (patch)
tree0864a76938670d7b2740eaa9b8da281670ecd0d8 /tests/render_test.c
parent6d0e78aadcf111cfd82cc8762ebd43c10c7923ae (diff)
The style mechanism
Diffstat (limited to 'tests/render_test.c')
-rw-r--r--tests/render_test.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/tests/render_test.c b/tests/render_test.c
index 64b7583..126ad01 100644
--- a/tests/render_test.c
+++ b/tests/render_test.c
@@ -28,10 +28,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
+#include <string.h>
#include "../src/storycode.h"
#include "../src/render.h"
#include "../src/layout.h"
+#include "../src/stylesheet.h"
static gint mw_destroy(GtkWidget *w, void *p)
@@ -70,9 +72,34 @@ int main(int argc, char *argv[])
GtkWidget *drawingarea;
struct frame *fr;
struct frame *fr2;
+ struct style *sty1;
+ struct style *sty2;
gtk_init(&argc, &argv);
+ sty1 = calloc(1, sizeof(struct style));
+ sty1->lop.pad_l = 0.0;
+ sty1->lop.pad_r = 0.0;
+ sty1->lop.pad_t = 0.0;
+ sty1->lop.pad_b = 0.0;
+ sty1->lop.margin_l = 0.0;
+ sty1->lop.margin_r = 0.0;
+ sty1->lop.margin_t = 0.0;
+ sty1->lop.margin_b = 0.0;
+ sty1->name = strdup("Default");
+
+ sty2 = calloc(1, sizeof(struct style));
+ sty2->lop.pad_l = 10.0;
+ sty2->lop.pad_r = 10.0;
+ sty2->lop.pad_t = 10.0;
+ sty2->lop.pad_b = 10.0;
+ sty2->lop.margin_l = 10.0;
+ sty2->lop.margin_r = 10.0;
+ sty2->lop.margin_t = 10.0;
+ sty2->lop.margin_b = 10.0;
+ sty2->name = strdup("Text frame");
+
+
fr2 = calloc(1, sizeof(struct frame));
if ( fr2 == NULL ) return 1;
fr2->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. 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.";
@@ -80,14 +107,7 @@ int main(int argc, char *argv[])
if ( fr2->rendering_order == NULL ) return 1;
fr2->rendering_order[0] = fr2;
fr2->num_ro = 1;
- fr2->lop.pad_l = 10.0;
- fr2->lop.pad_r = 10.0;
- fr2->lop.pad_t = 10.0;
- fr2->lop.pad_b = 10.0;
- fr2->lop.margin_l = 10.0;
- fr2->lop.margin_r = 10.0;
- fr2->lop.margin_t = 10.0;
- fr2->lop.margin_b = 10.0;
+ fr2->style = sty2;
fr = calloc(1, sizeof(struct frame));
if ( fr == NULL ) return 1;
@@ -96,14 +116,7 @@ int main(int argc, char *argv[])
if ( fr->rendering_order == NULL ) return 1;
fr->rendering_order[0] = fr; /* Render parent first */
fr->rendering_order[1] = fr2;
- fr->lop.margin_l = 0.0;
- fr->lop.margin_r = 0.0;
- fr->lop.margin_t = 0.0;
- fr->lop.margin_b = 0.0;
- fr->lop.pad_l = 10.0;
- fr->lop.pad_r = 10.0;
- fr->lop.pad_t = 10.0;
- fr->lop.pad_b = 10.0;
+ fr->style = sty1;
fr->num_ro = 2;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);