[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa

Marco Cecchetti marco.cecchetti at collabora.com
Tue Mar 13 10:40:27 UTC 2018


 sc/qa/unit/data/contentCSV/dataValidity3.csv |    4 ++
 sc/qa/unit/data/ods/dataValidity.ods         |binary
 sc/qa/unit/data/xlsx/dataValidity.xlsx       |binary
 sc/qa/unit/subsequent_filters-test.cxx       |   39 +++++++++++++++++++++++++++
 4 files changed, 43 insertions(+)

New commits:
commit 3f6bbcc75d3f060bf00efd9471a46c348f81846f
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Mon Feb 26 17:50:25 2018 +0100

    calc: unit tests for data validation
    
    Change-Id: I51e1d992236de8ecc3e7dcf0085d629c5b863776
    Reviewed-on: https://gerrit.libreoffice.org/50382
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sc/qa/unit/data/contentCSV/dataValidity3.csv b/sc/qa/unit/data/contentCSV/dataValidity3.csv
new file mode 100644
index 000000000000..a8c82cecabdf
--- /dev/null
+++ b/sc/qa/unit/data/contentCSV/dataValidity3.csv
@@ -0,0 +1,4 @@
+"",,
+"",,Enter text not a numeric value.
+"",,AAAA
+"",,AAA12
diff --git a/sc/qa/unit/data/ods/dataValidity.ods b/sc/qa/unit/data/ods/dataValidity.ods
index 008cea5561fc..9daf01ce7798 100644
Binary files a/sc/qa/unit/data/ods/dataValidity.ods and b/sc/qa/unit/data/ods/dataValidity.ods differ
diff --git a/sc/qa/unit/data/xlsx/dataValidity.xlsx b/sc/qa/unit/data/xlsx/dataValidity.xlsx
new file mode 100644
index 000000000000..da4d3ab41133
Binary files /dev/null and b/sc/qa/unit/data/xlsx/dataValidity.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 90fc2de69629..3cf19c4f9189 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -146,6 +146,7 @@ public:
     void testMergedCellsODS();
     void testRepeatedColumnsODS();
     void testDataValidityODS();
+    void testDataValidityXLSX();
     void testDataTableMortgageXLS();
     void testDataTableOneVarXLSX();
     void testDataTableMultiTableXLSX();
@@ -277,6 +278,7 @@ public:
     CPPUNIT_TEST(testMergedCellsODS);
     CPPUNIT_TEST(testRepeatedColumnsODS);
     CPPUNIT_TEST(testDataValidityODS);
+    CPPUNIT_TEST(testDataValidityXLSX);
     CPPUNIT_TEST(testDataTableMortgageXLS);
     CPPUNIT_TEST(testDataTableOneVarXLSX);
     CPPUNIT_TEST(testDataTableMultiTableXLSX);
@@ -1324,6 +1326,7 @@ void ScFiltersTest::testDataValidityODS()
 
     ScAddress aValBaseAddr1( 2,6,0 ); //sheet1
     ScAddress aValBaseAddr2( 2,3,1 ); //sheet2
+    ScAddress aValBaseAddr3( 2,2,2 ); //sheet3
 
     //sheet1's expected Data Validation Entry values
     ValDataTestParams aVDTParams1(
@@ -1339,17 +1342,27 @@ void ScFiltersTest::testDataValidityODS()
         "Must be a whole number between 1 and 10.",
         SC_VALERR_STOP, 2
     );
+    //sheet3's expected Data Validation Entry values
+    ValDataTestParams aVDTParams3(
+        SC_VALID_CUSTOM, ScConditionMode::Direct, "ISTEXT(C3)", EMPTY_OUSTRING, rDoc,
+        aValBaseAddr3, "Error sheet 3",
+        "Must not be a numerical value.",
+        SC_VALERR_STOP, 3
+    );
     //check each sheet's Data Validation Entries
     checkValiditationEntries( aVDTParams1 );
     checkValiditationEntries( aVDTParams2 );
+    checkValiditationEntries( aVDTParams3 );
 
     //expected ranges to be associated with data validity
     ScRange aRange1( 2,2,0, 2,6,0 ); //sheet1
     ScRange aRange2( 2,3,1, 6,7,1 ); //sheet2
+    ScRange aRange3( 2,2,2, 2,6,2 ); //sheet3
 
     //check each sheet's cells for data validity
     checkCellValidity( aValBaseAddr1, aRange1, rDoc );
     checkCellValidity( aValBaseAddr2, aRange2, rDoc );
+    checkCellValidity( aValBaseAddr3, aRange3, rDoc );
 
     //check each sheet's content
     OUString aCSVFileName1;
@@ -1360,6 +1373,32 @@ void ScFiltersTest::testDataValidityODS()
     createCSVPath("dataValidity2.", aCSVFileName2);
     testFile(aCSVFileName2, rDoc, 1);
 
+    OUString aCSVFileName3;
+    createCSVPath("dataValidity3.", aCSVFileName3);
+    testFile(aCSVFileName3, rDoc, 2);
+
+    xDocSh->DoClose();
+}
+
+void ScFiltersTest::testDataValidityXLSX()
+{
+    ScDocShellRef xDocSh = loadDoc("dataValidity.", FORMAT_XLSX);
+    ScDocument& rDoc = xDocSh->GetDocument();
+
+    ScAddress aValBaseAddr1( 2,6,0 ); //sheet1
+    ScAddress aValBaseAddr2( 2,3,1 ); //sheet2
+    ScAddress aValBaseAddr3( 2,2,2 ); //sheet3
+
+    //expected ranges to be associated with data validity
+    ScRange aRange1( 2,2,0, 2,6,0 ); //sheet1
+    ScRange aRange2( 2,3,1, 6,7,1 ); //sheet2
+    ScRange aRange3( 2,2,2, 2,6,2 ); //sheet3
+
+    //check each sheet's cells for data validity
+    checkCellValidity( aValBaseAddr1, aRange1, rDoc );
+    checkCellValidity( aValBaseAddr2, aRange2, rDoc );
+    checkCellValidity( aValBaseAddr3, aRange3, rDoc );
+
     xDocSh->DoClose();
 }
 


More information about the Libreoffice-commits mailing list