package world import ( "testing" "github.com/stretchr/testify/require" ) func TestPivotZoom_CursorAtCenter_KeepsCamera(t *testing.T) { t.Parallel() cx, cy := PivotZoomCameraNoWrap( 50*SCALE, 60*SCALE, 100, 80, 50, 40, // cursor at center SCALE, 2*SCALE, ) require.Equal(t, 50*SCALE, cx) require.Equal(t, 60*SCALE, cy) } func TestPivotZoom_RightEdge_ZoomInMovesCameraRight(t *testing.T) { t.Parallel() // viewport 100px, cursor at x=100 (right edge), center is 50 => offX=50px // zoom 1->2 halves worldPerPx, so camera must move towards the cursor to keep the same world point. cx0 := 50 * SCALE cx, _ := PivotZoomCameraNoWrap( cx0, 50*SCALE, 100, 100, 100, 50, SCALE, 2*SCALE, ) require.Greater(t, cx, cx0) } func TestPivotZoom_LeftEdge_ZoomInMovesCameraLeft(t *testing.T) { t.Parallel() cx0 := 50 * SCALE cx, _ := PivotZoomCameraNoWrap( cx0, 50*SCALE, 100, 100, 0, 50, SCALE, 2*SCALE, ) require.Less(t, cx, cx0) }