Skip to content

Fix response curve action test and add a new test case demonstrating how to modify action parameters in the test#624

Merged
WhiteMagic merged 10 commits intoWhiteMagic:developfrom
code-monet:test_response_curve
Aug 28, 2025
Merged

Fix response curve action test and add a new test case demonstrating how to modify action parameters in the test#624
WhiteMagic merged 10 commits intoWhiteMagic:developfrom
code-monet:test_response_curve

Conversation

@code-monet
Copy link
Copy Markdown
Contributor

I will add more tests to this PR in the next few days to cover the other types of curves.

@WhiteMagic
Copy link
Copy Markdown
Owner

Sounds good, I should also be done with the sweeping changes caused by renaming the intermediate output system.

@code-monet
Copy link
Copy Markdown
Contributor Author

Added the remaining test cases, please take a look.

I think I found a bug - the "symmetry" option for the cubic splines does not work, and I had to explicitly add points on both sides. In the UI, if I enable symmetry and add a point, the symmetric point is not added. I can fix that in a follow-up PR if you like.

@code-monet
Copy link
Copy Markdown
Contributor Author

code-monet commented Aug 26, 2025

Okay, added a commit for that as well.

I had to change some expected values very slightly for the cubic Bezier spline if I didn't add (0, 0) explicitly after enabling symmetry - not sure if it matters and it might actually be expected?

Comment thread gremlin/spline.py
Args:
x: x-coordinate of the control point
y: y-coordinate of the control point
x: x-coordinate of the control point (will be clamped).
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One could think of a RangeValue data type that enforces this and also makes the behavior/intent clear as this sort of "value has to be within" comes up in a few places.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's one way to do it, let me know what you think and I'll open a PR

Comment thread gremlin/spline.py
points = self.control_points()
points[idx].x = x
points[idx].y = y
if self.is_symmetric:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code didn't have this before either, but it may be worthwhile adding a check for the implied invariant that there is an odd number of control points when the symmetry mode is active.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added check and added a test case that uses this function.

@WhiteMagic
Copy link
Copy Markdown
Owner

WhiteMagic commented Aug 26, 2025

Looks good to me so far. I think there is also something horribly broken with the UI for the response curve, at least it misbehaved quite badly when I quickly tried it before. So another thing to revisit.

To me this looks fine and I can go ahead and merge it unless you have more tweaks you want to make to it.

@code-monet
Copy link
Copy Markdown
Contributor Author

Please go ahead and merge it if the latest commits look fine, thanks!

I didn't find the UI too broken, although I did notice that you can create spline curves that go out of bounds (didn't try running it):

image

@code-monet
Copy link
Copy Markdown
Contributor Author

Hang on, not sure why the test is failing - investigating.

@code-monet
Copy link
Copy Markdown
Contributor Author

Okay, looks like adding that assert exposed a bug. Added a commit to fix the bug, let me know if more changes are desired, otherwise please go ahead with merging this PR.

@WhiteMagic
Copy link
Copy Markdown
Owner

Looks all good to me. And the curves going outside the valid range is also in R13 so not a regression. I think there is code later in the pipeline that would result in those curve values being clamped if one attempted to send them to vJoy (but not 100% certain).

@WhiteMagic WhiteMagic merged commit 897b6d4 into WhiteMagic:develop Aug 28, 2025
1 check passed
@code-monet code-monet deleted the test_response_curve branch August 29, 2025 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants