summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorParis Oplopoios <paris.oplopoios@collabora.com>2023-10-26 14:28:06 +0300
committerParis Oplopoios <parisoplop@gmail.com>2023-10-29 22:18:41 +0100
commite123c772db8a12a37dfa14370b9db7c220f33ef1 (patch)
treed59e0b1a358b3a4d476deaf438ae4af8ee9771f8 /sc
parentac0a4b7c22b65325b3502cde3e05e106136c4f5b (diff)
sc: Test numeric conditional format text rule exports correctly
Change-Id: Ib57ea44912b4cb0be7cbdb127dd7ea6f08ec8392 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158498 Tested-by: Jenkins Reviewed-by: Paris Oplopoios <parisoplop@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/subsequent_export_test.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx
index 5f5132c299c2..035709a036ac 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -2153,6 +2153,37 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testSheetProtectionXLSB)
CPPUNIT_ASSERT(!pTabProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS));
}
+CPPUNIT_TEST_FIXTURE(ScExportTest, testConditionalFormatNumberInTextRule)
+{
+ createScDoc();
+
+ ScDocument* pDocument = getScDoc();
+ ScAddress aAddress(0, 0, 0);
+
+ auto pFormat = std::make_unique<ScConditionalFormat>(0, pDocument);
+ ScRange aCondFormatRange(aAddress);
+ ScRangeList aRangeList(aCondFormatRange);
+ pFormat->SetRange(aRangeList);
+ ScCondFormatEntry* pEntry
+ = new ScCondFormatEntry(ScConditionMode::BeginsWith, "15", "", *pDocument, aAddress, "");
+ pFormat->AddEntry(pEntry);
+ pDocument->AddCondFormat(std::move(pFormat), 0);
+
+ saveAndReload("Calc Office Open XML");
+ pDocument = getScDoc();
+
+ ScConditionalFormat* pCondFormat = pDocument->GetCondFormat(0, 0, 0);
+ CPPUNIT_ASSERT(pCondFormat);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormat->size());
+ const ScFormatEntry* pCondFormatEntry = pCondFormat->GetEntry(0);
+ CPPUNIT_ASSERT(pCondFormatEntry);
+ CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::Condition, pCondFormatEntry->GetType());
+ const ScConditionEntry* pConditionEntry
+ = static_cast<const ScConditionEntry*>(pCondFormatEntry);
+ CPPUNIT_ASSERT_EQUAL(ScConditionMode::BeginsWith, pConditionEntry->GetOperation());
+ CPPUNIT_ASSERT_EQUAL(OUString("\"15\""), pConditionEntry->GetExpression(aAddress, 0));
+}
+
namespace
{
const char* toBorderName(SvxBorderLineStyle eStyle)