summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-02-20 11:26:38 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-02-20 11:30:20 -0500
commit6d5270dab5c8ea8bae1ac3462aa5f6768f7d2c8f (patch)
tree24ebbb320fafb63c1d1f81d4f4cbdcccbf75ccc3
parenta18a1a454505193b922e1d5dc3215526f01f5efd (diff)
fdo#75130: Move these tests to the export test and test their export.
Change-Id: Ia6a155f12e3b50c5841211d32e0f8ff2de2bc9c8
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx89
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx69
2 files changed, 89 insertions, 69 deletions
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 26fc12a64997..e834ca628a1c 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -42,6 +42,9 @@
#include "editeng/editobj.hxx"
#include "editeng/section.hxx"
#include <editeng/crossedoutitem.hxx>
+#include <editeng/borderline.hxx>
+
+#include <com/sun/star/table/BorderLineStyle.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -79,6 +82,9 @@ public:
void testFormulaReferenceXLS();
void testSheetProtectionXLSX();
+ void testCellBordersXLS();
+ void testCellBordersXLSX();
+
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
#if !defined(MACOSX) && !defined(DRAGONFLY)
@@ -100,10 +106,14 @@ public:
CPPUNIT_TEST(testEmbeddedChartXLS);
CPPUNIT_TEST(testFormulaReferenceXLS);
CPPUNIT_TEST(testSheetProtectionXLSX);
+ CPPUNIT_TEST(testCellBordersXLS);
+ CPPUNIT_TEST(testCellBordersXLSX);
CPPUNIT_TEST_SUITE_END();
private:
+ void testExcelCellBorders( sal_uLong nFormatType );
+
uno::Reference<uno::XInterface> m_xCalcComponent;
};
@@ -991,6 +1001,85 @@ void ScExportTest::testSheetProtectionXLSX()
xDocSh->DoClose();
}
+namespace {
+
+const char* toBorderName( sal_Int16 eStyle )
+{
+ switch (eStyle)
+ {
+ case table::BorderLineStyle::SOLID: return "SOLID";
+ case table::BorderLineStyle::DOTTED: return "DOTTED";
+ case table::BorderLineStyle::DASHED: return "DASHED";
+ case table::BorderLineStyle::DOUBLE: return "DOUBLE";
+ case table::BorderLineStyle::FINE_DASHED: return "FINE_DASHED";
+ default:
+ ;
+ }
+
+ return "";
+}
+
+}
+
+void ScExportTest::testExcelCellBorders( sal_uLong nFormatType )
+{
+ ScDocShellRef xDocSh = loadDoc("cell-borders.", nFormatType);
+
+ CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is());
+ ScDocument* pDoc = xDocSh->GetDocument();
+
+ struct
+ {
+ SCROW mnRow;
+ sal_Int16 mnStyle;
+ long mnWidth;
+ } aChecks[] = {
+ { 1, table::BorderLineStyle::SOLID, 1L }, // hair
+ { 3, table::BorderLineStyle::DOTTED, 15L }, // thin
+ { 9, table::BorderLineStyle::FINE_DASHED, 15L }, // dashed
+ { 11, table::BorderLineStyle::SOLID, 15L }, // thin
+ { 19, table::BorderLineStyle::DASHED, 35L }, // medium dashed
+ { 21, table::BorderLineStyle::SOLID, 35L }, // medium
+ { 23, table::BorderLineStyle::SOLID, 50L }, // thick
+ { 25, table::BorderLineStyle::DOUBLE, -1L }, // double (don't check width)
+ };
+
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
+ {
+ const editeng::SvxBorderLine* pLine = NULL;
+ pDoc->GetBorderLines(2, aChecks[i].mnRow, 0, NULL, &pLine, NULL, NULL);
+ CPPUNIT_ASSERT(pLine);
+ CPPUNIT_ASSERT_EQUAL(toBorderName(aChecks[i].mnStyle), toBorderName(pLine->GetBorderLineStyle()));
+ if (aChecks[i].mnWidth >= 0)
+ CPPUNIT_ASSERT_EQUAL(aChecks[i].mnWidth, pLine->GetWidth());
+ }
+
+ ScDocShellRef xNewDocSh = saveAndReload(xDocSh, nFormatType);
+ xDocSh->DoClose();
+ pDoc = xNewDocSh->GetDocument();
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
+ {
+ const editeng::SvxBorderLine* pLine = NULL;
+ pDoc->GetBorderLines(2, aChecks[i].mnRow, 0, NULL, &pLine, NULL, NULL);
+ CPPUNIT_ASSERT(pLine);
+ CPPUNIT_ASSERT_EQUAL(toBorderName(aChecks[i].mnStyle), toBorderName(pLine->GetBorderLineStyle()));
+ if (aChecks[i].mnWidth >= 0)
+ CPPUNIT_ASSERT_EQUAL(aChecks[i].mnWidth, pLine->GetWidth());
+ }
+
+ xNewDocSh->DoClose();
+}
+
+void ScExportTest::testCellBordersXLS()
+{
+ testExcelCellBorders(XLS);
+}
+
+void ScExportTest::testCellBordersXLSX()
+{
+ testExcelCellBorders(XLSX);
+}
+
ScExportTest::ScExportTest()
: ScBootstrapFixture("/sc/qa/unit/data")
{
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index fe765380a0b1..f4acfa96e088 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -106,8 +106,6 @@ public:
void testMatrixODS();
void testMatrixXLS();
void testBorderODS();
- void testCellBordersXLS();
- void testCellBordersXLSX();
void testBordersOoo33();
void testBugFixesODS();
void testBugFixesXLS();
@@ -183,8 +181,6 @@ public:
CPPUNIT_TEST(testMatrixODS);
CPPUNIT_TEST(testMatrixXLS);
CPPUNIT_TEST(testBorderODS);
- CPPUNIT_TEST(testCellBordersXLS);
- CPPUNIT_TEST(testCellBordersXLSX);
CPPUNIT_TEST(testBordersOoo33);
CPPUNIT_TEST(testBugFixesODS);
CPPUNIT_TEST(testBugFixesXLS);
@@ -242,7 +238,6 @@ public:
private:
void testPassword_Impl(const OUString& rFileNameBase);
- void testExcelCellBorders( sal_uLong nFormatType );
uno::Reference<uno::XInterface> m_xCalcComponent;
};
@@ -856,70 +851,6 @@ void ScFiltersTest::testBorderODS()
xDocSh->DoClose();
}
-namespace {
-
-const char* toBorderName( sal_Int16 eStyle )
-{
- switch (eStyle)
- {
- case table::BorderLineStyle::SOLID: return "SOLID";
- case table::BorderLineStyle::DOTTED: return "DOTTED";
- case table::BorderLineStyle::DASHED: return "DASHED";
- case table::BorderLineStyle::DOUBLE: return "DOUBLE";
- case table::BorderLineStyle::FINE_DASHED: return "FINE_DASHED";
- default:
- ;
- }
-
- return "";
-}
-
-}
-
-void ScFiltersTest::testExcelCellBorders( sal_uLong nFormatType )
-{
- ScDocShellRef xDocSh = loadDoc("cell-borders.", nFormatType);
-
- CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
-
- struct
- {
- SCROW mnRow;
- sal_Int16 mnStyle;
- long mnWidth;
- } aChecks[] = {
- { 1, table::BorderLineStyle::SOLID, 1L }, // hair
- { 3, table::BorderLineStyle::DOTTED, 15L }, // thin
- { 9, table::BorderLineStyle::FINE_DASHED, 15L }, // dashed
- { 11, table::BorderLineStyle::SOLID, 15L }, // thin
- { 19, table::BorderLineStyle::DASHED, 35L }, // medium dashed
- { 21, table::BorderLineStyle::SOLID, 35L }, // medium
- { 23, table::BorderLineStyle::SOLID, 50L }, // thick
- { 25, table::BorderLineStyle::DOUBLE, -1L }, // double (don't check width)
- };
-
- for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
- {
- const editeng::SvxBorderLine* pLine = NULL;
- pDoc->GetBorderLines(2, aChecks[i].mnRow, 0, NULL, &pLine, NULL, NULL);
- CPPUNIT_ASSERT(pLine);
- CPPUNIT_ASSERT_EQUAL(toBorderName(aChecks[i].mnStyle), toBorderName(pLine->GetBorderLineStyle()));
- if (aChecks[i].mnWidth >= 0)
- CPPUNIT_ASSERT_EQUAL(aChecks[i].mnWidth, pLine->GetWidth());
- }
-}
-
-void ScFiltersTest::testCellBordersXLS()
-{
- testExcelCellBorders(XLS);
-}
-
-void ScFiltersTest::testCellBordersXLSX()
-{
- testExcelCellBorders(XLSX);
-}
-
struct Border
{
sal_Int16 column;