Anim: add keyframing unit tests #122553
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#122553
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "nathanvegdahl/blender:keyframing_unit_tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add unit tests for the two main keyframing API functions:
insert_key_rna()
andinsert_keyframe()
.This is (partly) in preparation for landing #121661 and #122053, to help catch unintended changes to existing behavior.
The tests are not exhaustive of every possible permutation of parameters, but the tests do try to hit each of the behaviors in at least one permutation. In the future tests should also be added for the lower-level keying functions and behaviors as well, but I'm leaving that as future work since we aren't changing/refactoring those functions right now.
Note to reviewers: the test for the NLA quaternions special case is only implemented for
insert_keyframe()
and notinsert_key_rna()
because the latter doesn't implement that special case and thus wouldn't pass. I suspect this is becauseinsert_key_rna()
is used for viewport keyframing where in theory you can't key individual components of the quaternion anyway. In any case, the two functions will be merged and this will become moot when we land #122053.insert_keyframe()
2e47dc89dainsert_keys_rna()
3174b1b49dinsert_key_rna()
test for passing a non-ID RNA pointers 079770d806WIP: Anim: add keyframing unit teststo Anim: add keyframing unit testsThe tests don't seem to check whether a key was actually inserted, and with which value/frame (they just check that an FCurve was created). I think that's kinda important for a key insertion function.
I feel that at least one of the various tests for each specific function (so once for
insert_key_rna
, once forinsert_keyframe
, etc) there should be a test that checks that key insertion also works correctly when there is actually already an F-Curve there, and a key is inserted at a different frame. Even thoughinsert_keyframe__only_available
is testing with pre-existing FCurves, theanim_eval_context
doesn't change, and so the 2nd key is overwriting the 1st key, still resulting in a 1-key FCurve.The expects that are there to prevent
nullptr
dereference should actual be asserts:as this will immediately stop the test, instead of reporting failure but continuing.
Having the NLA keying tests in there is nice, and much needed ;-)
@ -0,0 +268,4 @@
anim_eval_context);
EXPECT_EQ(0, result_1.get_count(SingleKeyingResult::SUCCESS));
EXPECT_NE(nullptr, object->adt);
Why should the
adt
not benullptr
, if the key insertion failed? Might be worth adding a message.Same as below: I don't know why this should be the case, but it is how it behaves currently, so I'm testing it to ensure no unintentional changes.
@ -0,0 +269,4 @@
EXPECT_EQ(0, result_1.get_count(SingleKeyingResult::SUCCESS));
EXPECT_NE(nullptr, object->adt);
EXPECT_NE(nullptr, object->adt->action);
I didn't expect this (so 👍 for getting it tested). Deleting the last FCurve from an Action deletes the Action, but apparently failing to insert a key will create an empty Action. Might also be worth a message that explains why/how, or maybe even that if this specific
EXPECT
fails, it's kind of a good thing?Yeah, good point.
I added the checks for completeness to ensure the behavior doesn't change unintentionally, but to be honest the current behavior seems kind of arbitrary, and it's not clear to me why it was chosen or if it's even desireable. So perhaps something along the lines of:
Yeah, perfect. It makes a nice distinction between "noticing behavioural changes" and "saying it should work this way".
@dr.sybren I believe I've addressed all of your comments now.
LGTM!