[Libreoffice-commits] .: sc/qa sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Nov 22 11:58:49 PST 2011


 sc/qa/unit/ucalc.cxx           |   12 ++++++++++++
 sc/source/core/data/table3.cxx |    2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 264e5034688a9c3105b3d29c7083ef2565afaec6
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Tue Nov 22 14:57:28 2011 -0500

    fdo#43154: Fixed incorrectly query validation.
    
    It was due to a simple mis-placement of an operator.  No idea how
    the compiler may have parsed that statement...

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index c4848c2..975737a 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -433,6 +433,18 @@ void testFuncCOUNTIF(ScDocument* pDoc)
             CPPUNIT_ASSERT_MESSAGE("Unexpected result for COUNTIF", false);
         }
     }
+
+    // Don't count empty strings when searching for a number.
+
+    // Clear A1:A2.
+    clearRange(pDoc, ScRange(0, 0, 0, 0, 1, 0));
+
+    pDoc->SetString(0, 0, 0, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=\"\"")));
+    pDoc->SetString(0, 1, 0, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=COUNTIF(A1;1)")));
+    pDoc->CalcAll();
+
+    double result = pDoc->GetValue(0, 1, 0);
+    CPPUNIT_ASSERT_MESSAGE("We shouldn't count empty string as valid number.", result == 0.0);
 }
 
 void testFuncVLOOKUP(ScDocument* pDoc)
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index f2dc399..cb37e16 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1349,7 +1349,7 @@ public:
             // Simple string matching i.e. no regexp match.
             if (isTextMatchOp(rEntry))
             {
-                if (!rItem.meType != ScQueryEntry::ByString && rItem.maString.isEmpty())
+                if (rItem.meType != ScQueryEntry::ByString && rItem.maString.isEmpty())
                 {
                     // #i18374# When used from functions (match, countif, sumif, vlookup, hlookup, lookup),
                     // the query value is assigned directly, and the string is empty. In that case,


More information about the Libreoffice-commits mailing list