This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch tymux-10-quiet-head
in repository terminology.

View the commit online.

commit df26530208fc1f5ba76240ac440e003a418a3677
Author: Boris Faure <[email protected]>
AuthorDate: Thu Nov 12 16:26:54 2026 +0000

    tests: check a one-cell block survives multi-line region scrolls
    
    An inline media block counts one reference per cell, and dropping a
    reference before taking the new one frees a one-cell block still on
    screen. Check that SU, SD, IL and DL of several lines in a scroll
    region keep the reference of a block that stays on screen, and free it
    once it scrolls off.
---
 src/bin/termpty.c    | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/bin/tytest.c     |  1 +
 src/bin/unit_tests.h |  1 +
 3 files changed, 54 insertions(+)

diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 01d53226..71e72aea 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -4170,6 +4170,58 @@ tytest_block_row_shifts(void)
      }
    return 0;
 }
+
+/* A one-cell block on row 5, scrolled by several lines in a region: it
+ * keeps its one reference while on screen, and is freed once off it. */
+int
+tytest_block_region_scrolls(void)
+{
+   static const struct {
+      const char *seq;
+      Eina_Bool kept;
+   } scrolls[] = {
+      { "\033[2;10r\033[3S", EINA_TRUE },             /* SU */
+      { "\033[2;10r\033[3T", EINA_TRUE },             /* SD */
+      { "\033[2;10r\033[3;1H\033[2M", EINA_TRUE },    /* DL */
+      { "\033[2;10r\033[3;1H\033[4L", EINA_TRUE },    /* IL */
+      { "\033[?69h\033[2;40s\033[2;10r\033[3S", EINA_TRUE },
+      { "\033[2;10r\033[7S", EINA_FALSE },
+      { "\033[2;10r\033[6T", EINA_FALSE },
+      { "\033[2;10r\033[5;1H\033[9M", EINA_FALSE },
+   };
+   Termpty *ty = tytest_termpty_get();
+   unsigned int i;
+
+   eina_init();
+   ecore_init();
+   for (i = 0; i < EINA_C_ARRAY_LENGTH(scrolls); i++)
+     {
+        Termblock *blk;
+        int id;
+
+        tytest_common_init();
+        blk = termpty_block_new(ty, 1, 1, "/img.png", NULL);
+        assert(blk);
+        id = blk->id;
+        termpty_block_insert(ty, '#', blk);
+        ty->block.on = EINA_TRUE;
+        _ty_feed(ty, "\033[2J\033[5;3H#");
+        ty->block.on = EINA_FALSE;
+        assert(termpty_block_get(ty, id) == blk);
+        assert(blk->refs == 1);
+
+        _ty_feed(ty, scrolls[i].seq);
+        if (scrolls[i].kept)
+          {
+             assert(termpty_block_get(ty, id) == blk);
+             assert(blk->refs == 1);
+          }
+        else
+          assert(termpty_block_get(ty, id) == NULL);
+        tytest_common_shutdown();
+     }
+   return 0;
+}
 #endif
 
 #endif /* BINARY_TYFUZZ || BINARY_TYTEST */
diff --git a/src/bin/tytest.c b/src/bin/tytest.c
index 7d922608..a5fedefc 100644
--- a/src/bin/tytest.c
+++ b/src/bin/tytest.c
@@ -42,6 +42,7 @@ static struct {
 #endif
        { "block_render_idle", tytest_block_render_idle},
        { "block_row_shifts", tytest_block_row_shifts},
+       { "block_region_scrolls", tytest_block_region_scrolls},
        { "sb_add", tytest_sb_add},
        { "sb_prepend", tytest_sb_prepend},
        { "sb_skip", tytest_sb_skip},
diff --git a/src/bin/unit_tests.h b/src/bin/unit_tests.h
index e2cd4ec6..a65f768b 100644
--- a/src/bin/unit_tests.h
+++ b/src/bin/unit_tests.h
@@ -16,6 +16,7 @@ int tytest_truecolor_render(void);
 #endif
 int tytest_block_render_idle(void);
 int tytest_block_row_shifts(void);
+int tytest_block_region_scrolls(void);
 int tytest_sb_add(void);
 int tytest_sb_prepend(void);
 int tytest_sb_skip(void);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to