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 <quikee@gmail.com>
This commit is contained in:
Tomaž Vajngerl 2023-09-13 22:18:43 +02:00 committed by Tomaž Vajngerl
parent 39dc34d33b
commit bbd1cae866
3 changed files with 38 additions and 12 deletions

Binary file not shown.

View file

@ -26,6 +26,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 <dbdocfun.hxx>
#include <inputopt.hxx>
@ -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<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_PLUGIN_IMPLEMENT();

View file

@ -30,6 +30,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_subsequent_$(1), \
cppu \
cppuhelper \
drawinglayer \
docmodel \
editeng \
for \
forui \