diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2015-10-12 23:25:45 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2015-10-12 23:40:15 +0200 |
commit | 1db251e1a191844eb99462a67e9acf4f4b67233f (patch) | |
tree | 905bc7acd0f0aea97368ff8c9204bbcf08181955 /sw | |
parent | 959ac511dbebeb3983da92052ced837b39b74ed9 (diff) |
tdf#77014 create a test for this bug
Change-Id: Iebe72287f62da7382f12e7645b48fa666610a8c5
Diffstat (limited to 'sw')
-rw-r--r-- | sw/CppunitTest_sw_uiwriter.mk | 6 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf77014.odt | bin | 0 -> 8161 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 50 |
3 files changed, 53 insertions, 3 deletions
diff --git a/sw/CppunitTest_sw_uiwriter.mk b/sw/CppunitTest_sw_uiwriter.mk index efe917417e93..e30197edeb51 100644 --- a/sw/CppunitTest_sw_uiwriter.mk +++ b/sw/CppunitTest_sw_uiwriter.mk @@ -22,18 +22,18 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uiwriter, \ cppu \ cppuhelper \ editeng \ - msword \ + msword \ sal \ sfx \ svl \ svt \ - svxcore \ + svxcore \ sw \ test \ unotest \ vcl \ tl \ - utl \ + utl \ $(gb_UWINAPI) \ )) diff --git a/sw/qa/extras/uiwriter/data/tdf77014.odt b/sw/qa/extras/uiwriter/data/tdf77014.odt Binary files differnew file mode 100644 index 000000000000..66d6835e8f4d --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf77014.odt diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index f77cb9bce6dc..988ebf8a6aa2 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -166,6 +166,7 @@ public: void testTdf89720(); void testTdf88986(); void testTdf87922(); + void testTdf77014(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -241,6 +242,7 @@ public: CPPUNIT_TEST(testTdf89720); CPPUNIT_TEST(testTdf88986); CPPUNIT_TEST(testTdf87922); + CPPUNIT_TEST(testTdf77014); CPPUNIT_TEST_SUITE_END(); private: @@ -2696,6 +2698,54 @@ void SwUiWriterTest::testTdf87922() CPPUNIT_ASSERT_EQUAL(COL_WHITE, aFont.GetColor().GetColor()); } +void SwUiWriterTest::testTdf77014() +{ + // The problem described in the bug tdf#77014 is that the input + // field text ("ThisIsAllOneWord") is broken up on linebreak, but + // it should be in one piece (like normal text). + + // This test checks that the input field is in one piece. + + load(DATA_DIRECTORY, "tdf77014.odt"); + + // First paragraph + CPPUNIT_ASSERT_EQUAL(OUString("POR_TXT"), parseDump("/root/page/body/txt[4]/Text[1]", "nType")); + CPPUNIT_ASSERT_EQUAL(OUString("91"), parseDump("/root/page/body/txt[4]/Text[1]", "nLength")); + + // The "Unknown" is the input field: + // which is 16 chars + 2 hidden chars (start & end input field) = 18 chars + // If this is correct then the input field is in one piece + CPPUNIT_ASSERT_EQUAL(OUString("Unknown"), parseDump("/root/page/body/txt[4]/Text[2]", "nType")); + CPPUNIT_ASSERT_EQUAL(OUString("18"), parseDump("/root/page/body/txt[4]/Text[2]", "nLength")); + + CPPUNIT_ASSERT_EQUAL(OUString("POR_TXT"), parseDump("/root/page/body/txt[4]/Text[3]", "nType")); + CPPUNIT_ASSERT_EQUAL(OUString("1"), parseDump("/root/page/body/txt[4]/Text[3]", "nLength")); + + CPPUNIT_ASSERT_EQUAL(OUString("POR_TXT"), parseDump("/root/page/body/txt[4]/Text[1]", "nType")); + CPPUNIT_ASSERT_EQUAL(OUString("91"), parseDump("/root/page/body/txt[4]/Text[1]", "nLength")); + + // Second paragraph + CPPUNIT_ASSERT_EQUAL(OUString("POR_TXT"), parseDump("/root/page/body/txt[5]/Text[1]", "nType")); + CPPUNIT_ASSERT_EQUAL(OUString("91"), parseDump("/root/page/body/txt[5]/Text[1]", "nLength")); + + // The input field here has more words ("One Two Three Four Five") + // and it should break after "Two". + // "One Two" = 7 chars + 1 start input field hidden character = 8 chars + CPPUNIT_ASSERT_EQUAL(OUString("Unknown"), parseDump("/root/page/body/txt[5]/Text[2]", "nType")); + CPPUNIT_ASSERT_EQUAL(OUString("8"), parseDump("/root/page/body/txt[5]/Text[2]", "nLength")); + + CPPUNIT_ASSERT_EQUAL(OUString("POR_HOLE"), parseDump("/root/page/body/txt[5]/Text[3]", "nType")); + CPPUNIT_ASSERT_EQUAL(OUString("1"), parseDump("/root/page/body/txt[5]/Text[3]", "nLength")); + + // In new line.. + // "Three Four Five" = 16 chars + 1 end input field hidden character = 16 chars + CPPUNIT_ASSERT_EQUAL(OUString("Unknown"), parseDump("/root/page/body/txt[5]/Text[4]", "nType")); + CPPUNIT_ASSERT_EQUAL(OUString("16"), parseDump("/root/page/body/txt[5]/Text[4]", "nLength")); + + CPPUNIT_ASSERT_EQUAL(OUString("POR_TXT"), parseDump("/root/page/body/txt[5]/Text[5]", "nType")); + CPPUNIT_ASSERT_EQUAL(OUString("1"), parseDump("/root/page/body/txt[5]/Text[5]", "nLength")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); |