[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sc/qa
Eike Rathke
erack at redhat.com
Thu Jul 25 05:51:56 PDT 2013
sc/qa/unit/data/ods/rich-text-cells.ods |binary
sc/qa/unit/subsequent_filters-test.cxx | 57 +++++++++++++++++++++++++++-----
2 files changed, 49 insertions(+), 8 deletions(-)
New commits:
commit a45098d295eeb1848dbe53f79047ffbb75f5f38e
Author: Eike Rathke <erack at redhat.com>
Date: Tue Jul 23 22:58:25 2013 +0200
unit test for <text:s> in <text:p> and <text:span>, fdo#67094
Change-Id: I033668dcdcdcc1a5710f2ddacadf9a1a5344638e
(cherry picked from commit 038d162b175b62d67a94d4418b3a15a1a382419d)
Reviewed-on: https://gerrit.libreoffice.org/5096
Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
diff --git a/sc/qa/unit/data/ods/rich-text-cells.ods b/sc/qa/unit/data/ods/rich-text-cells.ods
index da3a1ed..b039c37 100644
Binary files a/sc/qa/unit/data/ods/rich-text-cells.ods and b/sc/qa/unit/data/ods/rich-text-cells.ods differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index fcd6bd3..219b2ca 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -1688,18 +1688,20 @@ void ScFiltersTest::testRichTextContentODS()
// first line is bold.
pEditText->GetCharAttribs(0, aAttribs);
- bool bHasBold = false;
- for (it = aAttribs.begin(), itEnd = aAttribs.end(); it != itEnd; ++it)
{
- if (it->pAttr->Which() == EE_CHAR_WEIGHT)
+ bool bHasBold = false;
+ for (it = aAttribs.begin(), itEnd = aAttribs.end(); it != itEnd; ++it)
{
- const SvxWeightItem& rItem = static_cast<const SvxWeightItem&>(*it->pAttr);
- bHasBold = (rItem.GetWeight() == WEIGHT_BOLD);
- if (bHasBold)
- break;
+ if (it->pAttr->Which() == EE_CHAR_WEIGHT)
+ {
+ const SvxWeightItem& rItem = static_cast<const SvxWeightItem&>(*it->pAttr);
+ bHasBold = (rItem.GetWeight() == WEIGHT_BOLD);
+ if (bHasBold)
+ break;
+ }
}
+ CPPUNIT_ASSERT_MESSAGE("First line should be bold.", bHasBold);
}
- CPPUNIT_ASSERT_MESSAGE("First line should be bold.", bHasBold);
// second line is italic.
pEditText->GetCharAttribs(1, aAttribs);
@@ -1766,6 +1768,45 @@ void ScFiltersTest::testRichTextContentODS()
const SvxURLField* pURLData = static_cast<const SvxURLField*>(pData);
CPPUNIT_ASSERT_MESSAGE("URL is not absolute with respect to the file system.", pURLData->GetURL().startsWith("file:///"));
+ // Embedded spaces as <text:s text:c='4' />, normal text
+ aPos.IncRow();
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, pDoc->GetCellType(aPos));
+ CPPUNIT_ASSERT_EQUAL(OUString("one two"), pDoc->GetString(aPos.Col(), aPos.Row(), aPos.Tab()));
+
+ // Leading space as <text:s />.
+ aPos.IncRow();
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, pDoc->GetCellType(aPos));
+ CPPUNIT_ASSERT_EQUAL(OUString(" =3+4"), pDoc->GetString(aPos.Col(), aPos.Row(), aPos.Tab()));
+
+ // Embedded spaces with <text:s text:c='4' /> inside a <text:span>, text
+ // partly bold.
+ aPos.IncRow();
+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, pDoc->GetCellType(aPos));
+ pEditText = pDoc->GetEditText(aPos);
+ CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), pEditText->GetParagraphCount());
+ aParaText = pEditText->GetText(0);
+ CPPUNIT_ASSERT_EQUAL(OUString("one two"), aParaText);
+ pEditText->GetCharAttribs(0, aAttribs);
+ {
+ bool bHasBold = false;
+ for (it = aAttribs.begin(), itEnd = aAttribs.end(); it != itEnd; ++it)
+ {
+ if (it->pAttr->Which() == EE_CHAR_WEIGHT)
+ {
+ const SvxWeightItem& rItem = static_cast<const SvxWeightItem&>(*it->pAttr);
+ bHasBold = (rItem.GetWeight() == WEIGHT_BOLD);
+ if (bHasBold)
+ {
+ OUString aSeg = aParaText.copy(it->nStart, it->nEnd - it->nStart);
+ CPPUNIT_ASSERT_EQUAL(OUString("e t"), aSeg);
+ break;
+ }
+ }
+ }
+ CPPUNIT_ASSERT_MESSAGE("Expected a bold sequence.", bHasBold);
+ }
+
xDocSh->DoClose();
}
More information about the Libreoffice-commits
mailing list