• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作図ソフト dia の改良版


Commit MetaInfo

修订版7932160c3ef0ca14f3c77587e06f007540b67cb6 (tree)
时间2014-09-27 02:29:04
作者Hans Breuer <hans@breu...>
CommiterHans Breuer

Log Message

[unit test] add more bounding box tests

which helped debugging the recent fix

更改概述

差异

--- a/tests/test-boundingbox.c
+++ b/tests/test-boundingbox.c
@@ -78,6 +78,37 @@ static BezPoint _bz7[5] = {
7878 { BEZ_CURVE_TO, {0,0}, {2,0}, {1,1} },
7979 { BEZ_CURVE_TO, {0,2}, {2,2}, {1,1} },
8080 };
81+static BezPoint _bz8[] = { /* ying: wrong bbox {-0.05,-0.05,3.05,5.0} */
82+ { BEZ_MOVE_TO, {2,0} },
83+ { BEZ_CURVE_TO, {1.2855,0}, {0.6252,0.3812}, {0.2679,1} },
84+ { BEZ_CURVE_TO, {-0.0893,1.6188}, {-0.0893,2.3812}, {0.2679,3} },
85+ { BEZ_CURVE_TO, {0.6252,3.6188}, {1.2855,4}, {2,4} },
86+ { BEZ_CURVE_TO, {1.6427,4}, {1.3126,3.8094}, {1.134,3.5} },
87+ { BEZ_CURVE_TO, {0.9553,3.1906}, {0.9553,2.8094}, {1.134,2.5} },
88+ { BEZ_CURVE_TO, {1.3126,2.1906}, {1.6427,2}, {2,2} },
89+ { BEZ_CURVE_TO, {2.3573,2}, {2.6874,1.8094}, {2.866,1.5} },
90+ { BEZ_CURVE_TO, {3.0447,1.1906}, {3.0447,0.8094}, {2.866,0.5} },
91+ { BEZ_CURVE_TO, {2.6874,0.1906}, {2.3573,0}, {2,0} },
92+ { BEZ_MOVE_TO, {2,2.6} },
93+ { BEZ_CURVE_TO, {2.22,2.6}, {2.4,2.78}, {2.4,3} },
94+ { BEZ_CURVE_TO, {2.4,3.22}, {2.22,3.4}, {2,3.4} },
95+ { BEZ_CURVE_TO, {1.78,3.4}, {1.6,3.22}, {1.6,3} },
96+ { BEZ_CURVE_TO, {1.6,2.78}, {1.78,2.6}, {2,2.6} },
97+ { BEZ_MOVE_TO, {2,0.6} },
98+ { BEZ_CURVE_TO, {2.22,0.6}, {2.4,0.78}, {2.4,1} },
99+ { BEZ_CURVE_TO, {2.4,1.22}, {2.22,1.4}, {2,1.4} },
100+ { BEZ_CURVE_TO, {1.78,1.4}, {1.6,1.22}, {1.6,1} },
101+ { BEZ_CURVE_TO, {1.6,0.78}, {1.78,0.6}, {2,0.6} }
102+};
103+
104+static BezPoint _bz9[] = { /* heart from assorted shapes */
105+ { BEZ_MOVE_TO, {0.219064,0.919322} },
106+ { BEZ_CURVE_TO, {-0.563306,-0.0586407}, {1.00143,-0.449826}, {1.00143,0.723729} },
107+ { BEZ_CURVE_TO, {1.00143,0.723729}, {1.00143,0.723729}, {1.00143,0.723729} },
108+ { BEZ_CURVE_TO, {1.00143,-0.449826}, {2.56617,-0.0586407}, {1.7838,0.919322} },
109+ { BEZ_CURVE_TO, {1.7838,0.919322}, {1.00143,1.89728}, {1.00143,1.89728} },
110+ { BEZ_CURVE_TO, {1.00143,1.89728}, {0.219064,0.919322}, {0.219064,0.919322} },
111+};
81112
82113 #define T (0.1)
83114 #define BEZ(x) sizeof(_bz ##x)/sizeof(BezPoint), _bz ##x
@@ -86,7 +117,7 @@ static struct _TestBeziers {
86117 int num;
87118 BezPoint *pts;
88119 Rectangle box;
89-} _test_beziers[] = { /* top, left, bottom, right */
120+} _test_beziers[] = { /* left, top, right, bottom */
90121 { BEZ(1), { 0.0-T, 0.5-T, 2.0+T, 2.0+T } },
91122 { BEZ(2), {-2.0-T, 0.5-T, 0.0+T, 2.0+T } },
92123 { BEZ(3), {-2.0-T,-1.5-T, 0.0+T, 0.0+T } },
@@ -95,6 +126,8 @@ static struct _TestBeziers {
95126 { BEZ(5), { 0.0-T, 0.5-T, 2.0+T, 2.0+T } },
96127 { BEZ(6), { 0.2-T, 0.0-T, 1.8+T, 2.0+T } },
97128 { BEZ(7), { 0.25-T,0.25-T, 1.75+T, 1.75+T} },
129+ { BEZ(8), { 0-T, 0-T, 3+T, 4+T} },
130+ { BEZ(9), { 0-T, 0-T, 2.052+T, 1.897+T } },
98131 };
99132 #undef BEZ
100133
@@ -122,11 +155,21 @@ _add_bezier_tests (void)
122155 }
123156 }
124157
158+#ifdef G_OS_WIN32
159+#define Rectangle win32Rectangle
160+#include <windows.h>
161+#endif
162+
125163 int
126164 main (int argc, char** argv)
127165 {
128166 int ret;
129167
168+#ifdef G_OS_WIN32
169+ /* No dialog if it fails, please. */
170+ SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX);
171+#endif
172+
130173 g_test_init (&argc, &argv, NULL);
131174 /* not really needed - or are there message_warnings in the bbox code? */
132175 libdia_init (DIA_MESSAGE_STDERR);