include/test/cppunitasserthelper.hxx         |   16 -------
 include/test/unoapi_test.hxx                 |   12 +++++
 sc/qa/unit/helper/qahelper.hxx               |   11 ----
 sc/qa/unit/tiledrendering/tiledrendering.cxx |    4 -
 sw/source/uibase/uiview/viewport.cxx         |    2 
 test/Library_test.mk                         |    1 
 test/source/cppunitasserthelper.cxx          |   60 ---------------------------
 7 files changed, 16 insertions(+), 90 deletions(-)

New commits:
commit 93e3443f6c1c25533f79ac1f72f382122f00c48d
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat Jan 20 11:47:25 2024 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sat Jan 20 17:11:06 2024 +0100

    ofz#65979 Null-dereference READ
    
    Change-Id: I1eec7948bef2838a439fe05eedddb7245d3c2e31
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162331
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sw/source/uibase/uiview/viewport.cxx 
b/sw/source/uibase/uiview/viewport.cxx
index 08d9b0c39338..a7ec3f161b60 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -1163,6 +1163,7 @@ bool SwView::UpdateScrollbars()
         const tools::Long lOfst = bBorder ? 0 : DOCUMENTBORDER * 2;
         aTmpSz.AdjustWidth(lOfst ); aTmpSz.AdjustHeight(lOfst );
 
+        if (m_pVScrollbar)
         {
             const bool bVScrollVisible = 
m_pVScrollbar->IsScrollbarVisible(true);
             m_pVScrollbar->DocSzChgd( aTmpSz );
@@ -1170,6 +1171,7 @@ bool SwView::UpdateScrollbars()
             if ( bVScrollVisible != m_pVScrollbar->IsScrollbarVisible(true) )
                 bRet = true;
         }
+        if (m_pHScrollbar)
         {
             const bool bHScrollVisible = 
m_pHScrollbar->IsScrollbarVisible(true);
             m_pHScrollbar->DocSzChgd( aTmpSz );
commit 9ff4fd5ccc0a6b54309bba87769c07389f1bf935
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Jan 19 21:37:40 2024 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sat Jan 20 17:10:56 2024 +0100

    this duplicated CPPUNIT_ASSERT_POINT_EQUAL_WITH_TOLERANCE
    
    so use that instead
    
    Change-Id: I0a627fdd2f2657a3f23d47f014ff7019cab544f2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162330
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/include/test/cppunitasserthelper.hxx 
b/include/test/cppunitasserthelper.hxx
index a4bb9cd6a79c..0fd3806b65fe 100644
--- a/include/test/cppunitasserthelper.hxx
+++ b/include/test/cppunitasserthelper.hxx
@@ -10,15 +10,12 @@
 #ifndef INCLUDED_TEST_CPPUNITASSERTHELPER_HXX
 #define INCLUDED_TEST_CPPUNITASSERTHELPER_HXX
 
-#include <test/testdllapi.hxx>
-
 #include <rtl/ustring.hxx>
 
 #include <com/sun/star/awt/Point.hpp>
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/table/CellAddress.hpp>
 #include <com/sun/star/table/CellRangeAddress.hpp>
-#include <tools/gen.hxx>
 
 #include <cppunit/TestAssert.h>
 
@@ -77,19 +74,6 @@ inline std::string 
CPPUNIT_NS::assertion_traits<css::table::CellRangeAddress>::t
     return ost.str();
 }
 
-CPPUNIT_NS_BEGIN
-
-void OOO_DLLPUBLIC_TEST AssertRectEqualWithTolerance(std::string_view sInfo,
-                                                     const tools::Rectangle& 
rExpected,
-                                                     const tools::Rectangle& 
rActual,
-                                                     const sal_Int32 
nTolerance);
-
-void OOO_DLLPUBLIC_TEST AssertPointEqualWithTolerance(std::string_view sInfo, 
const Point rExpected,
-                                                      const Point rActual,
-                                                      const sal_Int32 
nTolerance);
-
-CPPUNIT_NS_END
-
 #endif // INCLUDED_TEST_CPPUNITASSERTHELPER_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/test/unoapi_test.hxx b/include/test/unoapi_test.hxx
index 25945832963b..a28784543c9f 100644
--- a/include/test/unoapi_test.hxx
+++ b/include/test/unoapi_test.hxx
@@ -103,6 +103,18 @@ inline void assertRectangleEqual(const tools::Rectangle& 
rExpected, const tools:
 #define CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aExpected, aActual, 
aTolerance)              \
     assertRectangleEqual(aExpected, aActual, aTolerance, CPPUNIT_SOURCELINE())
 
+inline void assertPointEqual(const Point& rExpected, const Point& rActual,
+                             const sal_Int32 nTolerance, const 
CppUnit::SourceLine& rSourceLine)
+{
+    CPPUNIT_NS::assertDoubleEquals(rExpected.X(), rActual.X(), nTolerance, 
rSourceLine,
+                                   "different X");
+    CPPUNIT_NS::assertDoubleEquals(rExpected.Y(), rActual.Y(), nTolerance, 
rSourceLine,
+                                   "different Y");
+}
+
+#define CPPUNIT_ASSERT_POINT_EQUAL_WITH_TOLERANCE(aExpected, aActual, 
aTolerance)                  \
+    assertPointEqual(aExpected, aActual, aTolerance, CPPUNIT_SOURCELINE())
+
 #endif // INCLUDED_TEST_UNOAPI_TEST_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index 4b95451c96d1..3bb12e701c70 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -201,15 +201,4 @@ private:
 #define ASSERT_DOUBLES_EQUAL_MESSAGE( message, expected, result )   \
     CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( (message), (expected), (result), 
1e-14 )
 
