Editor: balao de resultado no clique duplo com previa de curvas (lista de pontos)

This commit is contained in:
mguinhos committed 2026-10-20 21:01:59 -03:00
1 parent b1b15a4c49
commit f794d8b8c7
3 files changed
+167 -20

No files matched your search

+22 -3
View File
@@ -14,6 +14,8 @@
#include <tb_variables.h>
#include <tb_appearance.h>
#include <tb_pen.h>
#include <tb_curves.h>
#include <tb_base64.h>
static TinyBlocks* rt;
static TinyBlocks_Block *ev, *scene;
@@ -122,6 +124,8 @@ int main(void) {
tb_library_register(rt, tb_variables_get_library());
tb_library_register(rt, tb_appearance_get_library());
tb_library_register(rt, tb_pen_get_library());
tb_library_register(rt, tb_curves_get_library());
tb_library_register(rt, tb_base64_get_library());
tb_library_register(rt, tb_graphics_get_library());
tb_library_register(rt, tb_editor_get_library());
(void)eval_ev;
@@ -169,9 +173,9 @@ int main(void) {
if (need("+", R_WS, 0, &x, &y)) {
click(x - 22, y); type("2"); key(TB_KEY_RETURN, 0, 0);
if (need("+", R_WS, 0, &x, &y)) { click(x + 22, y); type("3"); key(TB_KEY_RETURN, 0, 0); }
if (need("+", R_WS, 0, &x, &y)) click(x, y);
if (need("+", R_WS, 0, &x, &y)) { click(x, y); click(x, y); } /* clique duplo */
}
CHECK(ws_has("5"), "repórter clicado mostra balão com 5 (2+3)");
CHECK(ws_has("5"), "clique duplo no repórter mostra balão com 5 (2+3)");
/* 5. Encaixar o repórter (2+3) no campo de "mude x para (0)" */
if (need("para", R_WS, 0, &x2, &y2) && need("+", R_WS, 0, &x, &y)) {
@@ -253,7 +257,7 @@ int main(void) {
type("21"); key(TB_KEY_RETURN, 0, 0);
}
}
if (need("dobro", R_WS, 0, &x, &y)) click(x, y);
if (need("dobro", R_WS, 0, &x, &y)) { click(x, y); click(x, y); }
CHECK(ws_has("22"), "bloco composto dobro(21) = 22");
if (!ws_has("22")) { for (uint32_t i = 0; i < ncmd; i++) if (cmds[i].kind==TB_DRAW_TEXT && in_region(cmds[i].x,R_WS)) printf(" ws: %s (%.0f,%.0f)\n", cmds[i].text, cmds[i].x, cmds[i].y); }
@@ -419,6 +423,21 @@ int main(void) {
CHECK(!find("Configurações", R_ANY, 0, &x, &y), "Esc fecha as configuracoes");
unsetenv("TINYBLOCKS_SETTINGS");
/* 19. Previa de resultado: curva (lista de pontos) em balão, clique duplo */
if (need("Curvas", R_CAT, 0, &x, &y)) click(x, y);
frame(0, 0, 0, 0, 0, 0, NULL);
if (need("círculo em (", R_FLY, 0, &x, &y)) drag(x, y, 620, 500);
frame(0, 0, 0, 0, 0, 0, NULL);
if (need("círculo em (", R_WS, 0, &x, &y)) { click(x, y); click(x, y); }
frame(0, 0, 0, 0, 0, 0, NULL);
{
int lines = 0;
for (uint32_t i = 0; i < ncmd; i++)
if (cmds[i].kind == TB_DRAW_STROKE_LINE && in_region(cmds[i].x, R_WS)) lines++;
CHECK(lines >= 20, "clique duplo na curva desenha a polilinha no balão");
}
CHECK(ws_has("37 pontos"), "balão mostra a contagem de pontos da curva");
printf("comandos de desenho no último frame: %u\n", ncmd);
tinyblocks_deinit(&rt);
printf(fails ? "\n%d FALHA(S)\n" : "\nTUDO OK\n", fails);