configure.in | 50 ++++++--- i18npool/CppunitTest_i18npool_test_ordinalsuffix.mk | 35 ++++++ i18npool/Module_i18npool.mk | 1 i18npool/qa/cppunit/test_breakiterator.cxx | 2 i18npool/qa/cppunit/test_ordinalsuffix.cxx | 102 ++++++++++++++++++++ 5 files changed, 171 insertions(+), 19 deletions(-)
New commits: commit 4573b628cc1d18bb623a1f64b35ee6e113dcf03f Author: Caolán McNamara <caol...@redhat.com> Date: Thu Sep 6 10:34:03 2012 +0100 default to enabling dbus on supported platforms Change-Id: I47eac02bf2c0ee7b973d73ac78ae08f9e93f0b42 diff --git a/configure.in b/configure.in index 1c5e630..754c79d 100644 --- a/configure.in +++ b/configure.in @@ -244,6 +244,7 @@ dnl =================================================================== test_randr=yes test_xrender=yes test_cups=yes +test_dbus=yes test_fontconfig=yes test_cairo=yes @@ -327,6 +328,7 @@ cygwin*|interix*|mingw32*) # tool-chain that is used). test_cups=no + test_dbus=no test_randr=no test_xrender=no test_freetype=no @@ -359,6 +361,7 @@ darwin*) # Mac OS X or iOS test_xrender=no test_freetype=no test_fontconfig=no + test_dbus=no if test "$host_cpu" = "arm"; then _os=iOS test_gtk=no @@ -454,6 +457,7 @@ linux-android*) build_gstreamer=no build_gstreamer_0_10=no test_cups=no + test_dbus=no test_fontconfig=no test_freetype=no test_gtk=no @@ -843,10 +847,10 @@ AC_ARG_ENABLE(opengl, ,enable_opengl=yes) AC_ARG_ENABLE(dbus, - AS_HELP_STRING([--enable-dbus], + AS_HELP_STRING([--disable-dbus], [Determines whether to enable features that depend on dbus. - e.g. Presentation mode screensaver control and auto font install under GNOME via DBUS.]), -,enable_dbus=no) + e.g. Presentation mode screensaver control, auto font install, bluetooth presentation control]) +,enable_dbus=yes) AC_ARG_ENABLE(gconf, AS_HELP_STRING([--disable-gconf], @@ -4054,6 +4058,7 @@ if test "$enable_headless" = "yes"; then test_randr=no test_xrender=no test_cups=no + test_dbus=no test_fontconfig=yes test_gtk=no build_gstreamer=no @@ -9194,15 +9199,36 @@ AC_SUBST(GNOMEVFS_CFLAGS) AC_SUBST(ENABLE_GNOMEVFS) dnl =================================================================== +dnl check for dbus support +dnl =================================================================== +ENABLE_DBUS="" +DBUS_CFLAGS="" +DBUS_LIBS="" + +if test "$enable_dbus" = "no"; then + test_dbus=no +fi + +AC_MSG_CHECKING([whether to enable DBUS support]) +if test "$test_dbus" = "yes"; then + ENABLE_DBUS="TRUE" + AC_MSG_RESULT([yes]) + PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70) +else + AC_MSG_RESULT([no]) +fi + +AC_SUBST(ENABLE_DBUS) +AC_SUBST(DBUS_CFLAGS) +AC_SUBST(DBUS_LIBS) + +dnl =================================================================== dnl Check whether the gtk 2.0 libraries are available. dnl =================================================================== GTK_CFLAGS="" GTK_LIBS="" ENABLE_SYSTRAY_GTK="" -ENABLE_DBUS="" -DBUS_CFLAGS="" -DBUS_LIBS="" if test "$test_gtk" = "yes"; then if test "$ENABLE_GTK" = "TRUE"; then @@ -9221,15 +9247,6 @@ if test "$test_gtk" = "yes"; then [ENABLE_GTK_PRINT="TRUE"], [ENABLE_GTK_PRINT=""]) - AC_MSG_CHECKING([whether to enable DBUS support]) - if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then - ENABLE_DBUS="TRUE" - AC_MSG_RESULT([yes]) - PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 ) - else - AC_MSG_RESULT([no]) - fi - AC_MSG_CHECKING([whether to enable GIO support]) if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then if test "$ENABLE_GNOMEVFS" = "TRUE"; then @@ -9246,14 +9263,11 @@ fi AC_SUBST(ENABLE_GIO) AC_SUBST(GIO_CFLAGS) AC_SUBST(GIO_LIBS) -AC_SUBST(ENABLE_DBUS) AC_SUBST(ENABLE_SYSTRAY_GTK) AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) AC_SUBST(GTHREAD_CFLAGS) AC_SUBST(GTHREAD_LIBS) -AC_SUBST(DBUS_CFLAGS) -AC_SUBST(DBUS_LIBS) AC_SUBST([ENABLE_GTK_PRINT]) AC_SUBST([GTK_PRINT_CFLAGS]) AC_SUBST([GTK_PRINT_LIBS]) commit ca00d27e33b187a9be36cad93bdaf662b5c221ea Author: Caolán McNamara <caol...@redhat.com> Date: Thu Sep 6 10:09:32 2012 +0100 Related: fdo#54486 add some regression tests for ordinal suffixes Change-Id: Iea51d777c3cc1fdc58fa7fccfe01e4e8394e79b2 diff --git a/i18npool/CppunitTest_i18npool_test_ordinalsuffix.mk b/i18npool/CppunitTest_i18npool_test_ordinalsuffix.mk new file mode 100644 index 0000000..68e5076 --- /dev/null +++ b/i18npool/CppunitTest_i18npool_test_ordinalsuffix.mk @@ -0,0 +1,35 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,i18npool_test_ordinalsuffix)) + +$(eval $(call gb_CppunitTest_use_api,i18npool_test_ordinalsuffix,\ + udkapi \ + offapi \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,i18npool_test_ordinalsuffix,\ + cppu \ + cppuhelper \ + sal \ + unotest \ + $(gb_STDLIBS) \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,i18npool_test_ordinalsuffix,\ + i18npool/qa/cppunit/test_ordinalsuffix \ +)) + +$(eval $(call gb_CppunitTest_use_ure,i18npool_test_ordinalsuffix)) + +$(eval $(call gb_CppunitTest_use_components,i18npool_test_ordinalsuffix,\ + i18npool/util/i18npool \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/i18npool/Module_i18npool.mk b/i18npool/Module_i18npool.mk index 18bd128..455d6f0 100644 --- a/i18npool/Module_i18npool.mk +++ b/i18npool/Module_i18npool.mk @@ -63,6 +63,7 @@ $(eval $(call gb_Module_add_check_targets,i18npool,\ CppunitTest_i18npool_test_breakiterator \ CppunitTest_i18npool_test_characterclassification \ CppunitTest_i18npool_test_languagetag \ + CppunitTest_i18npool_test_ordinalsuffix \ )) # vim: set noet sw=4 ts=4: diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 63f9708..2073a9d 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -861,8 +861,8 @@ void TestBreakIterator::setUp() void TestBreakIterator::tearDown() { - BootstrapFixtureBase::tearDown(); m_xBreak.clear(); + BootstrapFixtureBase::tearDown(); } CPPUNIT_TEST_SUITE_REGISTRATION(TestBreakIterator); diff --git a/i18npool/qa/cppunit/test_ordinalsuffix.cxx b/i18npool/qa/cppunit/test_ordinalsuffix.cxx new file mode 100644 index 0000000..7b08aef --- /dev/null +++ b/i18npool/qa/cppunit/test_ordinalsuffix.cxx @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <algorithm> +#include <com/sun/star/i18n/XOrdinalSuffix.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <comphelper/stlunosequence.hxx> +#include <unotest/bootstrapfixturebase.hxx> + +using namespace com::sun::star; + +class TestOrdinalSuffix : public test::BootstrapFixtureBase +{ +private: + uno::Reference<i18n::XOrdinalSuffix> m_xOrdinal; + +public: + virtual void setUp(); + virtual void tearDown(); + + void testFrench(); + void testEnglish(); + + CPPUNIT_TEST_SUITE(TestOrdinalSuffix); + CPPUNIT_TEST(testFrench); + CPPUNIT_TEST(testEnglish); + CPPUNIT_TEST_SUITE_END(); +}; + +void TestOrdinalSuffix::setUp() +{ + BootstrapFixtureBase::setUp(); + m_xOrdinal = uno::Reference< i18n::XOrdinalSuffix >(m_xSFactory->createInstance( + "com.sun.star.i18n.OrdinalSuffix"), uno::UNO_QUERY_THROW); +} + +void TestOrdinalSuffix::tearDown() +{ + m_xOrdinal.clear(); + BootstrapFixtureBase::tearDown(); +} + +void TestOrdinalSuffix::testFrench() +{ + lang::Locale aLocale("fr", "LU", ""); + uno::Sequence< OUString > aSuffixes; + OUString *pStart, *pEnd, *pFind; + + //1er + aSuffixes = m_xOrdinal->getOrdinalSuffix(1, aLocale); + pStart = comphelper::stl_begin(aSuffixes); + pEnd = comphelper::stl_end(aSuffixes); + pFind = std::find(pStart, pEnd, OUString("er")); + CPPUNIT_ASSERT(pFind != pEnd); + + //2e, 3e, etc. + aSuffixes = m_xOrdinal->getOrdinalSuffix(2, aLocale); + pStart = comphelper::stl_begin(aSuffixes); + pEnd = comphelper::stl_end(aSuffixes); + pFind = std::find(pStart, pEnd, OUString("e")); + CPPUNIT_ASSERT(pFind != pEnd); +} + +void TestOrdinalSuffix::testEnglish() +{ + lang::Locale aLocale("en", "US", ""); + uno::Sequence< OUString > aSuffixes; + OUString *pStart, *pEnd, *pFind; + + //1st + aSuffixes = m_xOrdinal->getOrdinalSuffix(1, aLocale); + pStart = comphelper::stl_begin(aSuffixes); + pEnd = comphelper::stl_end(aSuffixes); + pFind = std::find(pStart, pEnd, OUString("st")); + CPPUNIT_ASSERT(pFind != pEnd); + + //2nd + aSuffixes = m_xOrdinal->getOrdinalSuffix(2, aLocale); + pStart = comphelper::stl_begin(aSuffixes); + pEnd = comphelper::stl_end(aSuffixes); + pFind = std::find(pStart, pEnd, OUString("nd")); + CPPUNIT_ASSERT(pFind != pEnd); + + //3rd + aSuffixes = m_xOrdinal->getOrdinalSuffix(3, aLocale); + pStart = comphelper::stl_begin(aSuffixes); + pEnd = comphelper::stl_end(aSuffixes); + pFind = std::find(pStart, pEnd, OUString("rd")); + CPPUNIT_ASSERT(pFind != pEnd); +} + + +CPPUNIT_TEST_SUITE_REGISTRATION( TestOrdinalSuffix ); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits