From bbd1cae866630e1545b603b2b31417713d63d226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Wed, 13 Sep 2023 22:18:43 +0200 Subject: [PATCH] sc: add test for the row import default index issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I09f94977602122ac751cc64dc7c3cec1a954aea8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156901 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- .../data/xlsx/RowImportCellStyleIssue.xlsx | Bin 0 -> 8378 bytes sc/qa/unit/subsequent_filters_test4.cxx | 49 +++++++++++++----- sc/subsequent_setup.mk | 1 + 3 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 sc/qa/unit/data/xlsx/RowImportCellStyleIssue.xlsx diff --git a/sc/qa/unit/data/xlsx/RowImportCellStyleIssue.xlsx b/sc/qa/unit/data/xlsx/RowImportCellStyleIssue.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..980cdd35a0d68a245b313a0e29b36d0415270a40 GIT binary patch literal 8378 zcmeHMg;$j6+a9`+kW#vl4(XCEVJInKsG+;1yF)qzq(eqJr5iySq#LBWk@!Zx-Lt#y z?qBfRcg}gAGv}TAI`2Hsb=?V+hl76%Km;HI000U=o@)27A`Ae43=aU{0+3;K#BFVy zz&1`GwKsNPM_m>-Yb){`cv$)@04((P|6TvXI{=9vQ0!#GlDw3;6<=o#U#JvCe!lPD zi}Q(|On+6@aFX@S{Mfw^?q!8&Hl77fh2ikLqY!827w)f*Eklc%OQus|G+|0Fg2*!nqWC!@y`sE?A zVu{JSzL068Q1kYcoqtpll}r6}p_PspOYKPjoU~7~_ig{&f?(86AH~Hg7bF7bu>e)A z>&M{a8+&J@XS5DUQudIQE^L>{^T~@;X}LG_F3mB|O6rTU`kYNJ z8GCZTNmQk9T`h!<5bzX9l)12fono;!d z7ve{SrgM~a2lXFfnqg(-Ij5z@Mp{hAo}AZ*RAq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u|3yiWWsY4;Lds8vBqZ2dkJ5lQ%ZZ{IL3&i}Ov$vz&z_5*+#|ZFGEeS3X-KH0G zz3~v@P->3ZMQNgaSEWFnD({GKjU9Xuq~ReF@(Hh0a;&pC>-G7{$GYZ;R=E$sR!>Y< zxM!0wVLz8tHYM4SBR`)=-hND9(50?KhVe0%s}HKo&1FeUud}d>3VDvS+v5gLvxK-q`lY-&%ATlZ$9ys%KLyRn$IV(J z=gJxjFNWa=r?=w^wmH}ytX zZSJda(KUkNt}w=gkS)h|3gd;e@{pU!(^fXY`?a&q^AmSvZ85 zEHmKW=FGnz*YE2;Or3%9e+BsKgzR_2A8QCy6MveQ{c8B@)ZhhF)%34%?+-%&fSm{c_*)eG)%>px?9b+fPyb~8n>z!_BS6mv06>9$gnu+FNq>C% EKhr3Q4gdfE literal 0 HcmV?d00001 diff --git a/sc/qa/unit/subsequent_filters_test4.cxx b/sc/qa/unit/subsequent_filters_test4.cxx index ae5c7ff7e4da..4439b3d9ba97 100644 --- a/sc/qa/unit/subsequent_filters_test4.cxx +++ b/sc/qa/unit/subsequent_filters_test4.cxx @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include #include #include @@ -69,20 +71,20 @@ using namespace ::com::sun::star::uno; class ScFiltersTest4 : public ScModelTestBase { public: - ScFiltersTest4(); + ScFiltersTest4() + : ScModelTestBase("sc/qa/unit/data") + { + } protected: - void testImportCrash(const char* rFileName); + void testImportCrash(const char* rFileName) + { + createScDoc(rFileName); + ScDocument* pDoc = getScDoc(); + pDoc->CalcAll(); // perform hard re-calculation. + } }; -void ScFiltersTest4::testImportCrash(const char* rFileName) -{ - createScDoc(rFileName); - - ScDocument* pDoc = getScDoc(); - pDoc->CalcAll(); // perform hard re-calculation. -} - CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testPasswordNew) { //tests opening a file with new password algorithm @@ -1944,9 +1946,32 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf142905) CPPUNIT_ASSERT_EQUAL(OUString(" 3M "), pDoc->GetString(2, 0, 0)); } -ScFiltersTest4::ScFiltersTest4() - : ScModelTestBase("sc/qa/unit/data") +CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testRowImportCellStyleIssue) { + // Test checks that the correct cell style is imported for the first 6 rows and then the rest of the rows. + // Row 1 to 6 have no background color, after that light2 (background2) theme color. + + createScDoc("xlsx/RowImportCellStyleIssue.xlsx"); + ScDocument* pDoc = getScDoc(); + + // Check cell A6 - should have no background color set + { + const ScPatternAttr* pAttr = pDoc->GetPattern(0, 5, 0); // A6 + const SfxPoolItem& rItem = pAttr->GetItem(ATTR_BACKGROUND); + const SvxBrushItem& rBackground = static_cast(rItem); + CPPUNIT_ASSERT_EQUAL(false, rBackground.isUsed()); + } + + // Check cell A7 - should have light2 (background2) theme color set + { + const ScPatternAttr* pAttr = pDoc->GetPattern(0, 6, 0); // A7 + const SfxPoolItem& rItem = pAttr->GetItem(ATTR_BACKGROUND); + const SvxBrushItem& rBackground = static_cast(rItem); + CPPUNIT_ASSERT_EQUAL(true, rBackground.isUsed()); + CPPUNIT_ASSERT_EQUAL(Color(0xe7e6e6), rBackground.GetColor()); + auto const& rComplexColor = rBackground.getComplexColor(); + CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Light2, rComplexColor.getThemeColorType()); + } } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/subsequent_setup.mk b/sc/subsequent_setup.mk index 6847aca1a775..4cf9b34f984e 100644 --- a/sc/subsequent_setup.mk +++ b/sc/subsequent_setup.mk @@ -30,6 +30,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_subsequent_$(1), \ cppu \ cppuhelper \ drawinglayer \ + docmodel \ editeng \ for \ forui \