summaryrefslogtreecommitdiff
path: root/xmloff/qa
diff options
context:
space:
mode:
authorMohammed Abdul Azeem <azeemmysore@gmail.com>2016-08-17 09:03:18 +0530
committerNoel Grandin <noelgrandin@gmail.com>2016-08-22 07:12:28 +0000
commit090e3fe4165aff11f557c7da2536fec44639607e (patch)
tree9282d641cb2289156a19ae08543b95bd58ada323 /xmloff/qa
parent308d541ed50c3ce3234a4a8ae86c968a70409d63 (diff)
GSoC - Keeping both token lists in xmloff/ consistent:
Added dummy tokens to keep the lists consistent and a test case to check the same. Change-Id: Ia58f1f77a5100a9fb3c7226fcad1fef1bd5aec39 Reviewed-on: https://gerrit.libreoffice.org/28183 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'xmloff/qa')
-rw-r--r--xmloff/qa/unit/tokenmap-test.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/xmloff/qa/unit/tokenmap-test.cxx b/xmloff/qa/unit/tokenmap-test.cxx
index b2948c94db8c..0144ded71e2b 100644
--- a/xmloff/qa/unit/tokenmap-test.cxx
+++ b/xmloff/qa/unit/tokenmap-test.cxx
@@ -14,6 +14,7 @@
#include "xmloff/fasttokenhandler.hxx"
#include "xmloff/token/tokens.hxx"
+#include <xmloff/xmltoken.hxx>
using namespace std;
using namespace com::sun::star::uno;
@@ -27,10 +28,13 @@ public:
TokenmapTest();
void test_roundTrip();
+ void test_listEquality();
CPPUNIT_TEST_SUITE(TokenmapTest);
CPPUNIT_TEST(test_roundTrip);
+ CPPUNIT_TEST(test_listEquality);
+
CPPUNIT_TEST_SUITE_END();
private:
@@ -55,6 +59,32 @@ void TokenmapTest::test_roundTrip()
}
}
+void TokenmapTest::test_listEquality()
+{
+ //make sure the two token lists stay in sync
+ for ( sal_Int32 nToken = 0; nToken < XML_TOKEN_COUNT; ++nToken )
+ {
+ Sequence< sal_Int8 > rUtf8Name = pTokenMap->getUtf8TokenName(nToken);
+ const OUString& rName = OUString( reinterpret_cast< const char* >(
+ rUtf8Name.getConstArray() ), rUtf8Name.getLength(), RTL_TEXTENCODING_UTF8 );
+ if ( rName.endsWith("_DUMMY") )
+ continue;
+ const OUString& rTokenName = GetXMLToken( static_cast<xmloff::token::XMLTokenEnum>(nToken) );
+ CPPUNIT_ASSERT_EQUAL(rName, rTokenName);
+ }
+
+ for ( sal_Int32 nToken = xmloff::token::XMLTokenEnum::XML_TOKEN_START + 1;
+ nToken < xmloff::token::XMLTokenEnum::XML_TOKEN_END; ++nToken )
+ {
+ const OUString& rTokenName = GetXMLToken( static_cast<xmloff::token::XMLTokenEnum>(nToken) );
+ Sequence< sal_Int8 > rUtf8Name = pTokenMap->getUtf8TokenName(nToken);
+ const OUString& rName = OUString( reinterpret_cast< const char* >(
+ rUtf8Name.getConstArray() ), rUtf8Name.getLength(), RTL_TEXTENCODING_UTF8 );
+ if ( !rName.endsWith("_DUMMY") )
+ CPPUNIT_ASSERT_EQUAL(rTokenName, rName);
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(TokenmapTest);
}