[Libreoffice-commits] core.git: sc/qa
Markus Mohrhard
markus.mohrhard at googlemail.com
Tue Jan 26 23:49:25 PST 2016
sc/qa/unit/ucalc.hxx | 5 +++++
sc/qa/unit/ucalc_condformat.cxx | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
New commits:
commit 4dc18dd3abf78b8451334e093dc84fb289a83336
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jan 26 18:04:42 2016 +0100
add test for tdf#97308
Change-Id: If35a3d6ef7af619f9544ba15e994f663581de374
Reviewed-on: https://gerrit.libreoffice.org/21819
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index b3e5bf3..9d8562b 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -443,6 +443,9 @@ public:
void testDataBarLengthAutomaticAxis();
void testDataBarLengthMiddleAxis();
+ void testCondFormatEndsWithStr();
+ void testCondFormatEndsWithVal();
+
void testImportStream();
void testDeleteContents();
void testTransliterateText();
@@ -675,6 +678,8 @@ public:
CPPUNIT_TEST(testCondCopyPasteSingleCellToRange);
CPPUNIT_TEST(testCondCopyPasteSheetBetweenDoc);
CPPUNIT_TEST(testCondCopyPasteSheet);
+ CPPUNIT_TEST(testCondFormatEndsWithStr);
+ CPPUNIT_TEST(testCondFormatEndsWithVal);
CPPUNIT_TEST(testIconSet);
CPPUNIT_TEST(testDataBarLengthAutomaticAxis);
CPPUNIT_TEST(testDataBarLengthMiddleAxis);
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index d287fe0..b51b680 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -19,6 +19,7 @@
#include "attrib.hxx"
#include "fillinfo.hxx"
+#include <svl/sharedstringpool.hxx>
#include <o3tl/make_unique.hxx>
void Test::testCopyPasteSkipEmptyConditionalFormatting()
@@ -626,5 +627,42 @@ void Test::testDataBarLengthMiddleAxis()
m_pDoc->DeleteTab(0);
}
+void Test::testCondFormatEndsWithStr()
+{
+ m_pDoc->InsertTab(0, "Test");
+
+ ScConditionEntry aEntry(SC_COND_ENDS_WITH, "\"TestString\"", "", m_pDoc, ScAddress(),
+ "", "", formula::FormulaGrammar::GRAM_DEFAULT, formula::FormulaGrammar::GRAM_DEFAULT);
+
+ svl::SharedStringPool& rStringPool = m_pDoc->GetSharedStringPool();
+ svl::SharedString aStr = rStringPool.intern("SimpleTestString");
+ ScRefCellValue aVal(&aStr);
+ ScAddress aPos(0, 0, 0);
+
+ bool bValid = aEntry.IsCellValid(aVal, aPos);
+ CPPUNIT_ASSERT(bValid);
+
+ m_pDoc->DeleteTab(0);
+}
+
+void Test::testCondFormatEndsWithVal()
+{
+ m_pDoc->InsertTab(0, "Test");
+
+ ScConditionEntry aEntry(SC_COND_ENDS_WITH, "2", "", m_pDoc, ScAddress(),
+ "", "", formula::FormulaGrammar::GRAM_DEFAULT, formula::FormulaGrammar::GRAM_DEFAULT);
+
+ for (sal_Int32 i = 0; i < 15; ++i)
+ {
+ ScRefCellValue aVal(i);
+ ScAddress aPos(0, 0, 0);
+
+ bool bValid = aEntry.IsCellValid(aVal, aPos);
+ bool bShouldBeValid = (i % 10) == 2;
+ CPPUNIT_ASSERT_EQUAL(bShouldBeValid, bValid);
+ }
+
+ m_pDoc->DeleteTab(0);
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list