sc/qa/unit/data/xlsx/RowImportCellStyleIssue.xlsx |binary
 sc/qa/unit/subsequent_filters_test2.cxx           |   32 ++++++++++++++++++++++
 sc/subsequent_setup.mk                            |    1 
 3 files changed, 33 insertions(+)

New commits:
commit 2586213c1790bd419442f3376af661168bbe8508
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed Sep 13 22:18:43 2023 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Sep 15 12:49:39 2023 +0200

    sc: add test for the row import default index issue
    
    Change-Id: I09f94977602122ac751cc64dc7c3cec1a954aea8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156901
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    (cherry picked from commit bbd1cae866630e1545b603b2b31417713d63d226)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156914
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sc/qa/unit/data/xlsx/RowImportCellStyleIssue.xlsx 
b/sc/qa/unit/data/xlsx/RowImportCellStyleIssue.xlsx
new file mode 100644
index 000000000000..980cdd35a0d6
Binary files /dev/null and b/sc/qa/unit/data/xlsx/RowImportCellStyleIssue.xlsx 
differ
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index f2fd4196dfa1..75a7ae4059bd 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -29,6 +29,8 @@
 #include <editeng/justifyitem.hxx>
 #include <editeng/lineitem.hxx>
 #include <editeng/colritem.hxx>
+#include <docmodel/color/ComplexColor.hxx>
+#include <docmodel/theme/ThemeColorType.hxx>
 #include <dbdata.hxx>
 #include <validat.hxx>
 #include <formulacell.hxx>
@@ -193,6 +195,7 @@ public:
     void testTdf82984_zip64XLSXImport();
     void testSingleLine();
     void testNamedTableRef();
+    void testRowImportCellStyleIssue();
 
     CPPUNIT_TEST_SUITE(ScFiltersTest2);
 
@@ -316,6 +319,7 @@ public:
     CPPUNIT_TEST(testTdf82984_zip64XLSXImport);
     CPPUNIT_TEST(testSingleLine);
     CPPUNIT_TEST(testNamedTableRef);
+    CPPUNIT_TEST(testRowImportCellStyleIssue);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -3095,6 +3099,34 @@ void ScFiltersTest2::testNamedTableRef()
     }
 }
 
+void ScFiltersTest2::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<const 
SvxBrushItem&>(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<const 
SvxBrushItem&>(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_TEST_SUITE_REGISTRATION(ScFiltersTest2);
 
 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 \

Reply via email to