1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
11 #include <cppunit/TestAssert.h>
12 #include <cppunit/TestFixture.h>
13 #include <cppunit/extensions/HelperMacros.h>
17 class ToxMiscTest
: public CppUnit::TestFixture
{
20 CPPUNIT_TEST_SUITE(ToxMiscTest
);
21 CPPUNIT_TEST(testTdf73162
);
22 CPPUNIT_TEST_SUITE_END();
25 void ToxMiscTest::testTdf73162()
28 OUString tokenString
= "<LS Index Link,65535,><E# ,65535,0,10><X ,65535,\001.\001><ET ,65535,><T ,65535,0,5,.,1><# ,65535,><LE ,65535,>";
30 //create Tokens with the help of input string
31 SwFormTokensHelper
tokensHelper(tokenString
);
32 SwFormTokens formTokens
= tokensHelper
.GetTokens();
34 //check the size of token vector / count of tokens
35 CPPUNIT_ASSERT_EQUAL(std::vector
<SwFormToken
>::size_type(7), formTokens
.size());
37 //check individual tokens for proper values
39 SwFormToken token1
= formTokens
.at(0);
40 CPPUNIT_ASSERT_EQUAL(FormTokenType::TOKEN_LINK_START
, token1
.eTokenType
);
41 CPPUNIT_ASSERT_EQUAL(OUString("<LS Index Link,65535,>"), token1
.GetString());
43 SwFormToken token2
= formTokens
.at(1);
44 CPPUNIT_ASSERT_EQUAL(FormTokenType::TOKEN_ENTRY_NO
, token2
.eTokenType
);
45 CPPUNIT_ASSERT_EQUAL(OUString("<E# ,65535,0,10>"), token2
.GetString());
47 SwFormToken token3
= formTokens
.at(2);
48 CPPUNIT_ASSERT_EQUAL(FormTokenType::TOKEN_TEXT
, token3
.eTokenType
);
49 CPPUNIT_ASSERT_EQUAL(OUString("<X ,65535,\001.\001>"), token3
.GetString());
51 SwFormToken token4
= formTokens
.at(3);
52 CPPUNIT_ASSERT_EQUAL(FormTokenType::TOKEN_ENTRY_TEXT
, token4
.eTokenType
);
53 CPPUNIT_ASSERT_EQUAL(OUString("<ET ,65535,>"), token4
.GetString());
55 SwFormToken token5
= formTokens
.at(4);
56 CPPUNIT_ASSERT_EQUAL(FormTokenType::TOKEN_TAB_STOP
, token5
.eTokenType
);
57 CPPUNIT_ASSERT_EQUAL(OUString("<T ,65535,0,5,.,1>"), token5
.GetString());
59 SwFormToken token6
= formTokens
.at(5);
60 CPPUNIT_ASSERT_EQUAL(FormTokenType::TOKEN_PAGE_NUMS
, token6
.eTokenType
);
61 CPPUNIT_ASSERT_EQUAL(OUString("<# ,65535,>"), token6
.GetString());
63 SwFormToken token7
= formTokens
.at(6);
64 CPPUNIT_ASSERT_EQUAL(FormTokenType::TOKEN_LINK_END
, token7
.eTokenType
);
65 CPPUNIT_ASSERT_EQUAL(OUString("<LE ,65535,>"), token7
.GetString());
68 // Put the test suite in the registry
69 CPPUNIT_TEST_SUITE_REGISTRATION(ToxMiscTest
);
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */