Files
cfree/tests/theme_tests.sh
Muse 4c998e7888 Code window: separate top-level window, red paused line, automatic variable inspection
- The code view is now its own top-level window (FDesigner — Code),
  opened together with the designer at startup; View -> Code View
  toggles it. Closing hides it (app keeps running); reopening
  restores it with fresh content.
- Automatic variable inspection pane at the bottom of the code
  window: on every debugger stop it shows the current scope
  (function — file:line (reason)) and the frame locals
  (name/type/value) from the SAME shared GdbSession (200 ms poll
  in main; no second gdb). While running it shows a running state
  and never presents stale values; on exit it shows the exit code.
  On stop the stopped file is loaded into the code view if needed
  and any fold hiding the paused line is unfolded.
- Paused line: solid red (#c00000) full-line background with white
  text, plus a white gutter arrow — Lazarus-style execution-point
  marking (ahaExecutionPoint: full-line background + gutter arrow,
  distinct from the red-dot breakpoint marker), adapted to the
  user-requested red. The paused tag outranks the current-line tag
  and syntax tags; it clears on resume and moves on step.
- Debugger window: F5 Continue / F10 Step Over / F11 Step Into
  shortcuts (tooltips already promised them); new accessors for the
  code-window poll (poll_events, session_state, stop_seq,
  last_stop, locals, refresh_on_stop) and a debugger_autorun test
  hook; GdbSession gains a stop_seq() accessor.
- Tests: tests/code_window_tests.sh drives the real app under Xvfb
  (separate window, stop + locals in two scopes, red-band pixels,
  step moves the band, resume clears it, running state, gutter
  click stages/removes a breakpoint in the backend, close/reopen)
  plus self-test checks for the paused tag colours/priority and the
  inspection API. FDESIGNER_DEBUG_TARGET/BREAK and
  FDESIGNER_CODEWIN_DUMP hooks support it.
2026-11-25 14:12:54 -05:00

99 lines
3.5 KiB
Bash
Executable File

#!/bin/sh
# FDesigner color themes + code-view gutter/folding tests.
# tests/theme_tests.sh
# Builds + runs the theme harness (tests/theme_tests.cpp, needs Xvfb),
# runs the fdesigner self-test (which has its own theme/folding block),
# and smoke tests the real Code View window and Color Theme dialog
# (FDESIGNER_OPEN_CODEVIEW / FDESIGNER_OPEN_THEME) with xdotool if
# available. Prints a PASS/FAIL summary; exits non-zero on any failure.
# Run from the repo root.
set -u
ROOT=$(cd "$(dirname "$0")/.." && pwd)
cd "$ROOT"
FAIL=0
say() { printf '%s\n' "$*"; }
say "== building theme harness =="
g++ -O2 -Wall -Wextra -std=c++17 -I src -o /tmp/theme_tests tests/theme_tests.cpp \
src/theme.cpp src/codeview.cpp src/debugger.cpp src/debugger_ui.cpp \
$(pkg-config --cflags --libs gtk+-3.0) \
2>/tmp/theme_tests_build.log || {
say "FAIL theme harness build"; cat /tmp/theme_tests_build.log; exit 1
}
if grep -q "warning" /tmp/theme_tests_build.log; then
say "FAIL theme harness build has warnings"; cat /tmp/theme_tests_build.log
FAIL=1
fi
say "== theme harness (under Xvfb) =="
rm -rf /tmp/fdesigner_theme_home
xvfb-run -a /tmp/theme_tests || FAIL=1
say "== building fdesigner =="
make >/tmp/theme_make.log 2>&1 || {
say "FAIL fdesigner build"; cat /tmp/theme_make.log; FAIL=1
}
if grep -q "warning" /tmp/theme_make.log; then
say "FAIL fdesigner build has warnings"
grep "warning" /tmp/theme_make.log
FAIL=1
fi
if [ "$FAIL" = "0" ]; then
say "== fdesigner self-test (includes theme/folding block) =="
FDESIGNER_SELFTEST=1 xvfb-run -a ./fdesigner || FAIL=1
fi
say "== View menu wiring =="
grep -q 'id="mi_view_code"' ui/designer.ui &&
grep -q 'id="mi_view_theme"' ui/designer.ui &&
grep -q 'mi_view_code' src/main.cpp &&
grep -q 'mi_view_theme' src/main.cpp &&
say "PASS menu-items-wired" ||
{ say "FAIL menu-items-wired"; FAIL=1; }
if ! command -v xdotool >/dev/null 2>&1; then
say "SKIP GUI smoke tests (xdotool not installed)"
else
say "== Code View window smoke test =="
xvfb-run -a sh -c '
FDESIGNER_OPEN_CODEVIEW=1 ./fdesigner >/tmp/theme_codeview.log 2>&1 &
APP=$!
FOUND=""
i=0
while [ $i -lt 50 ]; do
FOUND=$(xdotool search --name "FDesigner — Code" 2>/dev/null | head -1)
[ -n "$FOUND" ] && break
sleep 0.2; i=$((i+1))
done
if [ -n "$FOUND" ]; then echo "PASS codeview-opened (window $FOUND)"; else echo "FAIL codeview-did-not-open"; fi
kill $APP 2>/dev/null
wait $APP 2>/dev/null
[ -n "$FOUND" ]
' || FAIL=1
say "== Color Theme dialog smoke test =="
xvfb-run -a sh -c '
FDESIGNER_OPEN_THEME=1 ./fdesigner >/tmp/theme_dlg.log 2>&1 &
APP=$!
FOUND=""
i=0
while [ $i -lt 50 ]; do
FOUND=$(xdotool search --name "^Color Theme$" 2>/dev/null | head -1)
[ -n "$FOUND" ] && break
sleep 0.2; i=$((i+1))
done
if [ -n "$FOUND" ]; then
echo "PASS theme-dialog-opened (window $FOUND)"
xdotool windowactivate "$FOUND" key Escape
sleep 0.5
else
echo "FAIL theme-dialog-did-not-open"
xdotool search --name ".*" getwindowname %@ 2>/dev/null | head -5
fi
kill $APP 2>/dev/null
wait $APP 2>/dev/null
[ -n "$FOUND" ]
' || FAIL=1
fi
if [ "$FAIL" = "0" ]; then say "THEME TESTS: ALL PASS"; else say "THEME TESTS: FAILURES (see above)"; fi
exit "$FAIL"