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

Łukasz Hryniuk lukasz.hryniuk at wp.pl
Sun Sep 20 04:16:46 PDT 2015


 sc/qa/perf/scperfobj.cxx                     |   26 ++++++++++++++++++++++++++
 sc/qa/perf/testdocuments/scMathFunctions.ods |binary
 2 files changed, 26 insertions(+)

New commits:
commit 5d22a10b5a665696a7afbdcfa9eb10e278704c1d
Author: Łukasz Hryniuk <lukasz.hryniuk at wp.pl>
Date:   Fri Sep 18 20:18:20 2015 +0200

    Performance test for FTest
    
    Change-Id: I9dc6298b7843c089f58e2bf8ee663f72088a5752
    Reviewed-on: https://gerrit.libreoffice.org/18705
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/qa/perf/scperfobj.cxx b/sc/qa/perf/scperfobj.cxx
index 9c79e28..310c004 100644
--- a/sc/qa/perf/scperfobj.cxx
+++ b/sc/qa/perf/scperfobj.cxx
@@ -59,6 +59,7 @@ public:
     CPPUNIT_TEST(testSheetNamedRanges);
     CPPUNIT_TEST(testSheets);
     CPPUNIT_TEST(testSum);
+    CPPUNIT_TEST(testFTest);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -71,6 +72,7 @@ private:
     void testSheetNamedRanges();
     void testSheets();
     void testSum();
+    void testFTest();
 
 };
 
@@ -289,6 +291,30 @@ void ScPerfObj::testSum()
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Sum - number of elements equal 30" , 99.0, xCell->getValue());
 }
 
+void ScPerfObj::testFTest()
+{
+    uno::Reference< sheet::XSpreadsheetDocument > xDoc(init("scMathFunctions.ods"), UNO_QUERY_THROW);
+
+    CPPUNIT_ASSERT_MESSAGE("Problem in document loading" , xDoc.is());
+    uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
+
+    // get getSheets
+    uno::Reference< sheet::XSpreadsheets > xSheets (xDoc->getSheets(), UNO_QUERY_THROW);
+
+    uno::Any rSheet = xSheets->getByName(OUString::createFromAscii("FTestSheet"));
+
+    // query for the XSpreadsheet interface
+    uno::Reference< sheet::XSpreadsheet > xSheet (rSheet, UNO_QUERY);
+    uno::Reference< table::XCell > xCell = xSheet->getCellByPosition(0, 0);
+
+    callgrindStart();
+    xCell->setFormula(OUString::createFromAscii("=FTEST(B1:K10;L1:U10)"));
+    xCalculatable->calculate();
+    callgrindDump("sc:ftest");
+
+    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Wrong FTest result" , 0.8909, xCell->getValue(), 10e-4);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScPerfObj);
 
 }
diff --git a/sc/qa/perf/testdocuments/scMathFunctions.ods b/sc/qa/perf/testdocuments/scMathFunctions.ods
index e87c88a..b80f8f6 100644
Binary files a/sc/qa/perf/testdocuments/scMathFunctions.ods and b/sc/qa/perf/testdocuments/scMathFunctions.ods differ


More information about the Libreoffice-commits mailing list