[Libreoffice-commits] .: 6 commits - svtools/inc svtools/source tools/CppunitTest_tools_test.mk tools/inc tools/Module_tools.mk tools/qa vcl/Package_kde4moc.mk
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Jul 25 02:12:52 PDT 2011
svtools/inc/svtools/asynclink.hxx | 1
svtools/source/control/asynclink.cxx | 6 -
tools/CppunitTest_tools_test.mk | 55 ++++++++++
tools/Module_tools.mk | 4
tools/inc/tools/stream.hxx | 14 ++
tools/qa/cppunit/test_pathutils.cxx | 76 ++++++++++++++
tools/qa/cppunit/test_reversemap.cxx | 171 +++++++++++++++++++++++++++++++++
tools/qa/cppunit/test_streamstate.cxx | 114 ++++++++++++++++++++++
tools/qa/test_pathutils.cxx | 82 ----------------
tools/qa/test_reversemap.cxx | 173 ----------------------------------
tools/qa/version.map | 34 ------
vcl/Package_kde4moc.mk | 2
12 files changed, 435 insertions(+), 297 deletions(-)
New commits:
commit a178bf192db350ca37a49e72412f3ff3e921c1dc
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jul 25 10:07:53 2011 +0100
customtargets have grown another argument
diff --git a/vcl/Package_kde4moc.mk b/vcl/Package_kde4moc.mk
index 56d2f06..fc01a9a 100644
--- a/vcl/Package_kde4moc.mk
+++ b/vcl/Package_kde4moc.mk
@@ -24,6 +24,6 @@
# instead of those above.
$(eval $(call gb_Package_Package,vcl_kde4moc,$(WORKDIR)/CustomTarget/vcl/unx/kde4))
-$(eval $(call gb_Package_add_customtarget,vcl_kde4moc,vcl/unx/kde4))
+$(eval $(call gb_Package_add_customtarget,vcl_kde4moc,vcl/unx/kde4,SRCDIR))
# vim: set noet sw=4:
commit 8d9e5b573dd492866df0ea2d841c591178734e7f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jul 24 22:54:09 2011 +0100
callcatcher: remove unused ForcePendingCall
diff --git a/svtools/inc/svtools/asynclink.hxx b/svtools/inc/svtools/asynclink.hxx
index b51fd46..335a6c8 100644
--- a/svtools/inc/svtools/asynclink.hxx
+++ b/svtools/inc/svtools/asynclink.hxx
@@ -63,7 +63,6 @@ public:
void operator=( const Link& rLink ) { _aLink = rLink; }
void Call( void* pObj, sal_Bool bAllowDoubles = sal_False,
sal_Bool bUseTimer = sal_False );
- void ForcePendingCall( );
void ClearPendingCall( );
sal_Bool IsSet() const { return _aLink.IsSet(); }
Link GetLink() const { return _aLink; }
diff --git a/svtools/source/control/asynclink.cxx b/svtools/source/control/asynclink.cxx
index 5edb27e..661cfc7 100644
--- a/svtools/source/control/asynclink.cxx
+++ b/svtools/source/control/asynclink.cxx
@@ -106,12 +106,6 @@ IMPL_STATIC_LINK( AsynchronLink, HandleCall, void*, EMPTYARG )
return 0;
}
-void AsynchronLink::ForcePendingCall()
-{
- ClearPendingCall();
- Call_Impl( _pArg );
-}
-
void AsynchronLink::ClearPendingCall()
{
if( _pMutex ) _pMutex->acquire();
commit aaf980b25fda59cad2c648eecbd1c6e8ce4e500c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jul 24 22:42:49 2011 +0100
add a good(), eof(), bad() and a test case to demonstrate
diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk
index 52d0b70..2d1e02e 100755
--- a/tools/CppunitTest_tools_test.mk
+++ b/tools/CppunitTest_tools_test.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,tools_test))
$(eval $(call gb_CppunitTest_add_exception_objects,tools_test, \
tools/qa/cppunit/test_reversemap \
tools/qa/cppunit/test_pathutils \
+ tools/qa/cppunit/test_streamstate \
))
$(eval $(call gb_CppunitTest_add_api,tools_test, \
diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx
index cc6302d..fcc4a95 100644
--- a/tools/inc/tools/stream.hxx
+++ b/tools/inc/tools/stream.hxx
@@ -525,6 +525,20 @@ public:
void SetVersion( long n ) { nVersion = n; }
friend SvStream& operator<<( SvStream& rStr, SvStrPtr f ); // fuer Manips
+
+ //end of input seen
+ bool eof() const { return bIsEof; }
+
+ // stream is broken
+ bool bad() const { return GetError() != 0; }
+
+ //next operation might succeed. If the state is good() the previous i/o
+ //operation succeeded. If the state is good(), the next input operation
+ //might succeed; otherwise, it will fail. Applying an input operation to a
+ //stream that is not in the good() state is a null operation as far as the
+ //variable being read into is concerned. If we try to read into a variable
+ //v and the operation fails, the value of v should be unchanged,
+ bool good() const { return !(eof() || bad()); }
};
inline SvStream& operator<<( SvStream& rStr, SvStrPtr f )
diff --git a/tools/qa/cppunit/test_streamstate.cxx b/tools/qa/cppunit/test_streamstate.cxx
new file mode 100644
index 0000000..1040dc6
--- /dev/null
+++ b/tools/qa/cppunit/test_streamstate.cxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Caolán McNamara <caolanm at redhat.com> (Red Hat, Inc.)
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Caolán McNamara <caolanm at redhat.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "precompiled_tools.hxx"
+#include <sal/cppunit.h>
+
+#include <tools/stream.hxx>
+#include <sstream>
+
+//Tests for eofbit/badbit/goodbit/failbit
+
+namespace
+{
+
+ class Test: public CppUnit::TestFixture
+ {
+ public:
+ void test_stdstream();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(test_stdstream);
+ CPPUNIT_TEST_SUITE_END();
+ };
+
+ void Test::test_stdstream()
+ {
+ char foo[] = "foo";
+ std::istringstream iss(foo, std::istringstream::in);
+ SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ);
+
+ char std_a(78);
+ iss >> std_a;
+ CPPUNIT_ASSERT(std_a == 'f');
+
+ char tools_a(78);
+ aMemStream >> tools_a;
+ CPPUNIT_ASSERT(std_a == 'f');
+
+ iss.seekg(0, std::ios_base::end);
+ //seeking to end doesn't set eof, reading past eof does
+ CPPUNIT_ASSERT(!iss.eof());
+ CPPUNIT_ASSERT(iss.good());
+
+ aMemStream.Seek(STREAM_SEEK_TO_END);
+ //seeking to end doesn't set eof, reading past eof does
+ CPPUNIT_ASSERT(!aMemStream.IsEof());
+ CPPUNIT_ASSERT(aMemStream.good());
+
+ std_a = 78;
+ iss >> std_a;
+ //so, now eof is set
+ CPPUNIT_ASSERT(iss.eof());
+ //a failed read doesn't change the data, it remains unchanged
+ CPPUNIT_ASSERT(std_a == 78);
+ //nothing wrong with the stream, so not bad
+ CPPUNIT_ASSERT(!iss.bad());
+ //yet, the read didn't succeed
+ CPPUNIT_ASSERT(!iss.good());
+ CPPUNIT_ASSERT(iss.rdstate() == (std::ios::failbit|std::ios::eofbit));
+
+ tools_a = 78;
+ aMemStream >> tools_a;
+ //so, now eof is set
+ CPPUNIT_ASSERT(aMemStream.IsEof());
+ //a failed read doesn't change the data, it remains unchanged
+ CPPUNIT_ASSERT(tools_a == 78);
+ //nothing wrong with the stream, so not bad
+ CPPUNIT_ASSERT(!aMemStream.GetError());
+ //yet, the read didn't succeed
+ CPPUNIT_ASSERT(!aMemStream.good());
+
+ iss.clear();
+ iss.seekg(0);
+ CPPUNIT_ASSERT(iss.good());
+ iss >> std_a;
+ CPPUNIT_ASSERT(std_a == 'f');
+
+ aMemStream.Seek(0);
+ CPPUNIT_ASSERT(aMemStream.good());
+ aMemStream >> tools_a;
+ CPPUNIT_ASSERT(tools_a == 'f');
+
+ //failbit is rather subtle wrt e.g seeks
+ }
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b1b0cd3368e33248711ae739f9b68681de910d17
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jul 24 21:18:14 2011 +0100
add the legacy windows-only path utils test
diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk
index ce4a7b4..52d0b70 100755
--- a/tools/CppunitTest_tools_test.mk
+++ b/tools/CppunitTest_tools_test.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,tools_test))
$(eval $(call gb_CppunitTest_add_exception_objects,tools_test, \
tools/qa/cppunit/test_reversemap \
+ tools/qa/cppunit/test_pathutils \
))
$(eval $(call gb_CppunitTest_add_api,tools_test, \
diff --git a/tools/qa/cppunit/test_pathutils.cxx b/tools/qa/cppunit/test_pathutils.cxx
new file mode 100644
index 0000000..2e94f41
--- /dev/null
+++ b/tools/qa/cppunit/test_pathutils.cxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_tools.hxx"
+#include <sal/cppunit.h>
+
+#include <cwchar>
+
+#include "tools/pathutils.hxx"
+
+namespace {
+
+void buildPath(
+ wchar_t const * front, wchar_t const * back, wchar_t const * path)
+{
+#if defined WNT
+ wchar_t p[MAX_PATH];
+ wchar_t * e = tools::buildPath(
+ p, front, front + std::wcslen(front), back, std::wcslen(back));
+ CPPUNIT_ASSERT_EQUAL(p + std::wcslen(path), e);
+ CPPUNIT_ASSERT_EQUAL(0, std::wcscmp(path, p));
+#else
+ (void) front;
+ (void) back;
+ (void) path;
+#endif
+}
+
+class Test: public CppUnit::TestFixture {
+public:
+ void testBuildPath();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testBuildPath);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void Test::testBuildPath() {
+ buildPath(L"a:\\b\\", L"..", L"a:\\");
+ buildPath(L"a:\\b\\", L"..\\", L"a:\\");
+ buildPath(L"a:\\b\\c\\", L"..\\..\\..\\d", L"a:\\..\\d");
+ buildPath(L"\\\\a\\b\\", L"..\\..\\..\\c", L"\\\\..\\c");
+ buildPath(L"\\", L"..\\a", L"\\..\\a");
+ buildPath(L"", L"..\\a", L"..\\a");
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/qa/test_pathutils.cxx b/tools/qa/test_pathutils.cxx
deleted file mode 100644
index 70bd82e..0000000
--- a/tools/qa/test_pathutils.cxx
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_tools.hxx"
-#include "sal/config.h"
-
-#include <cwchar>
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#include "tools/pathutils.hxx"
-
-namespace {
-
-void buildPath(
- wchar_t const * front, wchar_t const * back, wchar_t const * path)
-{
-#if defined WNT
- wchar_t p[MAX_PATH];
- wchar_t * e = tools::buildPath(
- p, front, front + std::wcslen(front), back, std::wcslen(back));
- CPPUNIT_ASSERT_EQUAL(p + std::wcslen(path), e);
- CPPUNIT_ASSERT_EQUAL(0, std::wcscmp(path, p));
-#else
- (void) front;
- (void) back;
- (void) path;
-#endif
-}
-
-class Test: public CppUnit::TestFixture {
-public:
- void testBuildPath();
-
- CPPUNIT_TEST_SUITE(Test);
- CPPUNIT_TEST(testBuildPath);
- CPPUNIT_TEST_SUITE_END();
-};
-
-void Test::testBuildPath() {
- buildPath(L"a:\\b\\", L"..", L"a:\\");
- buildPath(L"a:\\b\\", L"..\\", L"a:\\");
- buildPath(L"a:\\b\\c\\", L"..\\..\\..\\d", L"a:\\..\\d");
- buildPath(L"\\\\a\\b\\", L"..\\..\\..\\c", L"\\\\..\\c");
- buildPath(L"\\", L"..\\a", L"\\..\\a");
- buildPath(L"", L"..\\a", L"..\\a");
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(Test);
-
-}
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b978ab4781e1e99cb6a6aa5ea251ab76fdbcbedb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jul 24 21:16:36 2011 +0100
add .mk
diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk
new file mode 100755
index 0000000..ce4a7b4
--- /dev/null
+++ b/tools/CppunitTest_tools_test.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Caolán McNamara, Red Hat, Inc. <caolanm at redhat.com>
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,tools_test))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,tools_test, \
+ tools/qa/cppunit/test_reversemap \
+))
+
+$(eval $(call gb_CppunitTest_add_api,tools_test, \
+ udkapi \
+ offapi \
+))
+
+$(eval $(call gb_CppunitTest_add_linked_libs,tools_test, \
+ sal \
+ tl \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,tools_test,\
+ $$(INCLUDE) \
+ -I$(realpath $(SRCDIR)/tools/inc) \
+ -I$(realpath $(SRCDIR)/tools/inc/pch) \
+))
+
+# vim: set noet sw=4 ts=4:
commit c0b03daf3b78850e1705b97aaa576199567e502d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jul 24 21:16:15 2011 +0100
recover my cppunit test for tools again
diff --git a/tools/Module_tools.mk b/tools/Module_tools.mk
index 064f6d7..aa84e1c 100644
--- a/tools/Module_tools.mk
+++ b/tools/Module_tools.mk
@@ -36,6 +36,10 @@ $(eval $(call gb_Module_add_targets,tools,\
StaticLibrary_toolshelpers \
))
+$(eval $(call gb_Module_add_check_targets,tools,\
+ CppunitTest_tools_test \
+))
+
ifneq ($(CROSS_COMPILING),YES)
$(eval $(call gb_Module_add_targets,tools,\
Executable_bestreversemap \
diff --git a/tools/qa/cppunit/test_reversemap.cxx b/tools/qa/cppunit/test_reversemap.cxx
new file mode 100644
index 0000000..a6e1314
--- /dev/null
+++ b/tools/qa/cppunit/test_reversemap.cxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Caolán McNamara <caolanm at redhat.com> (Red Hat, Inc.)
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Caolán McNamara <caolanm at redhat.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "precompiled_tools.hxx"
+#include <sal/cppunit.h>
+
+#include <rtl/ustring.hxx>
+#include <vector>
+
+#include "tools/tenccvt.hxx"
+
+//Tests for getBestMSEncodingByChar
+
+namespace
+{
+
+ class Test: public CppUnit::TestFixture
+ {
+ public:
+ void testEncoding(rtl_TextEncoding eEncoding);
+
+ void test1258();
+ void test1257();
+ void test1256();
+ void test1255();
+ void test1254();
+ void test1253();
+ void test1252();
+ void test1251();
+ void test1250();
+ void test874();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(test1258);
+ CPPUNIT_TEST(test1257);
+ CPPUNIT_TEST(test1256);
+ CPPUNIT_TEST(test1255);
+ CPPUNIT_TEST(test1254);
+ CPPUNIT_TEST(test1253);
+ CPPUNIT_TEST(test1252);
+ CPPUNIT_TEST(test1251);
+ CPPUNIT_TEST(test1250);
+ CPPUNIT_TEST(test874);
+ CPPUNIT_TEST_SUITE_END();
+ };
+
+ void Test::testEncoding(rtl_TextEncoding eEncoding)
+ {
+ //Taking the single byte legacy encodings, fill in all possible values
+ std::vector<sal_Char> aAllChars(255);
+ for (int i = 1; i <= 255; ++i)
+ aAllChars[i-1] = static_cast<sal_Char>(i);
+
+ //Some slots are unused, so don't map to private, just set them to 'X'
+ sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS ^ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE;
+ rtl::OUString sOrigText(&aAllChars[0], aAllChars.size(), eEncoding, convertFlags);
+ sOrigText = sOrigText.replace( 0xfffd, 'X' );
+
+ //Should clearly be equal
+ sal_Int32 nLength = aAllChars.size();
+ CPPUNIT_ASSERT_EQUAL(sOrigText.getLength(), nLength);
+
+ rtl::OUString sFinalText;
+
+ //Split up in chunks of the same encoding returned by
+ //getBestMSEncodingByChar, convert to it, and back
+ rtl_TextEncoding ePrevEncoding = RTL_TEXTENCODING_DONTKNOW;
+ const sal_Unicode *pStr = sOrigText.getStr();
+ sal_Int32 nChunkStart=0;
+ for (int i = 0; i < 255; ++i)
+ {
+ rtl_TextEncoding eCurrEncoding = getBestMSEncodingByChar(pStr[i]);
+ if (eCurrEncoding != ePrevEncoding)
+ {
+ rtl::OString aChunk(pStr+nChunkStart, i-nChunkStart, ePrevEncoding);
+ sFinalText += rtl::OStringToOUString(aChunk, ePrevEncoding);
+ nChunkStart = i;
+ }
+ ePrevEncoding = eCurrEncoding;
+ }
+ if (nChunkStart < 255)
+ {
+ rtl::OString aChunk(pStr+nChunkStart, 255-nChunkStart, ePrevEncoding);
+ sFinalText += rtl::OStringToOUString(aChunk, ePrevEncoding);
+ }
+
+ //Final text should be the same as original
+ CPPUNIT_ASSERT_EQUAL(sOrigText, sFinalText);
+ }
+
+ void Test::test1252()
+ {
+ testEncoding(RTL_TEXTENCODING_MS_1252);
+ }
+
+ void Test::test874()
+ {
+ testEncoding(RTL_TEXTENCODING_MS_874);
+ }
+
+ void Test::test1258()
+ {
+ testEncoding(RTL_TEXTENCODING_MS_1258);
+ }
+
+ void Test::test1257()
+ {
+ testEncoding(RTL_TEXTENCODING_MS_1257);
+ }
+
+ void Test::test1256()
+ {
+ testEncoding(RTL_TEXTENCODING_MS_1256);
+ }
+
+ void Test::test1255()
+ {
+ testEncoding(RTL_TEXTENCODING_MS_1255);
+ }
+
+ void Test::test1254()
+ {
+ testEncoding(RTL_TEXTENCODING_MS_1254);
+ }
+
+ void Test::test1253()
+ {
+ testEncoding(RTL_TEXTENCODING_MS_1253);
+ }
+
+ void Test::test1251()
+ {
+ testEncoding(RTL_TEXTENCODING_MS_1251);
+ }
+
+ void Test::test1250()
+ {
+ testEncoding(RTL_TEXTENCODING_MS_1250);
+ }
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/qa/test_reversemap.cxx b/tools/qa/test_reversemap.cxx
deleted file mode 100644
index e1ea869..0000000
--- a/tools/qa/test_reversemap.cxx
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Initial Developer of the Original Code is
- * Caolán McNamara <caolanm at redhat.com> (Red Hat, Inc.)
- * Portions created by the Initial Developer are Copyright (C) 2010 the
- * Initial Developer. All Rights Reserved.
- *
- * Contributor(s): Caolán McNamara <caolanm at redhat.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
- */
-
-#include "precompiled_tools.hxx"
-#include "sal/config.h"
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#include <rtl/ustring.hxx>
-#include <vector>
-
-#include "tools/tenccvt.hxx"
-
-//Tests for getBestMSEncodingByChar
-
-namespace
-{
-
- class Test: public CppUnit::TestFixture
- {
- public:
- void testEncoding(rtl_TextEncoding eEncoding);
-
- void test1258();
- void test1257();
- void test1256();
- void test1255();
- void test1254();
- void test1253();
- void test1252();
- void test1251();
- void test1250();
- void test874();
-
- CPPUNIT_TEST_SUITE(Test);
- CPPUNIT_TEST(test1258);
- CPPUNIT_TEST(test1257);
- CPPUNIT_TEST(test1256);
- CPPUNIT_TEST(test1255);
- CPPUNIT_TEST(test1254);
- CPPUNIT_TEST(test1253);
- CPPUNIT_TEST(test1252);
- CPPUNIT_TEST(test1251);
- CPPUNIT_TEST(test1250);
- CPPUNIT_TEST(test874);
- CPPUNIT_TEST_SUITE_END();
- };
-
- void Test::testEncoding(rtl_TextEncoding eEncoding)
- {
- //Taking the single byte legacy encodings, fill in all possible values
- std::vector<sal_Char> aAllChars(255);
- for (int i = 1; i <= 255; ++i)
- aAllChars[i-1] = static_cast<sal_Char>(i);
-
- //Some slots are unused, so don't map to private, just set them to 'X'
- sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS ^ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE;
- rtl::OUString sOrigText(&aAllChars[0], aAllChars.size(), eEncoding, convertFlags);
- sOrigText = sOrigText.replace( 0xfffd, 'X' );
-
- //Should clearly be equal
- sal_Int32 nLength = aAllChars.size();
- CPPUNIT_ASSERT_EQUAL(sOrigText.getLength(), nLength);
-
- rtl::OUString sFinalText;
-
- //Split up in chunks of the same encoding returned by
- //getBestMSEncodingByChar, convert to it, and back
- rtl_TextEncoding ePrevEncoding = RTL_TEXTENCODING_DONTKNOW;
- const sal_Unicode *pStr = sOrigText.getStr();
- sal_Int32 nChunkStart=0;
- for (int i = 0; i < 255; ++i)
- {
- rtl_TextEncoding eCurrEncoding = getBestMSEncodingByChar(pStr[i]);
- if (eCurrEncoding != ePrevEncoding)
- {
- rtl::OString aChunk(pStr+nChunkStart, i-nChunkStart, ePrevEncoding);
- sFinalText += rtl::OStringToOUString(aChunk, ePrevEncoding);
- nChunkStart = i;
- }
- ePrevEncoding = eCurrEncoding;
- }
- if (nChunkStart < 255)
- {
- rtl::OString aChunk(pStr+nChunkStart, 255-nChunkStart, ePrevEncoding);
- sFinalText += rtl::OStringToOUString(aChunk, ePrevEncoding);
- }
-
- //Final text should be the same as original
- CPPUNIT_ASSERT_EQUAL(sOrigText, sFinalText);
- }
-
- void Test::test1252()
- {
- testEncoding(RTL_TEXTENCODING_MS_1252);
- }
-
- void Test::test874()
- {
- testEncoding(RTL_TEXTENCODING_MS_874);
- }
-
- void Test::test1258()
- {
- testEncoding(RTL_TEXTENCODING_MS_1258);
- }
-
- void Test::test1257()
- {
- testEncoding(RTL_TEXTENCODING_MS_1257);
- }
-
- void Test::test1256()
- {
- testEncoding(RTL_TEXTENCODING_MS_1256);
- }
-
- void Test::test1255()
- {
- testEncoding(RTL_TEXTENCODING_MS_1255);
- }
-
- void Test::test1254()
- {
- testEncoding(RTL_TEXTENCODING_MS_1254);
- }
-
- void Test::test1253()
- {
- testEncoding(RTL_TEXTENCODING_MS_1253);
- }
-
- void Test::test1251()
- {
- testEncoding(RTL_TEXTENCODING_MS_1251);
- }
-
- void Test::test1250()
- {
- testEncoding(RTL_TEXTENCODING_MS_1250);
- }
-
- CPPUNIT_TEST_SUITE_REGISTRATION(Test);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/qa/version.map b/tools/qa/version.map
deleted file mode 100644
index 0dbbcc5..0000000
--- a/tools/qa/version.map
+++ /dev/null
@@ -1,34 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-UDK_3_0_0 {
- global:
- cppunitTestPlugIn;
-
- local:
- *;
-};
More information about the Libreoffice-commits
mailing list