|
@@ -75,360 +75,266 @@ func TestDataLayout(t *testing.T) { |
|
@@ -75,360 +75,266 @@ func TestDataLayout(t *testing.T) { |
75
|
ImageData: "d",
|
75
|
ImageData: "d",
|
76
|
Direction: domain.DirectionNone,
|
76
|
Direction: domain.DirectionNone,
|
77
|
},
|
77
|
},
|
78
|
-
|
|
|
79
|
- //分组二 右平移10
|
|
|
80
|
- {
|
|
|
81
|
- X: 0,
|
|
|
82
|
- Y: 10,
|
|
|
83
|
- Length: 2,
|
|
|
84
|
- ImageData: "2",
|
|
|
85
|
- Direction: domain.DirectionRight,
|
|
|
86
|
- },
|
|
|
87
|
- {
|
|
|
88
|
- X: 0,
|
|
|
89
|
- Y: 11,
|
|
|
90
|
- Length: 3,
|
|
|
91
|
- ImageData: "3",
|
|
|
92
|
- Direction: domain.DirectionRight,
|
|
|
93
|
- },
|
|
|
94
|
- {
|
|
|
95
|
- X: 1,
|
|
|
96
|
- Y: 10,
|
|
|
97
|
- Length: 2,
|
|
|
98
|
- ImageData: "a",
|
|
|
99
|
- Direction: domain.DirectionDown,
|
|
|
100
|
- },
|
|
|
101
|
- {
|
|
|
102
|
- X: 1,
|
|
|
103
|
- Y: 11,
|
|
|
104
|
- Length: 2,
|
|
|
105
|
- ImageData: "f",
|
|
|
106
|
- Direction: domain.DirectionDown,
|
|
|
107
|
- },
|
|
|
108
|
- {
|
|
|
109
|
- X: 1,
|
|
|
110
|
- Y: 12,
|
|
|
111
|
- Length: 2,
|
|
|
112
|
- ImageData: "b",
|
|
|
113
|
- Direction: domain.DirectionDown,
|
|
|
114
|
- },
|
|
|
115
|
- {
|
|
|
116
|
- X: 1,
|
|
|
117
|
- Y: 13,
|
|
|
118
|
- Length: 2,
|
|
|
119
|
- ImageData: "e",
|
|
|
120
|
- Direction: domain.DirectionDown,
|
|
|
121
|
- },
|
|
|
122
|
- {
|
|
|
123
|
- X: 2,
|
|
|
124
|
- Y: 10,
|
|
|
125
|
- Length: 1,
|
|
|
126
|
- ImageData: "c",
|
|
|
127
|
- Direction: domain.DirectionNone,
|
|
|
128
|
- },
|
|
|
129
|
- {
|
|
|
130
|
- X: 2,
|
|
|
131
|
- Y: 11,
|
|
|
132
|
- Length: 1,
|
|
|
133
|
- ImageData: "d",
|
|
|
134
|
- Direction: domain.DirectionNone,
|
|
|
135
|
- },
|
|
|
136
|
},
|
78
|
},
|
137
|
flag: Location{X: 2, Y: 2},
|
79
|
flag: Location{X: 2, Y: 2},
|
138
|
},
|
80
|
},
|
139
|
- {
|
|
|
140
|
- title: "正常多字段横排",
|
|
|
141
|
- cells: []*domain.LayoutCell{
|
|
|
142
|
- // 分组一
|
|
|
143
|
- {
|
|
|
144
|
- X: 0,
|
|
|
145
|
- Y: 0,
|
|
|
146
|
- Length: 5,
|
|
|
147
|
- ImageData: "a",
|
|
|
148
|
- Direction: domain.DirectionRight,
|
|
|
149
|
- },
|
|
|
150
|
- {
|
|
|
151
|
- X: 1,
|
|
|
152
|
- Y: 0,
|
|
|
153
|
- Length: 5,
|
|
|
154
|
- ImageData: "b",
|
|
|
155
|
- Direction: domain.DirectionRight,
|
|
|
156
|
- },
|
|
|
157
|
- {
|
|
|
158
|
- X: 2,
|
|
|
159
|
- Y: 0,
|
|
|
160
|
- Length: 5,
|
|
|
161
|
- ImageData: "c",
|
|
|
162
|
- Direction: domain.DirectionRight,
|
|
|
163
|
- },
|
|
|
164
|
- {
|
|
|
165
|
- X: 3,
|
|
|
166
|
- Y: 0,
|
|
|
167
|
- Length: 5,
|
|
|
168
|
- ImageData: "d",
|
|
|
169
|
- Direction: domain.DirectionRight,
|
|
|
170
|
- },
|
|
|
171
|
-
|
|
|
172
|
- // 分组二 平移10
|
|
|
173
|
- {
|
|
|
174
|
- X: 0,
|
|
|
175
|
- Y: 10,
|
|
|
176
|
- Length: 5,
|
|
|
177
|
- ImageData: "a",
|
|
|
178
|
- Direction: domain.DirectionRight,
|
|
|
179
|
- },
|
|
|
180
|
- {
|
|
|
181
|
- X: 1,
|
|
|
182
|
- Y: 10,
|
|
|
183
|
- Length: 5,
|
|
|
184
|
- ImageData: "b",
|
|
|
185
|
- Direction: domain.DirectionRight,
|
|
|
186
|
- },
|
|
|
187
|
- {
|
|
|
188
|
- X: 2,
|
|
|
189
|
- Y: 10,
|
|
|
190
|
- Length: 5,
|
|
|
191
|
- ImageData: "c",
|
|
|
192
|
- Direction: domain.DirectionRight,
|
|
|
193
|
- },
|
|
|
194
|
- {
|
|
|
195
|
- X: 3,
|
|
|
196
|
- Y: 10,
|
|
|
197
|
- Length: 5,
|
|
|
198
|
- ImageData: "d",
|
|
|
199
|
- Direction: domain.DirectionRight,
|
|
|
200
|
- },
|
|
|
201
|
- },
|
|
|
202
|
- flag: Location{X: 3, Y: 4},
|
|
|
203
|
- },
|
|
|
204
|
-
|
|
|
205
|
- {
|
|
|
206
|
- title: "正常多字段横排+计算项目",
|
|
|
207
|
- cells: []*domain.LayoutCell{
|
|
|
208
|
- // 分组一
|
|
|
209
|
- {
|
|
|
210
|
- X: 0,
|
|
|
211
|
- Y: 0,
|
|
|
212
|
- Length: 5,
|
|
|
213
|
- ImageData: "a",
|
|
|
214
|
- Direction: domain.DirectionRight,
|
|
|
215
|
- },
|
|
|
216
|
- {
|
|
|
217
|
- X: 1,
|
|
|
218
|
- Y: 0,
|
|
|
219
|
- Length: 5,
|
|
|
220
|
- ImageData: "b",
|
|
|
221
|
- Direction: domain.DirectionRight,
|
|
|
222
|
- },
|
|
|
223
|
- {
|
|
|
224
|
- X: 2,
|
|
|
225
|
- Y: 0,
|
|
|
226
|
- Length: 1,
|
|
|
227
|
- ImageData: "c",
|
|
|
228
|
- Direction: domain.DirectionNone,
|
|
|
229
|
- },
|
|
|
230
|
- {
|
|
|
231
|
- X: 3,
|
|
|
232
|
- Y: 0,
|
|
|
233
|
- Length: 1,
|
|
|
234
|
- ImageData: "d",
|
|
|
235
|
- Direction: domain.DirectionNone,
|
|
|
236
|
- },
|
|
|
237
|
-
|
|
|
238
|
- // 分组二 平移10
|
|
|
239
|
- {
|
|
|
240
|
- X: 0,
|
|
|
241
|
- Y: 10,
|
|
|
242
|
- Length: 1,
|
|
|
243
|
- ImageData: "a",
|
|
|
244
|
- Direction: domain.DirectionRight,
|
|
|
245
|
- },
|
|
|
246
|
- {
|
|
|
247
|
- X: 1,
|
|
|
248
|
- Y: 10,
|
|
|
249
|
- Length: 5,
|
|
|
250
|
- ImageData: "b",
|
|
|
251
|
- Direction: domain.DirectionRight,
|
|
|
252
|
- },
|
|
|
253
|
- {
|
|
|
254
|
- X: 2,
|
|
|
255
|
- Y: 10,
|
|
|
256
|
- Length: 1,
|
|
|
257
|
- ImageData: "c",
|
|
|
258
|
- Direction: domain.DirectionNone,
|
|
|
259
|
- },
|
|
|
260
|
- {
|
|
|
261
|
- X: 2,
|
|
|
262
|
- Y: 11,
|
|
|
263
|
- Length: 1,
|
|
|
264
|
- ImageData: "e",
|
|
|
265
|
- Direction: domain.DirectionNone,
|
|
|
266
|
- },
|
|
|
267
|
- {
|
|
|
268
|
- X: 3,
|
|
|
269
|
- Y: 10,
|
|
|
270
|
- Length: 1,
|
|
|
271
|
- ImageData: "d",
|
|
|
272
|
- Direction: domain.DirectionNone,
|
|
|
273
|
- },
|
|
|
274
|
- },
|
|
|
275
|
- flag: Location{X: 2, Y: 1},
|
|
|
276
|
- },
|
|
|
277
|
-
|
|
|
278
|
- {
|
|
|
279
|
- title: "正常多字段横排+竖排",
|
|
|
280
|
- cells: []*domain.LayoutCell{
|
|
|
281
|
- // 分组一
|
|
|
282
|
- {
|
|
|
283
|
- X: 0,
|
|
|
284
|
- Y: 0,
|
|
|
285
|
- Length: 5,
|
|
|
286
|
- ImageData: "a",
|
|
|
287
|
- Direction: domain.DirectionRight,
|
|
|
288
|
- },
|
|
|
289
|
- {
|
|
|
290
|
- X: 0,
|
|
|
291
|
- Y: 1,
|
|
|
292
|
- Length: 5,
|
|
|
293
|
- ImageData: "b",
|
|
|
294
|
- Direction: domain.DirectionDown,
|
|
|
295
|
- },
|
|
|
296
|
- {
|
|
|
297
|
- X: 1,
|
|
|
298
|
- Y: 0,
|
|
|
299
|
- Length: 5,
|
|
|
300
|
- ImageData: "c",
|
|
|
301
|
- Direction: domain.DirectionRight,
|
|
|
302
|
- },
|
|
|
303
|
- {
|
|
|
304
|
- X: 2,
|
|
|
305
|
- Y: 0,
|
|
|
306
|
- Length: 5,
|
|
|
307
|
- ImageData: "d",
|
|
|
308
|
- Direction: domain.DirectionRight,
|
|
|
309
|
- },
|
|
|
310
|
- },
|
|
|
311
|
- flag: Location{X: 2, Y: 1},
|
|
|
312
|
- },
|
|
|
313
|
-
|
|
|
314
|
- {
|
|
|
315
|
- title: "正常多字段横排(长度不一样)+竖排",
|
|
|
316
|
- cells: []*domain.LayoutCell{
|
|
|
317
|
- // 分组一
|
|
|
318
|
- {
|
|
|
319
|
- X: 0,
|
|
|
320
|
- Y: 0,
|
|
|
321
|
- Length: 5,
|
|
|
322
|
- ImageData: "a",
|
|
|
323
|
- Direction: domain.DirectionRight,
|
|
|
324
|
- },
|
|
|
325
|
- {
|
|
|
326
|
- X: 0,
|
|
|
327
|
- Y: 1,
|
|
|
328
|
- Length: 5,
|
|
|
329
|
- ImageData: "b",
|
|
|
330
|
- Direction: domain.DirectionDown,
|
|
|
331
|
- },
|
|
|
332
|
- {
|
|
|
333
|
- X: 1,
|
|
|
334
|
- Y: 0,
|
|
|
335
|
- Length: 6,
|
|
|
336
|
- ImageData: "c",
|
|
|
337
|
- Direction: domain.DirectionRight,
|
|
|
338
|
- },
|
|
|
339
|
- {
|
|
|
340
|
- X: 2,
|
|
|
341
|
- Y: 0,
|
|
|
342
|
- Length: 7,
|
|
|
343
|
- ImageData: "d",
|
|
|
344
|
- Direction: domain.DirectionRight,
|
|
|
345
|
- },
|
|
|
346
|
- },
|
|
|
347
|
- flag: Location{X: 2, Y: 1},
|
|
|
348
|
- },
|
|
|
349
|
-
|
|
|
350
|
- {
|
|
|
351
|
- title: "测试用例1",
|
|
|
352
|
- cells: []*domain.LayoutCell{
|
|
|
353
|
- // 分组一
|
|
|
354
|
- {
|
|
|
355
|
- X: 0,
|
|
|
356
|
- Y: 0,
|
|
|
357
|
- Length: 1,
|
|
|
358
|
- ImageData: "a",
|
|
|
359
|
- Direction: domain.DirectionNone,
|
|
|
360
|
- },
|
|
|
361
|
- {
|
|
|
362
|
- X: 0,
|
|
|
363
|
- Y: 1,
|
|
|
364
|
- Length: 1,
|
|
|
365
|
- ImageData: "b",
|
|
|
366
|
- Direction: domain.DirectionNone,
|
|
|
367
|
- },
|
|
|
368
|
- {
|
|
|
369
|
- X: 2,
|
|
|
370
|
- Y: 2,
|
|
|
371
|
- Length: 5,
|
|
|
372
|
- ImageData: "c",
|
|
|
373
|
- Direction: domain.DirectionRight,
|
|
|
374
|
- },
|
|
|
375
|
- },
|
|
|
376
|
- flag: Location{X: 0, Y: 0},
|
|
|
377
|
- },
|
|
|
378
|
- {
|
|
|
379
|
- title: "测试用例3",
|
|
|
380
|
- cells: []*domain.LayoutCell{
|
|
|
381
|
- // 分组一
|
|
|
382
|
- {
|
|
|
383
|
- X: 0,
|
|
|
384
|
- Y: 0,
|
|
|
385
|
- Length: 5,
|
|
|
386
|
- ImageData: "a",
|
|
|
387
|
- Direction: domain.DirectionRight,
|
|
|
388
|
- },
|
|
|
389
|
- {
|
|
|
390
|
- X: 1,
|
|
|
391
|
- Y: 0,
|
|
|
392
|
- Length: 5,
|
|
|
393
|
- ImageData: "b",
|
|
|
394
|
- Direction: domain.DirectionDown,
|
|
|
395
|
- },
|
|
|
396
|
- {
|
|
|
397
|
- X: 1,
|
|
|
398
|
- Y: 1,
|
|
|
399
|
- Length: 5,
|
|
|
400
|
- ImageData: "c",
|
|
|
401
|
- Direction: domain.DirectionRight,
|
|
|
402
|
- },
|
|
|
403
|
- {
|
|
|
404
|
- X: 2,
|
|
|
405
|
- Y: 1,
|
|
|
406
|
- Length: 5,
|
|
|
407
|
- ImageData: "d",
|
|
|
408
|
- Direction: domain.DirectionRight,
|
|
|
409
|
- },
|
|
|
410
|
- },
|
|
|
411
|
- flag: Location{X: 2, Y: 1},
|
|
|
412
|
- },
|
|
|
413
|
- {
|
|
|
414
|
- title: "测试用例4",
|
|
|
415
|
- cells: []*domain.LayoutCell{
|
|
|
416
|
- // 分组一
|
|
|
417
|
- {
|
|
|
418
|
- X: 0,
|
|
|
419
|
- Y: 0,
|
|
|
420
|
- Length: 5,
|
|
|
421
|
- ImageData: "a",
|
|
|
422
|
- Direction: domain.DirectionDown,
|
|
|
423
|
- },
|
|
|
424
|
- {
|
|
|
425
|
- X: 0,
|
|
|
426
|
- Y: 1,
|
|
|
427
|
- Length: 5,
|
|
|
428
|
- ImageData: "b",
|
|
|
429
|
- Direction: domain.DirectionDown,
|
|
|
430
|
- },
|
|
|
431
|
- // ,
|
81
|
+ //{
|
|
|
82
|
+ // title: "正常多字段横排",
|
|
|
83
|
+ // cells: []*domain.LayoutCell{
|
|
|
84
|
+ // // 分组一
|
|
|
85
|
+ // {
|
|
|
86
|
+ // X: 0,
|
|
|
87
|
+ // Y: 0,
|
|
|
88
|
+ // Length: 5,
|
|
|
89
|
+ // ImageData: "a",
|
|
|
90
|
+ // Direction: domain.DirectionRight,
|
|
|
91
|
+ // },
|
|
|
92
|
+ // {
|
|
|
93
|
+ // X: 1,
|
|
|
94
|
+ // Y: 0,
|
|
|
95
|
+ // Length: 5,
|
|
|
96
|
+ // ImageData: "b",
|
|
|
97
|
+ // Direction: domain.DirectionRight,
|
|
|
98
|
+ // },
|
|
|
99
|
+ // {
|
|
|
100
|
+ // X: 2,
|
|
|
101
|
+ // Y: 0,
|
|
|
102
|
+ // Length: 5,
|
|
|
103
|
+ // ImageData: "c",
|
|
|
104
|
+ // Direction: domain.DirectionRight,
|
|
|
105
|
+ // },
|
|
|
106
|
+ // {
|
|
|
107
|
+ // X: 3,
|
|
|
108
|
+ // Y: 0,
|
|
|
109
|
+ // Length: 5,
|
|
|
110
|
+ // ImageData: "d",
|
|
|
111
|
+ // Direction: domain.DirectionRight,
|
|
|
112
|
+ // },
|
|
|
113
|
+ //
|
|
|
114
|
+ // // 分组二 平移10
|
|
|
115
|
+ // {
|
|
|
116
|
+ // X: 0,
|
|
|
117
|
+ // Y: 10,
|
|
|
118
|
+ // Length: 5,
|
|
|
119
|
+ // ImageData: "a",
|
|
|
120
|
+ // Direction: domain.DirectionRight,
|
|
|
121
|
+ // },
|
|
|
122
|
+ // {
|
|
|
123
|
+ // X: 1,
|
|
|
124
|
+ // Y: 10,
|
|
|
125
|
+ // Length: 5,
|
|
|
126
|
+ // ImageData: "b",
|
|
|
127
|
+ // Direction: domain.DirectionRight,
|
|
|
128
|
+ // },
|
|
|
129
|
+ // {
|
|
|
130
|
+ // X: 2,
|
|
|
131
|
+ // Y: 10,
|
|
|
132
|
+ // Length: 5,
|
|
|
133
|
+ // ImageData: "c",
|
|
|
134
|
+ // Direction: domain.DirectionRight,
|
|
|
135
|
+ // },
|
|
|
136
|
+ // {
|
|
|
137
|
+ // X: 3,
|
|
|
138
|
+ // Y: 10,
|
|
|
139
|
+ // Length: 5,
|
|
|
140
|
+ // ImageData: "d",
|
|
|
141
|
+ // Direction: domain.DirectionRight,
|
|
|
142
|
+ // },
|
|
|
143
|
+ // },
|
|
|
144
|
+ // flag: Location{X: 3, Y: 4},
|
|
|
145
|
+ //},
|
|
|
146
|
+ //
|
|
|
147
|
+ //{
|
|
|
148
|
+ // title: "正常多字段横排+计算项目",
|
|
|
149
|
+ // cells: []*domain.LayoutCell{
|
|
|
150
|
+ // // 分组一
|
|
|
151
|
+ // {
|
|
|
152
|
+ // X: 0,
|
|
|
153
|
+ // Y: 0,
|
|
|
154
|
+ // Length: 5,
|
|
|
155
|
+ // ImageData: "a",
|
|
|
156
|
+ // Direction: domain.DirectionRight,
|
|
|
157
|
+ // },
|
|
|
158
|
+ // {
|
|
|
159
|
+ // X: 1,
|
|
|
160
|
+ // Y: 0,
|
|
|
161
|
+ // Length: 5,
|
|
|
162
|
+ // ImageData: "b",
|
|
|
163
|
+ // Direction: domain.DirectionRight,
|
|
|
164
|
+ // },
|
|
|
165
|
+ // {
|
|
|
166
|
+ // X: 2,
|
|
|
167
|
+ // Y: 0,
|
|
|
168
|
+ // Length: 1,
|
|
|
169
|
+ // ImageData: "c",
|
|
|
170
|
+ // Direction: domain.DirectionNone,
|
|
|
171
|
+ // },
|
|
|
172
|
+ // {
|
|
|
173
|
+ // X: 3,
|
|
|
174
|
+ // Y: 0,
|
|
|
175
|
+ // Length: 1,
|
|
|
176
|
+ // ImageData: "d",
|
|
|
177
|
+ // Direction: domain.DirectionNone,
|
|
|
178
|
+ // },
|
|
|
179
|
+ //
|
|
|
180
|
+ // // 分组二 平移10
|
|
|
181
|
+ // {
|
|
|
182
|
+ // X: 0,
|
|
|
183
|
+ // Y: 10,
|
|
|
184
|
+ // Length: 1,
|
|
|
185
|
+ // ImageData: "a",
|
|
|
186
|
+ // Direction: domain.DirectionRight,
|
|
|
187
|
+ // },
|
|
|
188
|
+ // {
|
|
|
189
|
+ // X: 1,
|
|
|
190
|
+ // Y: 10,
|
|
|
191
|
+ // Length: 5,
|
|
|
192
|
+ // ImageData: "b",
|
|
|
193
|
+ // Direction: domain.DirectionRight,
|
|
|
194
|
+ // },
|
|
|
195
|
+ // {
|
|
|
196
|
+ // X: 2,
|
|
|
197
|
+ // Y: 10,
|
|
|
198
|
+ // Length: 1,
|
|
|
199
|
+ // ImageData: "c",
|
|
|
200
|
+ // Direction: domain.DirectionNone,
|
|
|
201
|
+ // },
|
|
|
202
|
+ // {
|
|
|
203
|
+ // X: 2,
|
|
|
204
|
+ // Y: 11,
|
|
|
205
|
+ // Length: 1,
|
|
|
206
|
+ // ImageData: "e",
|
|
|
207
|
+ // Direction: domain.DirectionNone,
|
|
|
208
|
+ // },
|
|
|
209
|
+ // {
|
|
|
210
|
+ // X: 3,
|
|
|
211
|
+ // Y: 10,
|
|
|
212
|
+ // Length: 1,
|
|
|
213
|
+ // ImageData: "d",
|
|
|
214
|
+ // Direction: domain.DirectionNone,
|
|
|
215
|
+ // },
|
|
|
216
|
+ // },
|
|
|
217
|
+ // flag: Location{X: 2, Y: 1},
|
|
|
218
|
+ //},
|
|
|
219
|
+ //
|
|
|
220
|
+ //{
|
|
|
221
|
+ // title: "正常多字段横排+竖排",
|
|
|
222
|
+ // cells: []*domain.LayoutCell{
|
|
|
223
|
+ // // 分组一
|
|
|
224
|
+ // {
|
|
|
225
|
+ // X: 0,
|
|
|
226
|
+ // Y: 0,
|
|
|
227
|
+ // Length: 5,
|
|
|
228
|
+ // ImageData: "a",
|
|
|
229
|
+ // Direction: domain.DirectionRight,
|
|
|
230
|
+ // },
|
|
|
231
|
+ // {
|
|
|
232
|
+ // X: 0,
|
|
|
233
|
+ // Y: 1,
|
|
|
234
|
+ // Length: 5,
|
|
|
235
|
+ // ImageData: "b",
|
|
|
236
|
+ // Direction: domain.DirectionDown,
|
|
|
237
|
+ // },
|
|
|
238
|
+ // {
|
|
|
239
|
+ // X: 1,
|
|
|
240
|
+ // Y: 0,
|
|
|
241
|
+ // Length: 5,
|
|
|
242
|
+ // ImageData: "c",
|
|
|
243
|
+ // Direction: domain.DirectionRight,
|
|
|
244
|
+ // },
|
|
|
245
|
+ // {
|
|
|
246
|
+ // X: 2,
|
|
|
247
|
+ // Y: 0,
|
|
|
248
|
+ // Length: 5,
|
|
|
249
|
+ // ImageData: "d",
|
|
|
250
|
+ // Direction: domain.DirectionRight,
|
|
|
251
|
+ // },
|
|
|
252
|
+ // },
|
|
|
253
|
+ // flag: Location{X: 2, Y: 1},
|
|
|
254
|
+ //},
|
|
|
255
|
+ //
|
|
|
256
|
+ //{
|
|
|
257
|
+ // title: "正常多字段横排(长度不一样)+竖排",
|
|
|
258
|
+ // cells: []*domain.LayoutCell{
|
|
|
259
|
+ // // 分组一
|
|
|
260
|
+ // {
|
|
|
261
|
+ // X: 0,
|
|
|
262
|
+ // Y: 0,
|
|
|
263
|
+ // Length: 5,
|
|
|
264
|
+ // ImageData: "a",
|
|
|
265
|
+ // Direction: domain.DirectionRight,
|
|
|
266
|
+ // },
|
|
|
267
|
+ // {
|
|
|
268
|
+ // X: 0,
|
|
|
269
|
+ // Y: 1,
|
|
|
270
|
+ // Length: 5,
|
|
|
271
|
+ // ImageData: "b",
|
|
|
272
|
+ // Direction: domain.DirectionDown,
|
|
|
273
|
+ // },
|
|
|
274
|
+ // {
|
|
|
275
|
+ // X: 1,
|
|
|
276
|
+ // Y: 0,
|
|
|
277
|
+ // Length: 6,
|
|
|
278
|
+ // ImageData: "c",
|
|
|
279
|
+ // Direction: domain.DirectionRight,
|
|
|
280
|
+ // },
|
|
|
281
|
+ // {
|
|
|
282
|
+ // X: 2,
|
|
|
283
|
+ // Y: 0,
|
|
|
284
|
+ // Length: 7,
|
|
|
285
|
+ // ImageData: "d",
|
|
|
286
|
+ // Direction: domain.DirectionRight,
|
|
|
287
|
+ // },
|
|
|
288
|
+ // },
|
|
|
289
|
+ // flag: Location{X: 2, Y: 1},
|
|
|
290
|
+ //},
|
|
|
291
|
+ //
|
|
|
292
|
+ //{
|
|
|
293
|
+ // title: "测试用例1",
|
|
|
294
|
+ // cells: []*domain.LayoutCell{
|
|
|
295
|
+ // // 分组一
|
|
|
296
|
+ // {
|
|
|
297
|
+ // X: 0,
|
|
|
298
|
+ // Y: 0,
|
|
|
299
|
+ // Length: 1,
|
|
|
300
|
+ // ImageData: "a",
|
|
|
301
|
+ // Direction: domain.DirectionNone,
|
|
|
302
|
+ // },
|
|
|
303
|
+ // {
|
|
|
304
|
+ // X: 0,
|
|
|
305
|
+ // Y: 1,
|
|
|
306
|
+ // Length: 1,
|
|
|
307
|
+ // ImageData: "b",
|
|
|
308
|
+ // Direction: domain.DirectionNone,
|
|
|
309
|
+ // },
|
|
|
310
|
+ // {
|
|
|
311
|
+ // X: 2,
|
|
|
312
|
+ // Y: 2,
|
|
|
313
|
+ // Length: 5,
|
|
|
314
|
+ // ImageData: "c",
|
|
|
315
|
+ // Direction: domain.DirectionRight,
|
|
|
316
|
+ // },
|
|
|
317
|
+ // },
|
|
|
318
|
+ // flag: Location{X: 0, Y: 0},
|
|
|
319
|
+ //},
|
|
|
320
|
+ //{
|
|
|
321
|
+ // title: "测试用例3",
|
|
|
322
|
+ // cells: []*domain.LayoutCell{
|
|
|
323
|
+ // // 分组一
|
|
|
324
|
+ // {
|
|
|
325
|
+ // X: 0,
|
|
|
326
|
+ // Y: 0,
|
|
|
327
|
+ // Length: 5,
|
|
|
328
|
+ // ImageData: "a",
|
|
|
329
|
+ // Direction: domain.DirectionRight,
|
|
|
330
|
+ // },
|
|
|
331
|
+ // {
|
|
|
332
|
+ // X: 1,
|
|
|
333
|
+ // Y: 0,
|
|
|
334
|
+ // Length: 5,
|
|
|
335
|
+ // ImageData: "b",
|
|
|
336
|
+ // Direction: domain.DirectionDown,
|
|
|
337
|
+ // },
|
432
|
// {
|
338
|
// {
|
433
|
// X: 1,
|
339
|
// X: 1,
|
434
|
// Y: 1,
|
340
|
// Y: 1,
|
|
@@ -443,42 +349,107 @@ func TestDataLayout(t *testing.T) { |
|
@@ -443,42 +349,107 @@ func TestDataLayout(t *testing.T) { |
443
|
// ImageData: "d",
|
349
|
// ImageData: "d",
|
444
|
// Direction: domain.DirectionRight,
|
350
|
// Direction: domain.DirectionRight,
|
445
|
// },
|
351
|
// },
|
446
|
- },
|
|
|
447
|
- flag: Location{X: 0, Y: 0},
|
|
|
448
|
- },
|
|
|
449
|
- {
|
|
|
450
|
- title: "测试用例5",
|
|
|
451
|
- cells: []*domain.LayoutCell{
|
|
|
452
|
- // 分组一
|
|
|
453
|
- {
|
|
|
454
|
- X: 0,
|
|
|
455
|
- Y: 0,
|
|
|
456
|
- Length: 5,
|
|
|
457
|
- ImageData: "a",
|
|
|
458
|
- Direction: domain.DirectionDown,
|
|
|
459
|
- },
|
|
|
460
|
- {
|
|
|
461
|
- X: 0,
|
|
|
462
|
- Y: 1,
|
|
|
463
|
- Length: 6,
|
|
|
464
|
- ImageData: "b",
|
|
|
465
|
- Direction: domain.DirectionDown,
|
|
|
466
|
- },
|
|
|
467
|
- {
|
|
|
468
|
- X: 1,
|
|
|
469
|
- Y: 0,
|
|
|
470
|
- Length: 1,
|
|
|
471
|
- ImageData: "t",
|
|
|
472
|
- Direction: domain.DirectionNone,
|
|
|
473
|
- },
|
|
|
474
|
- {
|
|
|
475
|
- X: 1,
|
|
|
476
|
- Y: 1,
|
|
|
477
|
- Length: 1,
|
|
|
478
|
- ImageData: "x",
|
|
|
479
|
- Direction: domain.DirectionNone,
|
|
|
480
|
- },
|
|
|
481
|
- // ,
|
352
|
+ // },
|
|
|
353
|
+ // flag: Location{X: 2, Y: 1},
|
|
|
354
|
+ //},
|
|
|
355
|
+ //{
|
|
|
356
|
+ // title: "测试用例4",
|
|
|
357
|
+ // cells: []*domain.LayoutCell{
|
|
|
358
|
+ // // 分组一
|
|
|
359
|
+ // {
|
|
|
360
|
+ // X: 0,
|
|
|
361
|
+ // Y: 0,
|
|
|
362
|
+ // Length: 5,
|
|
|
363
|
+ // ImageData: "a",
|
|
|
364
|
+ // Direction: domain.DirectionDown,
|
|
|
365
|
+ // },
|
|
|
366
|
+ // {
|
|
|
367
|
+ // X: 0,
|
|
|
368
|
+ // Y: 1,
|
|
|
369
|
+ // Length: 5,
|
|
|
370
|
+ // ImageData: "b",
|
|
|
371
|
+ // Direction: domain.DirectionDown,
|
|
|
372
|
+ // },
|
|
|
373
|
+ // // ,
|
|
|
374
|
+ // // {
|
|
|
375
|
+ // // X: 1,
|
|
|
376
|
+ // // Y: 1,
|
|
|
377
|
+ // // Length: 5,
|
|
|
378
|
+ // // ImageData: "c",
|
|
|
379
|
+ // // Direction: domain.DirectionRight,
|
|
|
380
|
+ // // },
|
|
|
381
|
+ // // {
|
|
|
382
|
+ // // X: 2,
|
|
|
383
|
+ // // Y: 1,
|
|
|
384
|
+ // // Length: 5,
|
|
|
385
|
+ // // ImageData: "d",
|
|
|
386
|
+ // // Direction: domain.DirectionRight,
|
|
|
387
|
+ // // },
|
|
|
388
|
+ // },
|
|
|
389
|
+ // flag: Location{X: 0, Y: 0},
|
|
|
390
|
+ //},
|
|
|
391
|
+ //{
|
|
|
392
|
+ // title: "测试用例5",
|
|
|
393
|
+ // cells: []*domain.LayoutCell{
|
|
|
394
|
+ // // 分组一
|
|
|
395
|
+ // {
|
|
|
396
|
+ // X: 0,
|
|
|
397
|
+ // Y: 0,
|
|
|
398
|
+ // Length: 5,
|
|
|
399
|
+ // ImageData: "a",
|
|
|
400
|
+ // Direction: domain.DirectionDown,
|
|
|
401
|
+ // },
|
|
|
402
|
+ // {
|
|
|
403
|
+ // X: 0,
|
|
|
404
|
+ // Y: 1,
|
|
|
405
|
+ // Length: 6,
|
|
|
406
|
+ // ImageData: "b",
|
|
|
407
|
+ // Direction: domain.DirectionDown,
|
|
|
408
|
+ // },
|
|
|
409
|
+ // {
|
|
|
410
|
+ // X: 1,
|
|
|
411
|
+ // Y: 0,
|
|
|
412
|
+ // Length: 1,
|
|
|
413
|
+ // ImageData: "t",
|
|
|
414
|
+ // Direction: domain.DirectionNone,
|
|
|
415
|
+ // },
|
|
|
416
|
+ // {
|
|
|
417
|
+ // X: 1,
|
|
|
418
|
+ // Y: 1,
|
|
|
419
|
+ // Length: 1,
|
|
|
420
|
+ // ImageData: "x",
|
|
|
421
|
+ // Direction: domain.DirectionNone,
|
|
|
422
|
+ // },
|
|
|
423
|
+ // // ,
|
|
|
424
|
+ // // {
|
|
|
425
|
+ // // X: 1,
|
|
|
426
|
+ // // Y: 1,
|
|
|
427
|
+ // // Length: 5,
|
|
|
428
|
+ // // ImageData: "c",
|
|
|
429
|
+ // // Direction: domain.DirectionRight,
|
|
|
430
|
+ // // },
|
|
|
431
|
+ // // {
|
|
|
432
|
+ // // X: 2,
|
|
|
433
|
+ // // Y: 1,
|
|
|
434
|
+ // // Length: 5,
|
|
|
435
|
+ // // ImageData: "d",
|
|
|
436
|
+ // // Direction: domain.DirectionRight,
|
|
|
437
|
+ // // },
|
|
|
438
|
+ // },
|
|
|
439
|
+ // flag: Location{X: 0, Y: 0},
|
|
|
440
|
+ // debug:true,
|
|
|
441
|
+ //},
|
|
|
442
|
+ //{
|
|
|
443
|
+ // title: "测试用例6",
|
|
|
444
|
+ // cells: []*domain.LayoutCell{
|
|
|
445
|
+ // // 分组一
|
|
|
446
|
+ // {
|
|
|
447
|
+ // X: 0,
|
|
|
448
|
+ // Y: 0,
|
|
|
449
|
+ // Length: 1,
|
|
|
450
|
+ // ImageData: "a",
|
|
|
451
|
+ // Direction: domain.DirectionNone,
|
|
|
452
|
+ // },
|
482
|
// {
|
453
|
// {
|
483
|
// X: 1,
|
454
|
// X: 1,
|
484
|
// Y: 1,
|
455
|
// Y: 1,
|
|
@@ -493,38 +464,9 @@ func TestDataLayout(t *testing.T) { |
|
@@ -493,38 +464,9 @@ func TestDataLayout(t *testing.T) { |
493
|
// ImageData: "d",
|
464
|
// ImageData: "d",
|
494
|
// Direction: domain.DirectionRight,
|
465
|
// Direction: domain.DirectionRight,
|
495
|
// },
|
466
|
// },
|
496
|
- },
|
|
|
497
|
- flag: Location{X: 0, Y: 0},
|
|
|
498
|
- debug:true,
|
|
|
499
|
- },
|
|
|
500
|
- {
|
|
|
501
|
- title: "测试用例6",
|
|
|
502
|
- cells: []*domain.LayoutCell{
|
|
|
503
|
- // 分组一
|
|
|
504
|
- {
|
|
|
505
|
- X: 0,
|
|
|
506
|
- Y: 0,
|
|
|
507
|
- Length: 1,
|
|
|
508
|
- ImageData: "a",
|
|
|
509
|
- Direction: domain.DirectionNone,
|
|
|
510
|
- },
|
|
|
511
|
- {
|
|
|
512
|
- X: 1,
|
|
|
513
|
- Y: 1,
|
|
|
514
|
- Length: 5,
|
|
|
515
|
- ImageData: "c",
|
|
|
516
|
- Direction: domain.DirectionRight,
|
|
|
517
|
- },
|
|
|
518
|
- {
|
|
|
519
|
- X: 2,
|
|
|
520
|
- Y: 1,
|
|
|
521
|
- Length: 5,
|
|
|
522
|
- ImageData: "d",
|
|
|
523
|
- Direction: domain.DirectionRight,
|
|
|
524
|
- },
|
|
|
525
|
- },
|
|
|
526
|
- flag: Location{X: 0, Y: 0},
|
|
|
527
|
- },
|
467
|
+ // },
|
|
|
468
|
+ // flag: Location{X: 0, Y: 0},
|
|
|
469
|
+ //},
|
528
|
}
|
470
|
}
|
529
|
padding := func(cells []*domain.LayoutCell) {
|
471
|
padding := func(cells []*domain.LayoutCell) {
|
530
|
for _, cell := range cells {
|
472
|
for _, cell := range cells {
|
|
@@ -533,9 +475,9 @@ func TestDataLayout(t *testing.T) { |
|
@@ -533,9 +475,9 @@ func TestDataLayout(t *testing.T) { |
533
|
}
|
475
|
}
|
534
|
}
|
476
|
}
|
535
|
}
|
477
|
}
|
536
|
- debugItem:= false
|
478
|
+ debugItem := false
|
537
|
for _, input := range inputs {
|
479
|
for _, input := range inputs {
|
538
|
- if debugItem && !input.debug{
|
480
|
+ if debugItem && !input.debug {
|
539
|
continue
|
481
|
continue
|
540
|
}
|
482
|
}
|
541
|
padding(input.cells)
|
483
|
padding(input.cells)
|