Repository navigation
Test the widgets and the Editor's undo and redo - #2
Merged
schikani merged 2 commits intoOct 4, 2026
Merged
Conversation
test_widgets: text box editing, scrolling, own buffer and paste; list keys, wheel, clicks and shrinking; the scrollbar; checkbox, button and progress bar; focus order; message and input boxes; the window and widget slots kept for a message box. test_editor: undo by word, runs of Backspace and Delete, typing over a selection, cut / copy / paste and a terminal paste as single steps, the '*' following the save point, a new edit ending redo, the history limits, and closing with unsaved changes. The file is in memory and the text is read back from the screen.
save() passes E.path to save_to(), which copied it onto itself with snprintf. That is undefined: glibc empties the string, so on Linux the title turned "untitled" after the first Ctrl+S and the next one asked for a name (Save as). Found by the new Editor test on the Linux CI runner; test_save_twice now checks it directly.
Collaborator
|
Thanks, nice work! Reading the Editor back from the screen is a smart way to test it, and the save-twice bug was a real catch. It showed up with glibc, so I'd never have hit it on Windows. Good thing the Linux CI runner caught it. Tested here on MinGW, with and without MQTT TLS: builds clean, all 9 tests pass. Merging. Heads-up: I'll be moving the C sources to clang-format soon (braces on their own lines, no single-line bodies) and adding a |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
Two new CTest programs. Nothing in the library or the apps changes.
tinydesk_core): text box editing, horizontalscrolling,
td_textbox_set_buffer()and bracketed paste; list keys, wheel,clicks, double click and shrinking; the scrollbar's arrows, track and drag;
checkbox, button (fires on release, only over the button) and progress bar;
Tab / Shift+Tab focus order with hidden widgets; message box answers (Enter,
Tab, click, Esc, [x]) and modality; input box and password box (stars on
screen); the window slot and widgets kept free for a message box.
tinydesk_apps): undo a word at a time; runs ofBackspace and Delete, typing over a selection, cut, paste and a terminal
paste (CR / CRLF to LF) as single steps; Ctrl+Y and Ctrl+Shift+Z redo; a new
edit ending redo; the
*in the title following the save point; thehistory dropping its oldest steps and still undoing and redoing to the right
text; a paste larger than the history; Esc with unsaved changes (Cancel,
Discard, Save).
Both use synthetic events through
td_wm_dispatch(), liketest_wm. TheEditor test gives the port a
td_fs_ops_tthat keeps one file in memory andreads the text and the status bar back from the composed screen, so it tests
what the user sees rather than the Editor's internals.
One check depends on a default size: the history test pastes 10,000 bytes to
go past
TD_EDITOR_UNDO(6 KB).Tested
no warnings with
-Werror, 9/9 CTest programs pass.Each was caught: no new undo step per word; history offsets not adjusted
when old steps are dropped; a run of Delete undone one key at a time; CRLF
pasted as two line breaks; no widgets kept for dialogs; the password drawn
in clear; the list view not following the selection; Ctrl/Alt keys typed
into a text box; a button firing on press.