[Libreoffice-commits] core.git: sc/qa

Tor Lillqvist tml at collabora.com
Mon Aug 14 13:05:59 UTC 2017


 sc/qa/unit/parallelism.cxx |   34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

New commits:
commit 1a4cb299def3e98dc4968c82b5c9ed12717061fc
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Aug 14 15:32:23 2017 +0300

    Fix testVLOOKUP to actually use formula groups
    
    Change-Id: I3e2b626731a3508d1c4cd8abbe6de1660dbef11f

diff --git a/sc/qa/unit/parallelism.cxx b/sc/qa/unit/parallelism.cxx
index f7d70f6b5e1f..5876c83e9b91 100644
--- a/sc/qa/unit/parallelism.cxx
+++ b/sc/qa/unit/parallelism.cxx
@@ -198,9 +198,11 @@ void ScParallelismTest::testVLOOKUP()
 {
     m_pDoc->InsertTab(0, "1");
 
-    for (auto i = 1; i < 1000; i++)
+    for (auto i = 1; i < 2000; i++)
     {
-        if (i%5)
+        if (i == 1042)
+            m_pDoc->SetValue(0, i, 0, 1042.42);
+        else if (i%5)
             m_pDoc->SetValue(0, i, 0, i);
         else
             m_pDoc->SetValue(0, i, 0, i+0.1);
@@ -210,29 +212,35 @@ void ScParallelismTest::testVLOOKUP()
         else
             m_pDoc->SetString(1, i, 0, "N" + OUString::number(i*10));
 
-        if (i%3)
+        if (i < 1000)
         {
             m_pDoc->SetFormula(ScAddress(2, i, 0),
                                "=VLOOKUP(" + OUString::number(i) + "; "
-                               "A$2:B$1000; 2; 0)",
+                               "A$2:B$2000; 2; 0)",
                                formula::FormulaGrammar::GRAM_NATIVE_UI);
         }
 
         else
         {
-            m_pDoc->SetFormula(ScAddress(2, i, 0),
-                               "=VLOOKUP(42.42; "
-                               "A$2:B$1000; 2; 0)",
-                               formula::FormulaGrammar::GRAM_NATIVE_UI);
+            if (i == 1042)
+                m_pDoc->SetFormula(ScAddress(2, i, 0),
+                                   "=VLOOKUP(1042.42; "
+                                   "A$2:B$2000; 2; 0)",
+                                   formula::FormulaGrammar::GRAM_NATIVE_UI);
+            else
+                m_pDoc->SetFormula(ScAddress(2, i, 0),
+                                   "=VLOOKUP(1.234; "
+                                   "A$2:B$2000; 2; 0)",
+                                   formula::FormulaGrammar::GRAM_NATIVE_UI);
         }
     }
 
     m_xDocShell->DoHardRecalc();
 
-    for (auto i = 1; i < 1000; i++)
+    for (auto i = 1; i < 2000; i++)
     {
         OString sMessage = "At row " + OString::number(i+1);
-        if (i%3)
+        if (i < 1000)
         {
             if (i%5)
             {
@@ -249,8 +257,10 @@ void ScParallelismTest::testVLOOKUP()
         }
         else
         {
-            // The 42.42 is never found
-            CPPUNIT_ASSERT_EQUAL_MESSAGE(sMessage.getStr(), OUString("#N/A"), m_pDoc->GetString(2, i, 0));
+            if (i == 1042)
+                CPPUNIT_ASSERT_EQUAL_MESSAGE(sMessage.getStr(), OUString("N" + OUString::number(i*10)), m_pDoc->GetString(2, i, 0));
+            else
+                CPPUNIT_ASSERT_EQUAL_MESSAGE(sMessage.getStr(), OUString("#N/A"), m_pDoc->GetString(2, i, 0));
         }
     }
 


More information about the Libreoffice-commits mailing list