From a12955be5bcfab3dda482a562eed66d7b0ffd996 Mon Sep 17 00:00:00 2001 From: slideon Date: Fri, 3 Jun 2016 22:03:03 -0400 Subject: Add test for sw_NormalizeRange The docstring for the function gave some examples, but this method was not fully tested Change-Id: I53bca734183297a9cca860c55b27570ad0e0f3e6 Reviewed-on: https://gerrit.libreoffice.org/25886 Tested-by: Jenkins Reviewed-by: jan iversen Tested-by: jan iversen --- sw/qa/core/uwriter.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'sw') diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 9d27692c3615..aa830210fab6 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1659,6 +1659,30 @@ void SwDocTest::testTableCellComparison() CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges("A2", "Z2", "A1", "Z1", false) ); CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges("A2", "Z2", "A1", "Z1", true) ); CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges("A6", "Z2", "A1", "Z1", true) ); + + OUString rCell1 = OUString("A1"); + OUString rCell2 = OUString("C5"); + + sw_NormalizeRange(rCell1, rCell2); + CPPUNIT_ASSERT_EQUAL( OUString("A1"), rCell1 ); + CPPUNIT_ASSERT_EQUAL( OUString("C5"), rCell2 ); + + sw_NormalizeRange(rCell2, rCell1); + CPPUNIT_ASSERT_EQUAL( OUString("C5"), rCell1 ); + CPPUNIT_ASSERT_EQUAL( OUString("A1"), rCell2 ); + + rCell1 = OUString("A5"); + rCell2 = OUString("C1"); + + sw_NormalizeRange(rCell1, rCell2); + CPPUNIT_ASSERT_EQUAL( OUString("A1"), rCell1 ); + CPPUNIT_ASSERT_EQUAL( OUString("C5"), rCell2 ); + + sw_NormalizeRange(rCell2, rCell1); + CPPUNIT_ASSERT_EQUAL( OUString("C5"), rCell1 ); + CPPUNIT_ASSERT_EQUAL( OUString("A1"), rCell2 ); + + CPPUNIT_ASSERT_EQUAL( OUString(), sw_GetCellName(-1, -1) ); } void SwDocTest::setUp() -- cgit