From b4dc986bb6b3e7c755c36a8ee69ea818191b7a4f Mon Sep 17 00:00:00 2001
From: Raphael Boucherie <raphael.boucherie@inria.fr>
Date: Wed, 12 Apr 2017 11:35:48 +0200
Subject: [PATCH] Updated testing file for drawing the tree

---
 include/libhqr.h            |  6 +++---
 testings/testing_treedraw.c | 33 ++++++++++++++++++++-------------
 2 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/include/libhqr.h b/include/libhqr.h
index dd9286e..eacd7a4 100644
--- a/include/libhqr.h
+++ b/include/libhqr.h
@@ -82,9 +82,9 @@ typedef enum libhqr_typefacto_ {
  * @brief Structure for stocking informations in order to draw the tree
  */
 typedef struct libhqr_treedraw_s{
-    int k;          /**<The factorization step for the color*/
-    int *tiles;     /**<Table for tiles*/
-    int tiles_size; /**<Size of the table*/
+    int k;          /**< The factorization step for the color */
+    int *tiles;     /**< Table for tiles                      */
+    int tiles_size; /**< Size of the table                    */
 } libhqr_treedraw_t;
 
 /**
diff --git a/testings/testing_treedraw.c b/testings/testing_treedraw.c
index 773d23a..c935ebe 100644
--- a/testings/testing_treedraw.c
+++ b/testings/testing_treedraw.c
@@ -17,7 +17,9 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 #include "libdraw.h"
+#include "libhqr.h"
 
 #define WIDTH  50
 #define HEIGHT 50
@@ -25,17 +27,22 @@
 int
 main(int argc, char ** argv)
 {
-  FILE *tree = fopen("tree.svg","w+");
-  int x,y,i,j;
-  libhqr_writeheader(tree);
-  libhqr_drawline(125,100,125,800,tree);
-  for (i = 1; i < 5; i++){
-      for (j = 1; j < 9; j++){
-          x = 100*i;
-          y = 100*j;
-          libhqr_drawTS(x,y,WIDTH,HEIGHT,3,tree);
-      }
-  }
-  libhqr_writeend(tree);
-  return 1;
+    libhqr_tree_t qrtree;
+    libhqr_tiledesc_t matrix;
+    int minMN;
+    libhqr_treedraw_t drawing;
+    matrix.nodes = 1;
+    matrix.p     = 1;
+    matrix.mt    = 8;
+    matrix.nt    = 4;
+    libhqr_hqr_init( &qrtree, LIBHQR_QR, &matrix, LIBHQR_BINARY_TREE, LIBHQR_FLAT_TREE, 1, 1, 0, 0);
+    minMN = libhqr_imin(matrix.mt, matrix.nt );
+    drawing.tiles = (int*)malloc(minMN*sizeof(int));
+    drawing.tiles_size = minMN;
+    FILE *tree = fopen("tree.svg","w+");
+    libhqr_writeheader(tree);
+    libhqr_treewalk(&qrtree, 0);
+    libhqr_writeend(tree);
+    free(drawing.tiles);
+    return 1;
 }
-- 
GitLab