Skip to content

test: Pin the rest of obs_bounds_fit_scale - #1469

Merged
zackees merged 1 commit into
obs-rust:masterfrom
nathan-v:test/scene-bounds-fit
Oct 20, 2026
Merged

zackees merged 1 commit into
obs-rust:masterfrom
nathan-v:test/scene-bounds-fit

Conversation

@nathan-v

@nathan-v nathan-v commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

Refs #1468. Characterization before the port of libobs/obs-scene-bounds.c.h. No Rust in this change. The port may not edit this test.

test/cmocka/test_scene_bounds_fit.c already pinned the empty-source regression and the wide 200x100 fit into 800x600. The new cases pin the branches those tests only checked as finite.

Test Pinned behavior
tall_source_uses_the_other_axis 100x200 into 800x600. Inner is 3x, outer is 8x, stretch is (8, 3). Max-only leaves the scale, because the source still fits.
uneven_base_scale_is_multiplied Both components of the base scale are multiplied. A different number on each axis stays different, including a flipped max-only that is too wide and one that is too tall.
zero_axis_keeps_its_scale A zero axis is skipped. The scale already on that axis stays, including a scale other than 1. Inner of a 200x0 source still fits the width.
stretch_zero_scale_is_positive Stretch keeps the sign and replaces the magnitude. A zero component is positive, so that axis becomes the positive box ratio.
max_only_shrinks_only_past_the_box A scaled size equal to the box is left alone. One pixel past it, on either axis, scales down like inner.
bounds_none_keeps_scale OBS_BOUNDS_NONE matches no branch. The scale is unchanged.

The five tests that were already in the file are unchanged.

Motivation and Context

obs_bounds_fit_scale is the next unclaimed libobs core unit (#1468). The port has to match the C, and the old test let a wrong tall-source fit, a uniform-only scale, and a stretch of zero through as long as the result was finite. This pins those results against the C file before the Rust PR.

The test compiles obs-scene-bounds.c.h into itself. The function is not exported from libobs, so this binary does not see a later Rust swap. test_group_empty_bounds is the scene-level check.

How Has This Been Tested?

macOS arm64, the existing build_rust_OFF object obs-scene-bounds.o (the C file, unchanged) linked with this test and Homebrew cmocka 2.0.2. 11/11 passed, the original five and the six added here.

The local gate is not stamped. This PR is from the fork, so CI runs the suite anyway.

Types of changes

  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

The empty-source cases and the wide 200x100 fit stay as they
are. These cases pin the tall source, a base scale that differs
per axis, a zero axis that keeps its scale, stretch of a zero
scale, the max-only edge of the box, and OBS_BOUNDS_NONE.

Refs obs-rust#1468
@nathan-v
nathan-v requested a review from zackees as a code owner October 20, 2026 00:38
@zackees
zackees enabled auto-merge October 20, 2026 00:41
@zackees
zackees added this pull request to the merge queue Oct 20, 2026
Merged via the queue into obs-rust:master with commit 96fd7fe Oct 20, 2026
23 checks passed
@nathan-v nathan-v mentioned this pull request Oct 20, 2026
9 of 10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants