loolwsd/.gitignore | 1 loolwsd/test/Makefile.am | 14 ----- loolwsd/test/testlokit.cpp | 107 --------------------------------------------- 3 files changed, 2 insertions(+), 120 deletions(-)
New commits: commit c3c8235561dabd6ed47dbeef19d076b785de5fee Author: Henry Castro <[email protected]> Date: Tue Oct 11 08:26:02 2016 -0400 Revert "loolwsd: test: .uno:AutoSum" This is no longer need it, because the unit test was already added to sc/qa/unit/tiledrendering/tiledrendering.cxx This reverts commit 9b1087e000a5e1ca5ebf9e9c25c8a31705ce6795. diff --git a/loolwsd/.gitignore b/loolwsd/.gitignore index d2ff61f..d98297b 100644 --- a/loolwsd/.gitignore +++ b/loolwsd/.gitignore @@ -56,4 +56,3 @@ loolstress loolforkit-nocaps loadtest unittest -testlokit diff --git a/loolwsd/test/Makefile.am b/loolwsd/test/Makefile.am index 1cf21fe..70c073a 100644 --- a/loolwsd/test/Makefile.am +++ b/loolwsd/test/Makefile.am @@ -7,7 +7,7 @@ AUTOMAKE_OPTION = serial-tests # test: tests that need loolwsd running, and that are run via 'make check' check_PROGRAMS = test -noinst_PROGRAMS = test unittest testlokit +noinst_PROGRAMS = test unittest AM_CXXFLAGS = $(CPPUNIT_CFLAGS) @@ -46,10 +46,6 @@ unittest_CPPFLAGS = -I$(top_srcdir) -DBUILDING_TESTS unittest_SOURCES = TileQueueTests.cpp WhiteBoxTests.cpp test.cpp $(wsd_sources) unittest_LDADD = $(CPPUNIT_LIBS) -testlokit_CPPFLAGS = -DTDOC=\"$(abs_top_srcdir)/test/data\" -I$(top_srcdir) -DBUILDING_TESTS -testlokit_SOURCES = testlokit.cpp test.cpp $(wsd_sources) -testlokit_LDADD = $(CPPUNIT_LIBS) - # unit test modules: unit_fuzz_la_SOURCES = UnitFuzz.cpp unit_admin_la_SOURCES = UnitAdmin.cpp @@ -69,13 +65,7 @@ SYSTEM_STAMP = endif if HAVE_LO_PATH -check-lokit: testlokit - @echo - @echo "Running testlokit." - @echo - @JAIL_PATH="file://@JAILS_PATH@/user" LO_PATH="@LO_PATH@/program" ${top_builddir}/test/testlokit > check-lokit.log 2>&1 || { cat check-lokit.log ; exit 1 ; } - -check-local: check-lokit +check-local: ./run_unit.sh --log-file test.log --trs-file test.trs # FIXME unit-fonts.la is unstable, disabled for now. TESTS = unit-timeout.la unit-prefork.la unit-tilecache.la unit-admin.la unit-storage.la diff --git a/loolwsd/test/testlokit.cpp b/loolwsd/test/testlokit.cpp deleted file mode 100644 index 5d02c20..0000000 --- a/loolwsd/test/testlokit.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include "config.h" - -#include <mutex> -#include <cassert> -#include <memory> -#include <condition_variable> - -#define LOK_USE_UNSTABLE_API -#include <LibreOfficeKit/LibreOfficeKitInit.h> - -#include "LibreOfficeKit.hpp" - -#include <cppunit/extensions/HelperMacros.h> - -class TestLOKit : public CPPUNIT_NS::TestFixture -{ - std::shared_ptr<lok::Office> _loKit; - - CPPUNIT_TEST_SUITE(TestLOKit); - - CPPUNIT_TEST(testAutoSum); - - CPPUNIT_TEST_SUITE_END(); - - void testAutoSum(); - -public: - bool _readyCallback; - std::string _cellFormula; - std::condition_variable _cvCallback; - - TestLOKit() - { - char* userdir = getenv("JAIL_PATH"); - CPPUNIT_ASSERT_MESSAGE("JAIL_PATH env variable not set", userdir != nullptr); - - char* instdir = getenv("LO_PATH"); - CPPUNIT_ASSERT_MESSAGE("LO_PATH env variable not set", instdir != nullptr); - - _loKit = std::make_shared<lok::Office>(lok_init_2(instdir, userdir)); - if (!_loKit || !_loKit->get()) - { - CPPUNIT_FAIL("LibreOfficeKit initialization failed."); - } - } - - ~TestLOKit() - { - } - - static void ViewCallback(const int type, const char* payload, void* data) - { - if (data == nullptr) - { - CPPUNIT_FAIL("Data is nullptr"); - } - - TestLOKit* test = static_cast<TestLOKit*>(data); - - switch (type) - { - case LOK_CALLBACK_CELL_FORMULA: - { - test->_cellFormula = payload; - test->_readyCallback = true; - test->_cvCallback.notify_one(); - } - } - } - - void setUp() - { - } - - void tearDown() - { - } -}; - -void TestLOKit::testAutoSum() -{ - std::shared_ptr<lok::Document> doc = _loKit->documentLoad(TDOC"/empty.ods"); - CPPUNIT_ASSERT(doc); - - std::mutex mutex; - doc->initializeForRendering(""); - doc->registerCallback(ViewCallback, this); - doc->postUnoCommand(".uno:AutoSum"); - - std::unique_lock<std::mutex> lock(mutex); - _cvCallback.wait_for(lock, std::chrono::seconds(2), [this] { return _readyCallback; }); - doc->registerCallback(nullptr, nullptr); - CPPUNIT_ASSERT(_cellFormula.find("=SUM(") != std::string::npos); -} - -CPPUNIT_TEST_SUITE_REGISTRATION(TestLOKit); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
