Avoid potential negative array index access to cached text.
[LibreOffice.git] / writerfilter / qa / cppunittests / rtftok / rtftokenizer.cxx
blob8f0691872fa63c2bc036eb3d096c23b7661beb96
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <test/unoapi_test.hxx>
12 #include <com/sun/star/text/XTextDocument.hpp>
14 using namespace ::com::sun::star;
16 namespace
18 /// Tests for writerfilter/source/rtftok/rtftokenizer.cxx.
19 class Test : public UnoApiTest
21 public:
22 Test()
23 : UnoApiTest("/writerfilter/qa/cppunittests/rtftok/data/")
28 CPPUNIT_TEST_FIXTURE(Test, testInvalidHex)
30 // Given a document with a markup like "\'3?":
31 loadFromFile(u"invalid-hex.rtf");
33 // Then make sure the result matches Word, rather than just refusing to import the document:
34 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
35 CPPUNIT_ASSERT_EQUAL(OUString::fromUtf8("xřx"), xTextDocument->getText()->getString());
39 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */