Harness: teste de regressao ao arrastar bloco da Caneta para o chapeu

This commit is contained in:
mguinhos committed 2026-10-20 20:05:58 -03:00
1 parent f37884ccdf
commit f616503caa
3 files changed
+1094

No files matched your search

+754
View File
@@ -0,0 +1,754 @@
{
"format": "tinyblocks-project",
"version": 1,
"cur_tab": 1,
"tabs": [
{
"name": "Código",
"composite": false,
"comp_id": -1,
"color": 0,
"ws_sx": 0,
"ws_sy": 0,
"blocks": [
{
"i": 0,
"type": "Events.WhenRun",
"x": 40,
"y": 40,
"parent": -1,
"prel": -1,
"next": 7,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 1,
"type": "Variables.Set",
"x": 42,
"y": 183,
"parent": 7,
"prel": 0,
"next": 2,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"x",
"0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 2,
"type": "Control.Repeat",
"x": 0,
"y": 0,
"parent": 1,
"prel": 0,
"next": 6,
"sub": [
3,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"5",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 3,
"type": "Variables.Change",
"x": 0,
"y": 0,
"parent": 2,
"prel": 1,
"next": 4,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"x",
"1",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 4,
"type": "IO.Print",
"x": 0,
"y": 0,
"parent": 3,
"prel": 0,
"next": -1,
"sub": [
-1,
-1
],
"args": [
-1,
5,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"x vale",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 5,
"type": "Variables.Get",
"x": 0,
"y": 0,
"parent": 4,
"prel": 4,
"next": -1,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"x",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 6,
"type": "Stage.Clear",
"x": 51,
"y": 90,
"parent": 2,
"prel": 0,
"next": 9,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 7,
"type": "Stage.Clear",
"x": 55,
"y": 109,
"parent": 0,
"prel": 0,
"next": 1,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 8,
"type": "Stage.Text",
"x": 117,
"y": 406,
"parent": 9,
"prel": 0,
"next": -1,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"Olá!",
"-40",
"0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 9,
"type": "Stage.Clear",
"x": 43,
"y": 115,
"parent": 6,
"prel": 0,
"next": 8,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
}
],
"top": [
0
]
},
{
"name": "Código 2",
"composite": false,
"comp_id": -1,
"color": 0,
"ws_sx": 0,
"ws_sy": 0,
"blocks": [
{
"i": 0,
"type": "Events.WhenRun",
"x": 229,
"y": 55,
"parent": -1,
"prel": -1,
"next": 1,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 1,
"type": "Stage.Clear",
"x": 222,
"y": 103,
"parent": 0,
"prel": 0,
"next": 2,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 2,
"type": "Stage.Background",
"x": 243,
"y": 137,
"parent": 1,
"prel": 0,
"next": 3,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"255",
"255",
"255",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 3,
"type": "Stage.Rect",
"x": 219,
"y": 345,
"parent": 2,
"prel": 0,
"next": -1,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"0",
"0",
"120",
"80",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
}
],
"top": [
0
]
},
{
"name": "aa",
"composite": true,
"comp_id": 0,
"color": 0,
"ws_sx": 0,
"ws_sy": 0,
"blocks": [],
"top": []
}
],
"user_blocks": [
{
"name": "aa",
"color": 0,
"tab": 2,
"inputs": [],
"outputs": [],
"parts": []
}
],
"variables": []
}
+322
View File
@@ -0,0 +1,322 @@
{
"format": "tinyblocks-project",
"version": 1,
"cur_tab": 0,
"tabs": [
{
"name": "Código",
"composite": false,
"comp_id": -1,
"color": 0,
"ws_sx": 0,
"ws_sy": 0,
"blocks": [
{
"i": 0,
"type": "Events.WhenRun",
"x": 40,
"y": 40,
"parent": -1,
"prel": -1,
"next": 1,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 1,
"type": "Variables.Set",
"x": 0,
"y": 0,
"parent": 0,
"prel": 0,
"next": 2,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"x",
"0",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 2,
"type": "Control.Repeat",
"x": 0,
"y": 0,
"parent": 1,
"prel": 0,
"next": -1,
"sub": [
3,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"5",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 3,
"type": "Variables.Change",
"x": 0,
"y": 0,
"parent": 2,
"prel": 1,
"next": 4,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"x",
"1",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 4,
"type": "IO.Print",
"x": 0,
"y": 0,
"parent": 3,
"prel": 0,
"next": -1,
"sub": [
-1,
-1
],
"args": [
-1,
5,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"x vale",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
},
{
"i": 5,
"type": "Variables.Get",
"x": 0,
"y": 0,
"parent": 4,
"prel": 4,
"next": -1,
"sub": [
-1,
-1
],
"args": [
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1
],
"in_text": [
"x",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
],
"lit": ""
}
],
"top": [
0
]
}
],
"user_blocks": [],
"variables": []
}
+18
View File
@@ -345,6 +345,24 @@ int main(void) {
CHECK(any_has("Exportado xml"), "exportar XML pelo menu escreve o arquivo");
remove(expf);
/* 15. Regressao: arrastar um bloco da Caneta para o chapeu */
if (need("Caneta", R_CAT, 0, &x, &y)) click(x, y);
frame(0, 0, 0, 0, 0, 0, NULL);
int clear_before = 0;
{ float a, b; for (int k = 0; find("apague tudo", R_WS, k, &a, &b); k++) clear_before++; }
if (need("apague tudo", R_FLY, 0, &x, &y)) {
float hx, hy;
if (need("quando a bandeira for clicado", R_WS, 0, &hx, &hy)) {
float bx = hx - 3 - 10, by = hy - 18 - 18;
float gx = x - 3 - 10, gy = y - 18;
drag(x, y, x + (bx - gx), y + (by + 54 - gy) + 6);
}
}
frame(0, 0, 0, 0, 0, 0, NULL);
int clear_after = 0;
{ float a, b; for (int k = 0; find("apague tudo", R_WS, k, &a, &b); k++) clear_after++; }
CHECK(clear_after == clear_before + 1, "arrastar bloco da Caneta para o chapeu");
printf("comandos de desenho no último frame: %u\n", ncmd);
tinyblocks_deinit(&rt);
printf(fails ? "\n%d FALHA(S)\n" : "\nTUDO OK\n", fails);