This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch win10-msvc-trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 1c2218b5bdaa8342cb38f1c1f7bf485976afcfe7
Author: Peter Kovacs <[email protected]>
AuthorDate: Sun Aug 23 00:03:17 2026 +0200

    slideshow: give testShapeRepaint's shapes distinct priorities
    
    LayerManagerTest.testShapeRepaint created pShape4 and pShape5 both at
    priority 4.0.  Shape::lessThanShape tie-breaks equal priorities on raw
    pointer value, so the two ordered by heap address, and
    LayerManager::updateShapeLayers -- which scans shapes in z-order looking for
    animated/non-animated discontinuities -- assigned them to layers differently
    depending on allocation history.  Different layers, different repaint sets,
    different render counts.
    
        slidetest.cxx(234): Value of: pShape4->getNumRenders() == 2
          Actual: false / Expected: true
    
    The test is what is wrong, not LayerManager.  Priorities come from
    ShapeImporter as a running counter (mnAscendingPrio += 1.0 per shape), so
    they are unique by construction and the tie cannot occur in production; the
    pointer tie-break exists only to stop std::set treating two shapes as
    equivalent and dropping one.  Being order-sensitive is the algorithm's job,
    and with a genuine tie there is no correct answer to give it.
    
    This has always been broken -- x86 passed on the luck of its heap layout:
    
                           before          after
        default order      fail 4/4        pass 6/6
        --gtest_shuffle    fail 2/3        pass 10/10
    
    testLayer also has two shapes at 1.0, but they go to separate Layer objects
    via updateBounds() and never share a ShapeSet, so nothing compares them.
    Left alone.
    
    Co-Authored-By: Claude Opus 5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_01VrM7EMKgiuyVcCUe9nSbZR
---
 main/slideshow/test/slidetest.cxx | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/main/slideshow/test/slidetest.cxx 
b/main/slideshow/test/slidetest.cxx
index b22e81f26f..2e083b07d9 100644
--- a/main/slideshow/test/slidetest.cxx
+++ b/main/slideshow/test/slidetest.cxx
@@ -201,9 +201,19 @@ TEST_F(LayerManagerTest, testShapeRepaint)
     TestShapeSharedPtr pShape4( createTestShape(
         basegfx::B2DRange(0.0,0.0,10.0,10.0),
         4.0));
+    // NB: priority must differ from pShape4's.  Shape::lessThanShape
+    // tie-breaks equal priorities on raw pointer value, so two shapes at the
+    // same priority order by heap address -- which makes updateShapeLayers()
+    // assign them to layers differently depending on allocation history, and
+    // this test then passes or fails with the wind (it survived on x86 and
+    // failed on x64; --gtest_shuffle flips it on either).  The tie cannot
+    // occur in production: ShapeImporter hands out priorities from a running
+    // counter (mnAscendingPrio += 1.0 per shape), so they are unique by
+    // construction, and the pointer tie-break exists only to stop std::set
+    // from treating two shapes as equivalent and dropping one.
     TestShapeSharedPtr pShape5( createTestShape(
         basegfx::B2DRange(20.0,20.0,30.0,30.0),
-        4.0));
+        5.0));
 
     mpLayerManager->addShape(mpTestShape);
     mpLayerManager->addShape(pShape2);

Reply via email to