Repository navigation
test: Characterize scene bounds placement - #1640
Merged
Merged
Conversation
calculate_bounds_data still resolves absolute versus relative bounds, which needs the scene. The fit, alignment, crop and flip that follow it now live in obs_bounds_place, and add_alignment moved with them. Same behavior. The Rust port of this unit comes later.
obs_bounds_place and add_alignment are not exported, so the test compiles the C and pins what it does today, odd cases included. Sixteen cases, and no display.
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.
Refs #1637
What and why
The placement half of
calculate_bounds_datamoves out ofobs-scene.c.hbefore the Rust port. The scene still resolves absolute versus relative bounds (size_to_absoluteneeds the scene) and then callsobs_bounds_place. That function fits the scale, aligns the origin, optionally crops, and keeps a flipped item in the box.add_alignmentmoves with it. Transitions and item alignment still calladd_alignment. The declaration inobs-internal.his unchanged.The new file is its own unity group,
libobs.scene-bounds-place, onLIBOBS_SOURCES. It stays C. The port, later, moves the include into a ported group.obs_bounds_placeandadd_alignmentare not exported.test_scene_bounds_placecompilesobs-scene-bounds-place.c.handobs-scene-bounds.c.hand pins the current C, odd cases included. No display. It characterizes that C source, so a later Rust swap stays invisible until the symbols are reachable from the test.Characterized, not endorsed (comments in the test):
add_alignmentuses integer division toward zero. RIGHT wins when LEFT and RIGHT are both set. BOTTOM wins when TOP and BOTTOM are both set. Center is the bit being clear.roundfof 0.5 is 1, half away from zero.< -0.1.-0.0625does not crop.-0.25does, and then rounds to a 0 crop. The sentinel and the origin show the branch ran.(uint32_t)of the bounds, so10.9becomes10.OBS_BOUNDS_NONEignores the crop flag even when both axes overflow. A cropping type takes the width axis whenwidth_diff < -0.1. This test does not feed a negative box into that cast.RED → GREEN
311bb927dlibobs: Move scene bounds placement out of obs-scene.c2f5adc3catest: Characterize scene bounds placement.test_scene_bounds_place16/16, compiled-Wall -Wextra -Werrorand run under UBSan.libobs.core-source) and the new group both compile with the macOS libobs flags (-Werror,-fvisibility=hidden).nm -mshows_add_alignmentand_obs_bounds_placeas private external. The scene TU references both and does not define them.ci/test_build_groups.py,ci/test_ported_sources.py,ci/test_naming.py,ci/test_platform_ifdef_ratchet.pyandci/test_cmocka_sanitize.pypassed. clang-format 22.1.3 and gersemi 0.25.0 are clean on the changed files.soldr cargo fmt --all --check, workspace clippy-D warnings, andsoldr cargo dylint --all -- --workspace --lib --binspassed../lintstopped in pre-existing macOS host tests (readelf,-Wl,-soname,/varversus/private/var, Windows facade compiles). No stamp. Docker Tier 2 was not run here. PR CI runs it.Checklist
master(or the description starts with a Stacked: note)docs/features.mdis added or updated (not applicable: no user-visible change)-W..., ratchets): built with scripting ON (a flag change under cmake/ or build-aux/ runs the full builds) and cross-checked with clang and MSVC (not applicable: no flag change)