• R/O
  • SSH
  • HTTPS

bchan: 提交


Commit MetaInfo

修訂598 (tree)
時間2014-02-13 01:24:55
作者ornse01

Log Message

fix cssrendering_box bug.
initialization mistake.

Change Summary

差異

--- bchanf/trunk/src/css/cssrendering_box.c (revision 597)
+++ bchanf/trunk/src/css/cssrendering_box.c (revision 598)
@@ -51,10 +51,6 @@
5151 LOCAL VOID cssrendering_basebox_appendchild(cssrendering_basebox_t *box, cssrendering_basebox_t *child)
5252 {
5353 treebase_node_appendchild(&box->base, &child->base);
54- box->content_edge.c.left = 0;
55- box->content_edge.c.top = 0;
56- box->content_edge.c.right = 0;
57- box->content_edge.c.bottom = 0;
5854 }
5955
6056 LOCAL VOID cssrendering_basebox_setuserdata(cssrendering_basebox_t *box, VP data)
@@ -66,6 +62,10 @@
6662 {
6763 treebase_node_initialize(&box->base);
6864 box->type = type;
65+ box->content_edge.c.left = 0;
66+ box->content_edge.c.top = 0;
67+ box->content_edge.c.right = 0;
68+ box->content_edge.c.bottom = 0;
6969 box->userdata = NULL;
7070 }
7171
--- bchanf/trunk/src/css/test_cssrendering_box.c (revision 597)
+++ bchanf/trunk/src/css/test_cssrendering_box.c (revision 598)
@@ -302,9 +302,105 @@
302302 return ret;
303303 }
304304
305+LOCAL UNITTEST_RESULT test_cssrendering_blockbox_appendchild1()
306+{
307+ cssrendering_blockbox_t root;
308+ cssrendering_anonymousbox_t anon;
309+ UNITTEST_RESULT result = UNITTEST_RESULT_PASS;
310+
311+ cssrendering_blockbox_initialize(&root);
312+ cssrendering_anonymousbox_initialize(&anon);
313+
314+ root.base.content_edge = (cssmetric_rectangle_t){{0, 0, 100, 100}};
315+ cssrendering_blockbox_appendanonymouschild(&root, &anon);
316+
317+ if (root.base.content_edge.c.left != 0) {
318+ result = UNITTEST_RESULT_FAIL;
319+ }
320+ if (root.base.content_edge.c.top != 0) {
321+ result = UNITTEST_RESULT_FAIL;
322+ }
323+ if (root.base.content_edge.c.right != 100) {
324+ result = UNITTEST_RESULT_FAIL;
325+ }
326+ if (root.base.content_edge.c.bottom != 100) {
327+ result = UNITTEST_RESULT_FAIL;
328+ }
329+
330+ cssrendering_anonymousbox_finalize(&anon);
331+ cssrendering_blockbox_finalize(&root);
332+
333+ return result;
334+}
335+
336+LOCAL UNITTEST_RESULT test_cssrendering_blockbox_appendchild2()
337+{
338+ cssrendering_blockbox_t root;
339+ cssrendering_blockbox_t child;
340+ UNITTEST_RESULT result = UNITTEST_RESULT_PASS;
341+
342+ cssrendering_blockbox_initialize(&root);
343+ cssrendering_blockbox_initialize(&child);
344+
345+ root.base.content_edge = (cssmetric_rectangle_t){{0, 0, 100, 100}};
346+ cssrendering_blockbox_appendblockchild(&root, &child);
347+
348+ if (root.base.content_edge.c.left != 0) {
349+ result = UNITTEST_RESULT_FAIL;
350+ }
351+ if (root.base.content_edge.c.top != 0) {
352+ result = UNITTEST_RESULT_FAIL;
353+ }
354+ if (root.base.content_edge.c.right != 100) {
355+ result = UNITTEST_RESULT_FAIL;
356+ }
357+ if (root.base.content_edge.c.bottom != 100) {
358+ result = UNITTEST_RESULT_FAIL;
359+ }
360+
361+ cssrendering_blockbox_finalize(&child);
362+ cssrendering_blockbox_finalize(&root);
363+
364+ return result;
365+}
366+
367+LOCAL UNITTEST_RESULT test_cssrendering_anonymousbox_appendchild1()
368+{
369+ cssrendering_anonymousbox_t anon;
370+ cssrendering_linebox_t line;
371+ UNITTEST_RESULT result = UNITTEST_RESULT_PASS;
372+
373+ cssrendering_anonymousbox_initialize(&anon);
374+ cssrendering_linebox_initialize(&line);
375+
376+ anon.base.content_edge = (cssmetric_rectangle_t){{0, 0, 100, 100}};
377+ cssrendering_anonymousbox_appendchild(&anon, &line);
378+
379+ if (anon.base.content_edge.c.left != 0) {
380+ result = UNITTEST_RESULT_FAIL;
381+ }
382+ if (anon.base.content_edge.c.top != 0) {
383+ result = UNITTEST_RESULT_FAIL;
384+ }
385+ if (anon.base.content_edge.c.right != 100) {
386+ result = UNITTEST_RESULT_FAIL;
387+ }
388+ if (anon.base.content_edge.c.bottom != 100) {
389+ result = UNITTEST_RESULT_FAIL;
390+ }
391+
392+ cssrendering_linebox_finalize(&line);
393+ cssrendering_anonymousbox_finalize(&anon);
394+
395+ return result;
396+}
397+
305398 EXPORT VOID test_cssrendering_box_main(unittest_driver_t *driver)
306399 {
307400 UNITTEST_DRIVER_REGIST(driver, test_cssrendering_drawtraversal_1);
308401 UNITTEST_DRIVER_REGIST(driver, test_cssrendering_drawtraversal_2);
309402 UNITTEST_DRIVER_REGIST(driver, test_cssrendering_hittraversal_1);
403+ UNITTEST_DRIVER_REGIST(driver, test_cssrendering_blockbox_appendchild1);
404+ UNITTEST_DRIVER_REGIST(driver, test_cssrendering_blockbox_appendchild2);
405+ UNITTEST_DRIVER_REGIST(driver, test_cssrendering_anonymousbox_appendchild1);
310406 }
Show on old repository browser