-inline void assertPointEqual(
-    const Point& rExpected, const Point& rActual, const sal_Int32 nTolerance,
-    const CppUnit::SourceLine& rSourceLine )
-{
-    CPPUNIT_NS::assertDoubleEquals( rExpected.X(), rActual.X(), nTolerance, 
rSourceLine, "different X" );
-    CPPUNIT_NS::assertDoubleEquals( rExpected.Y(), rActual.Y(), nTolerance, 
rSourceLine, "different Y" );
-}
-
-#define CPPUNIT_ASSERT_POINT_EQUAL_WITH_TOLERANCE(aExpected, aActual, 
aTolerance) \
-        assertPointEqual( aExpected, aActual, aTolerance, CPPUNIT_SOURCELINE() 
)
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 2123903fdfeb..db2af2fca1f8 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3432,11 +3432,11 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testCellInvalidationDocWithExistingZo
     // what matters is that they are not utterly different rectangles
     // Without fix result is originally:
     // Comparing invalidation rects Left expected 278 actual 1213 Tolerance 50
-    CppUnit::AssertPointEqualWithTolerance("Comparing invalidations topleft",
+    CPPUNIT_ASSERT_POINT_EQUAL_WITH_TOLERANCE(
                                           aView1.m_aInvalidations[0].TopLeft(),
                                           aView2.m_aInvalidations[0].TopLeft(),
                                           100);
-    CppUnit::AssertPointEqualWithTolerance("Comparing invalidations 
bottomleft",
+    CPPUNIT_ASSERT_POINT_EQUAL_WITH_TOLERANCE(
                                           
aView1.m_aInvalidations[0].BottomLeft(),
                                           
aView2.m_aInvalidations[0].BottomLeft(),
                                           100);
diff --git a/test/Library_test.mk b/test/Library_test.mk
index c51bd826e658..268a68744eaf 100644
--- a/test/Library_test.mk
+++ b/test/Library_test.mk
@@ -56,7 +56,6 @@ $(eval $(call gb_Library_add_exception_objects,test,\
        test/source/helper/form \
        test/source/helper/shape \
        test/source/helper/transferable \
-       test/source/cppunitasserthelper \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/test/source/cppunitasserthelper.cxx 
b/test/source/cppunitasserthelper.cxx
deleted file mode 100644
index b3119b5b26d8..000000000000
--- a/test/source/cppunitasserthelper.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <test/cppunitasserthelper.hxx>
-
-CPPUNIT_NS_BEGIN
-
-void AssertRectEqualWithTolerance(std::string_view sInfo, const 
tools::Rectangle& rExpected,
-                                  const tools::Rectangle& rActual, const 
sal_Int32 nTolerance)
-{
-    // Left
-    OString sMsg = OString::Concat(sInfo) + " Left expected " + 
OString::number(rExpected.Left())
-                   + " actual " + OString::number(rActual.Left()) + " 
Tolerance "
-                   + OString::number(nTolerance);
-    CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(),
-                           std::abs(rExpected.Left() - rActual.Left()) <= 
nTolerance);
-
-    // Top
-    sMsg = OString::Concat(sInfo) + " Top expected " + 
OString::number(rExpected.Top()) + " actual "
-           + OString::number(rActual.Top()) + " Tolerance " + 
OString::number(nTolerance);
-    CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(), std::abs(rExpected.Top() - 
rActual.Top()) <= nTolerance);
-
-    // Width
-    sMsg = OString::Concat(sInfo) + " Width expected " + 
OString::number(rExpected.GetWidth())
-           + " actual " + OString::number(rActual.GetWidth()) + " Tolerance "
-           + OString::number(nTolerance);
-    CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(),
-                           std::abs(rExpected.GetWidth() - rActual.GetWidth()) 
<= nTolerance);
-
-    // Height
-    sMsg = OString::Concat(sInfo) + " Height expected " + 
OString::number(rExpected.GetHeight())
-           + " actual " + OString::number(rActual.GetHeight()) + " Tolerance "
-           + OString::number(nTolerance);
-    CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(),
-                           std::abs(rExpected.GetHeight() - 
rActual.GetHeight()) <= nTolerance);
-}
-
-void AssertPointEqualWithTolerance(std::string_view sInfo, const Point 
rExpected,
-                                   const Point rActual, const sal_Int32 
nTolerance)
-{
-    // X
-    OString sMsg = OString::Concat(sInfo) + " X expected " + 
OString::number(rExpected.X())
-                   + " actual " + OString::number(rActual.X()) + " Tolerance "
-                   + OString::number(nTolerance);
-    CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(), std::abs(rExpected.X() - 
rActual.X()) <= nTolerance);
-    // Y
-    sMsg = OString::Concat(sInfo) + " Y expected " + 
OString::number(rExpected.Y()) + " actual "
-           + OString::number(rActual.Y()) + " Tolerance " + 
OString::number(nTolerance);
-    CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(), std::abs(rExpected.Y() - 
rActual.Y()) <= nTolerance);
-}
-
-CPPUNIT_NS_END
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */

Reply via email to