diff src/redraw_man.c @ 119:257a1d314bcd

Bug of insert sort
author Thinker K.F. Li <thinker@branda.to>
date Sun, 14 Sep 2008 21:08:25 +0800
parents 3895d2224e67
children 76ba6fd61c7d
line wrap: on
line diff
--- a/src/redraw_man.c	Sun Sep 14 18:53:17 2008 +0800
+++ b/src/redraw_man.c	Sun Sep 14 21:08:25 2008 +0800
@@ -43,7 +43,7 @@
 
     for(i = 1; i < num; i++) {
 	val = *(unsigned int *)(elms[i] + off);
-	for(j = i - 1; j > 0; j--) {
+	for(j = i; j > 0; j--) {
 	    if(*(unsigned int *)(elms[j - 1] + off) <= val)
 		break;
 	    elms[j] = elms[j - 1];
@@ -984,6 +984,7 @@
     shape_t shape;
     co_aix x, y;
     co_aix w, h;
+    int trans_cnt;
     int draw_cnt;
 };
 
@@ -1000,6 +1001,7 @@
     dummy->y = y;
     dummy->w = w;
     dummy->h = h;
+    dummy->trans_cnt = 0;
     dummy->draw_cnt = 0;
 
     return (shape_t *)dummy;
@@ -1030,6 +1032,7 @@
 	if(shape->geo)
 	    geo_from_positions(shape->geo, 2, poses);
     }
+    dummy->trans_cnt++;
 }
 
 void sh_dummy_fill(shape_t *shape, cairo_t *cr) {
@@ -1134,16 +1137,20 @@
 	rdman_add_shape(rdman, shapes[i], coords[i]);
     }
     rdman_redraw_all(rdman);
+    CU_ASSERT(dummys[0]->trans_cnt == 1);
+    CU_ASSERT(dummys[1]->trans_cnt == 1);
+    CU_ASSERT(dummys[2]->trans_cnt == 1);
     CU_ASSERT(dummys[0]->draw_cnt == 1);
     CU_ASSERT(dummys[1]->draw_cnt == 1);
     CU_ASSERT(dummys[2]->draw_cnt == 1);
     
     coords[2]->matrix[2] = 100;
     coords[2]->matrix[5] = 100;
+    rdman_coord_changed(rdman, coords[0]);
     rdman_coord_changed(rdman, coords[2]);
     rdman_redraw_changed(rdman);
 
-    CU_ASSERT(dummys[0]->draw_cnt == 1);
+    CU_ASSERT(dummys[0]->draw_cnt == 2);
     CU_ASSERT(dummys[1]->draw_cnt == 2);
     CU_ASSERT(dummys[2]->draw_cnt == 2);