Skip to content

Commit 16d0ccc

Browse files
committed
chore(textureatlas): Fix vertical order unit test debug output
1 parent 5213dfc commit 16d0ccc

File tree

1 file changed

+114
-111
lines changed

1 file changed

+114
-111
lines changed

packages/engine/Specs/Renderer/TextureAtlasSpec.js

Lines changed: 114 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,10 @@ describe("Scene/TextureAtlas", function () {
415415
`
416416
............
417417
............
418-
..1120......
419-
..1120......
420418
..0000......
421419
..0000......
420+
..1120......
421+
..1120......
422422
............
423423
............
424424
`.trim(),
@@ -626,22 +626,22 @@ describe("Scene/TextureAtlas", function () {
626626

627627
expect(drawAtlas(atlas, [index0, index1, index2, index3])).toBe(
628628
`
629-
2222222222222222333333333301....
630-
222222222222222233333333330.....
631-
222222222222222233333333330.....
632-
222222222222222233333333330.....
633-
22222222222222223333333333......
634-
22222222222222223333333333......
635-
22222222222222223333333333......
636-
22222222222222223333333333......
637-
22222222222222223333333333......
638-
22222222222222223333333333......
639629
2222222222222222................
640630
2222222222222222................
641631
2222222222222222................
642632
2222222222222222................
643633
2222222222222222................
644634
2222222222222222................
635+
22222222222222223333333333......
636+
22222222222222223333333333......
637+
22222222222222223333333333......
638+
22222222222222223333333333......
639+
22222222222222223333333333......
640+
22222222222222223333333333......
641+
222222222222222233333333330.....
642+
222222222222222233333333330.....
643+
222222222222222233333333330.....
644+
2222222222222222333333333301....
645645
`.trim(),
646646
);
647647

@@ -717,10 +717,22 @@ describe("Scene/TextureAtlas", function () {
717717
if (isWebGL2) {
718718
expect(drawAtlas(atlas, [index0, index1, index2, index3])).toBe(
719719
`
720-
333333333333333301..
721-
33333333333333330...
722-
33333333333333330...
723-
33333333333333330...
720+
....................
721+
....................
722+
....................
723+
....................
724+
....................
725+
....................
726+
2222222222..........
727+
2222222222..........
728+
2222222222..........
729+
2222222222..........
730+
2222222222..........
731+
2222222222..........
732+
2222222222..........
733+
2222222222..........
734+
2222222222..........
735+
2222222222..........
724736
3333333333333333....
725737
3333333333333333....
726738
3333333333333333....
@@ -733,43 +745,31 @@ describe("Scene/TextureAtlas", function () {
733745
3333333333333333....
734746
3333333333333333....
735747
3333333333333333....
736-
2222222222..........
737-
2222222222..........
738-
2222222222..........
739-
2222222222..........
740-
2222222222..........
741-
2222222222..........
742-
2222222222..........
743-
2222222222..........
744-
2222222222..........
745-
2222222222..........
746-
....................
747-
....................
748-
....................
749-
....................
750-
....................
751-
....................
748+
33333333333333330...
749+
33333333333333330...
750+
33333333333333330...
751+
333333333333333301..
752752
`.trim(),
753753
);
754754
} else {
755755
expect(drawAtlas(atlas, [index0, index1, index2, index3])).toBe(
756756
`
757-
3333333333333333222222222201....
758-
333333333333333322222222220.....
759-
333333333333333322222222220.....
760-
333333333333333322222222220.....
761-
33333333333333332222222222......
762-
33333333333333332222222222......
763-
33333333333333332222222222......
764-
33333333333333332222222222......
765-
33333333333333332222222222......
766-
33333333333333332222222222......
767757
3333333333333333................
768758
3333333333333333................
769759
3333333333333333................
770760
3333333333333333................
771761
3333333333333333................
772762
3333333333333333................
763+
33333333333333332222222222......
764+
33333333333333332222222222......
765+
33333333333333332222222222......
766+
33333333333333332222222222......
767+
33333333333333332222222222......
768+
33333333333333332222222222......
769+
333333333333333322222222220.....
770+
333333333333333322222222220.....
771+
333333333333333322222222220.....
772+
3333333333333333222222222201....
773773
`.trim(),
774774
);
775775
}
@@ -832,22 +832,6 @@ describe("Scene/TextureAtlas", function () {
832832
expect(drawAtlas(atlas, [index0, index1, index2, index3])).toBe(
833833
`
834834
................................
835-
.2222222222222222333333333301...
836-
.22222222222222223333333333.....
837-
.22222222222222223333333333.....
838-
.22222222222222223333333333.....
839-
.22222222222222223333333333.....
840-
.22222222222222223333333333.....
841-
.22222222222222223333333333.....
842-
.22222222222222223333333333.....
843-
.22222222222222223333333333.....
844-
.22222222222222223333333333.....
845-
.2222222222222222...............
846-
.2222222222222222...............
847-
.2222222222222222...............
848-
.2222222222222222...............
849-
.2222222222222222...............
850-
.2222222222222222...............
851835
................................
852836
................................
853837
................................
@@ -862,6 +846,22 @@ describe("Scene/TextureAtlas", function () {
862846
................................
863847
................................
864848
................................
849+
.2222222222222222...............
850+
.2222222222222222...............
851+
.2222222222222222...............
852+
.2222222222222222...............
853+
.2222222222222222...............
854+
.2222222222222222...............
855+
.22222222222222223333333333.....
856+
.22222222222222223333333333.....
857+
.22222222222222223333333333.....
858+
.22222222222222223333333333.....
859+
.22222222222222223333333333.....
860+
.22222222222222223333333333.....
861+
.22222222222222223333333333.....
862+
.22222222222222223333333333.....
863+
.22222222222222223333333333.....
864+
.2222222222222222333333333301...
865865
................................
866866
`.trim(),
867867
);
@@ -917,7 +917,8 @@ describe("Scene/TextureAtlas", function () {
917917
expect(drawAtlas(atlas, [index0, index1, index2])).toBe(
918918
`
919919
..............
920-
.222222222201.
920+
..............
921+
..............
921922
.2222222222...
922923
.2222222222...
923924
.2222222222...
@@ -927,8 +928,7 @@ describe("Scene/TextureAtlas", function () {
927928
.2222222222...
928929
.2222222222...
929930
.2222222222...
930-
..............
931-
..............
931+
.222222222201.
932932
..............
933933
`.trim(),
934934
);
@@ -956,22 +956,6 @@ describe("Scene/TextureAtlas", function () {
956956
expect(drawAtlas(atlas, [index0, index1, index2, index3])).toBe(
957957
`
958958
................................
959-
.3333333333333333222222222201...
960-
.33333333333333332222222222.....
961-
.33333333333333332222222222.....
962-
.33333333333333332222222222.....
963-
.33333333333333332222222222.....
964-
.33333333333333332222222222.....
965-
.33333333333333332222222222.....
966-
.33333333333333332222222222.....
967-
.33333333333333332222222222.....
968-
.33333333333333332222222222.....
969-
.3333333333333333...............
970-
.3333333333333333...............
971-
.3333333333333333...............
972-
.3333333333333333...............
973-
.3333333333333333...............
974-
.3333333333333333...............
975959
................................
976960
................................
977961
................................
@@ -986,6 +970,22 @@ describe("Scene/TextureAtlas", function () {
986970
................................
987971
................................
988972
................................
973+
.3333333333333333...............
974+
.3333333333333333...............
975+
.3333333333333333...............
976+
.3333333333333333...............
977+
.3333333333333333...............
978+
.3333333333333333...............
979+
.33333333333333332222222222.....
980+
.33333333333333332222222222.....
981+
.33333333333333332222222222.....
982+
.33333333333333332222222222.....
983+
.33333333333333332222222222.....
984+
.33333333333333332222222222.....
985+
.33333333333333332222222222.....
986+
.33333333333333332222222222.....
987+
.33333333333333332222222222.....
988+
.3333333333333333222222222201...
989989
................................
990990
`.trim(),
991991
);
@@ -1062,14 +1062,6 @@ describe("Scene/TextureAtlas", function () {
10621062
drawAtlas(atlas, [imageIndex0, index1, index2, index3, index4]),
10631063
).toBe(
10641064
`
1065-
1111333300000000
1066-
1111333300000000
1067-
1111333300000000
1068-
1111333300000000
1069-
2222444400000000
1070-
2222444400000000
1071-
2222444400000000
1072-
2222444400000000
10731065
0000000000000000
10741066
0000000000000000
10751067
0000000000000000
@@ -1078,6 +1070,14 @@ describe("Scene/TextureAtlas", function () {
10781070
0000000000000000
10791071
0000000000000000
10801072
0000000000000000
1073+
2222444400000000
1074+
2222444400000000
1075+
2222444400000000
1076+
2222444400000000
1077+
1111333300000000
1078+
1111333300000000
1079+
1111333300000000
1080+
1111333300000000
10811081
`.trim(),
10821082
);
10831083

@@ -1187,22 +1187,22 @@ describe("Scene/TextureAtlas", function () {
11871187
]),
11881188
).toBe(
11891189
`
1190-
11110000000000003333333333......
1191-
11110000000000003333333333......
1192-
11110000000000003333333333......
1193-
11110000000000003333333333......
1194-
22220000000000003333333333......
1195-
22220000000000003333333333......
1196-
22220000000000003333333333......
1197-
22220000000000003333333333......
1198-
00000000000000003333333333......
1199-
00000000000000003333333333......
12001190
0000000000000000................
12011191
0000000000000000................
12021192
0000000000000000................
12031193
0000000000000000................
12041194
0000000000000000................
12051195
0000000000000000................
1196+
00000000000000003333333333......
1197+
00000000000000003333333333......
1198+
22220000000000003333333333......
1199+
22220000000000003333333333......
1200+
22220000000000003333333333......
1201+
22220000000000003333333333......
1202+
11110000000000003333333333......
1203+
11110000000000003333333333......
1204+
11110000000000003333333333......
1205+
11110000000000003333333333......
12061206
`.trim(),
12071207
);
12081208

@@ -1216,22 +1216,22 @@ describe("Scene/TextureAtlas", function () {
12161216
]),
12171217
).toBe(
12181218
`
1219-
00000000000000004444333333......
1220-
00000000000000004444333333......
1221-
00000000000000004444333333......
1222-
00000000000000004444333333......
1223-
00000000000000005555333333......
1224-
00000000000000005555333333......
1225-
00000000000000005555333333......
1226-
00000000000000005555333333......
1227-
00000000000000003333333333......
1228-
00000000000000003333333333......
12291219
0000000000000000................
12301220
0000000000000000................
12311221
0000000000000000................
12321222
0000000000000000................
12331223
0000000000000000................
12341224
0000000000000000................
1225+
00000000000000003333333333......
1226+
00000000000000003333333333......
1227+
00000000000000005555333333......
1228+
00000000000000005555333333......
1229+
00000000000000005555333333......
1230+
00000000000000005555333333......
1231+
00000000000000004444333333......
1232+
00000000000000004444333333......
1233+
00000000000000004444333333......
1234+
00000000000000004444333333......
12351235
`.trim(),
12361236
);
12371237

@@ -1307,10 +1307,6 @@ describe("Scene/TextureAtlas", function () {
13071307
drawAtlas(atlas, [imageIndex0, imageIndex3, index1, index2]),
13081308
).toBe(
13091309
`
1310-
33333333333333331100............
1311-
33333333333333331100............
1312-
33333333333333330022............
1313-
33333333333333330022............
13141310
3333333333333333................
13151311
3333333333333333................
13161312
3333333333333333................
@@ -1323,6 +1319,10 @@ describe("Scene/TextureAtlas", function () {
13231319
3333333333333333................
13241320
3333333333333333................
13251321
3333333333333333................
1322+
33333333333333330022............
1323+
33333333333333330022............
1324+
33333333333333331100............
1325+
33333333333333331100............
13261326
`.trim(),
13271327
);
13281328

@@ -1414,6 +1414,9 @@ function drawAtlas(atlas, indices) {
14141414
}
14151415
}
14161416

1417-
// print to text.
1418-
return rows.map((row) => row.join("")).join("\n");
1417+
// print. atlas origin is bottom-left.
1418+
return rows
1419+
.reverse()
1420+
.map((row) => row.join(""))
1421+
.join("\n");
14191422
}

0 commit comments

Comments
 (0)