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 f1423b1165cd7ace44153e146b6922fd2df66c57
Author: Marco Cecchetti <marco.cecche...@collabora.com>
Date:   Mon Feb 26 17:50:25 2018 +0100

    calc: unit tests for data validation
    
    Change-Id: I28ec2bd374d98ea1094649ac30ff7dd4c62370ae
    Reviewed-on: https://gerrit.libreoffice.org/55740
    Reviewed-by: Marco Cecchetti <mrcek...@gmail.com>
    Tested-by: Marco Cecchetti <mrcek...@gmail.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 b17acc3f1922..798c24c09a25 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -136,6 +136,7 @@ public:
     void testMergedCellsODS();
     void testRepeatedColumnsODS();
     void testDataValidityODS();
+    void testDataValidityXLSX();
     void testDataTableMortgageXLS();
     void testDataTableOneVarXLSX();
     void testDataTableMultiTableXLSX();
@@ -267,6 +268,7 @@ public:
     CPPUNIT_TEST(testMergedCellsODS);
     CPPUNIT_TEST(testRepeatedColumnsODS);
     CPPUNIT_TEST(testDataValidityODS);
+    CPPUNIT_TEST(testDataValidityXLSX);
     CPPUNIT_TEST(testDataTableMortgageXLS);
     CPPUNIT_TEST(testDataTableOneVarXLSX);
     CPPUNIT_TEST(testDataTableMultiTableXLSX);
@@ -1312,6 +1314,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(
@@ -1327,17 +1330,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;
@@ -1348,6 +1361,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();
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to