Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

SpaceMouse tests wait for the echo to end, not a fixed time; impacted.py matches whole file names

islandmedfcacc8160247
diff --git a/src/app/UiTest.cpp b/src/app/UiTest.cpp
index 4a0446a4..21ef0e65 100644
--- a/src/app/UiTest.cpp
+++ b/src/app/UiTest.cpp
@@ -289,7 +289,8 @@
// scroll: only the wheel, from the cap's first stir (inside the dead zone) and on for a
// quarter second after it is let go (stragglers; fenix's slow tilt, 11-06)
// spacemouse_unplug unplug it
-// expect_value spacemouse_connected (1 when the app opened it), spacemouse_moving (1 while it moves the view)
+// expect_value spacemouse_connected (1 when the app opened it), spacemouse_moving (1 while it moves the view),
+// spacemouse_echo (1 while a mouse wheel would be dropped as the driver's echo)
// ui_scale PERCENT | auto Preferences > Interface > UI scale (applied live, #87); display_scale PERCENT: the display's
// content scale changes, with SDL's event (Windows DPI, another monitor); logical_width W: the display scale that makes the window W logical px wide (#105)
// expect_value ui_scale (percent built now), font_height (default font, px), frame_height, panel_width (right
@@ -1188,6 +1189,11 @@ double Demo::query(const std::string& name, bool& known) const {
if (name == "touch_fingers") return double(app_.touch_.fingers());
if (name == "spacemouse_connected") return app_.spaceMouse_ ? 1.0 : 0.0;
if (name == "spacemouse_moving") return app_.spaceMouseMoving() ? 1.0 : 0.0;
+ if (name == "spacemouse_echo") { // a mouse's wheel turned now would be taken for the driver's echo
+ SDL_Event e{};
+ e.type = SDL_EVENT_MOUSE_WHEEL;
+ return app_.spaceMouseEcho(e) ? 1.0 : 0.0;
+ }
if (name == "camera_distance") return app_.camera_.distance;
if (name == "camera_pan") return glm::length(app_.camera_.target);
if (name == "groups") {
diff --git a/tests/ui/spacemouse_pen.sfui b/tests/ui/spacemouse_pen.sfui
index 01751063..c5aeb849 100644
--- a/tests/ui/spacemouse_pen.sfui
+++ b/tests/ui/spacemouse_pen.sfui
@@ -112,11 +112,11 @@ pen_lift
pen_rest off
key ctrl+z
-# Without the cap pushed the mouse and its wheel work as ever (the wheel kSpaceMouseEchoHold, 0.3 s, after the cap
-# last moved: spacemouse_tilt.sfui).
+# Without the cap pushed the mouse and its wheel work as ever (the wheel once the echo is over, kSpaceMouseEchoHold
+# after the cap last moved: spacemouse_tilt.sfui).
pen_out
spacemouse_echo off
-wait 0.4
+wait_value spacemouse_echo == 0 5
key f
remember camera_distance d3
wheel 0.5 0.5 2
diff --git a/tests/ui/spacemouse_tilt.sfui b/tests/ui/spacemouse_tilt.sfui
index 3ae24e9d..4681f44f 100644
--- a/tests/ui/spacemouse_tilt.sfui
+++ b/tests/ui/spacemouse_tilt.sfui
@@ -65,6 +65,6 @@ expect_value camera_pan <= $p0+0.0001
# The echo is over: the mouse wheel zooms again.
spacemouse_echo off
-wait 0.5
+wait_value spacemouse_echo == 0 5
wheel 0.5 0.5 3
expect_value camera_distance < $d0-0.01
diff --git a/tools/test/impacted.py b/tools/test/impacted.py
index 5b7bb5b1..c02eb377 100644
--- a/tools/test/impacted.py
+++ b/tools/test/impacted.py
@@ -83,6 +83,7 @@ def changed_files(root, base):
def words(path):
stem = os.path.splitext(os.path.basename(path))[0]
parts = re.findall(r"[A-Z]?[a-z]+|[A-Z]+(?![a-z])|[0-9]+", stem)
+ parts.append(stem) # the whole name too: SpaceMouse.cpp -> ui_spacemouse_pen (a test names it as one word)
return {p.lower() for p in parts if len(p) >= 4 and p.lower() not in STOP_WORDS}
@@ -427,7 +428,8 @@ def self_test():
assert rc("@@ -3 +3 @@\n- c.cpp)\n+ b.cpp)\n") == "." # a source list: everything
assert rc("@@ -1 +1 @@\n-project(y)\n+project(x)\n") == "."
assert r() == ""
- assert words("src/app/PanelMicroLevels.cpp") == {"micro", "levels"}
+ assert words("src/app/PanelMicroLevels.cpp") == {"micro", "levels", "panelmicrolevels"}
+ assert "spacemouse" in words("src/app/SpaceMouse.cpp")
print("impacted.py self-test passed")
return 0