Files
libreoffice/tools/qa/cppunit/test_rectangle.cxx
Stephan Bergmann d36f7c5bd2 Revert "long->sal_Int32 in tools/gen.hxx"
This reverts commit 8bc951daf7.

As discussed at
<https://lists.freedesktop.org/archives/libreoffice/2018-April/079955.html>
"long->sal_Int32 in tools/gen.hxx", that commit caused lots of problems with
signed integer overflow, and the original plan was to redo it to consistently
use sal_Int64 instead of sal_Int32.  <https://gerrit.libreoffice.org/#/c/52471/>
"sal_Int32->sal_Int64 in tools/gen.hxx" tried that.  However, it failed
miserably on Windows, causing odd failures like not writing out Pictures/*.svm
streams out into .odp during CppunitTest_sd_export_ooxml2.  So the next best
approach is to just revert the original commit, at least for now.

Includes revert of follow-up 8c50aff217 "Fix
Library_vclplug_qt5".

Change-Id: Ia8bf34272d1ed38aac00e5d07a9d13fb03f439ae
Reviewed-on: https://gerrit.libreoffice.org/52532
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-07 14:13:18 +02:00

66 lines
1.7 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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 <sal/types.h>
#include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
#include <tools/gen.hxx>
namespace
{
class Test: public CppUnit::TestFixture
{
public:
void test_rectangle();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(test_rectangle);
CPPUNIT_TEST_SUITE_END();
};
void Test::test_rectangle()
{
{
tools::Rectangle aRect(1,1,1,1);
CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetWidth());
CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetHeight());
CPPUNIT_ASSERT_EQUAL(long(0), aRect.getWidth());
CPPUNIT_ASSERT_EQUAL(long(0), aRect.getHeight());
}
{
tools::Rectangle aRect(Point(), Size(1,1));
CPPUNIT_ASSERT_EQUAL(long(0), aRect.Left());
CPPUNIT_ASSERT_EQUAL(long(0), aRect.Top());
CPPUNIT_ASSERT_EQUAL(long(0), aRect.Right());
CPPUNIT_ASSERT_EQUAL(long(0), aRect.Bottom());
CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetWidth());
CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetHeight());
aRect.setX(12);
CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetHeight());
aRect.setY(12);
CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetWidth());
}
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */