summaryrefslogtreecommitdiff
path: root/svl/qa/unit/svl.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2013-10-02 12:19:19 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-10-04 19:15:22 -0400
commitb3674c9291a09c4e278a0875b691fc7aaf3f38cd (patch)
tree3f78b48f1e00366f1228f83b136bed8eedff1aaf /svl/qa/unit/svl.cxx
parent4d076d4ceeb05061b6b0699c19af9ba5ed0fcd00 (diff)
Let's not expose the internal pointer. Define different ID type.
To prevent the string ID's from being used to instantiate string objects, which can mess up shared string object's life cycles. Change-Id: Ibcd9a4fa9f591d5c27a9e1b50bc9f83ae230e86a
Diffstat (limited to 'svl/qa/unit/svl.cxx')
-rw-r--r--svl/qa/unit/svl.cxx39
1 files changed, 21 insertions, 18 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index f41ab737783d..003a1523b163 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -305,27 +305,30 @@ void Test::testStringPool()
CPPUNIT_ASSERT_MESSAGE("They must differ.", p1 != p2);
OUString aAndy("Andy");
- p2 = aPool.getIdentifier(aAndy);
- CPPUNIT_ASSERT_EQUAL(p1, p2);
+ svl::StringPool::StrIdType si1 = aPool.getIdentifier("Andy");
+ svl::StringPool::StrIdType si2 = aPool.getIdentifier(aAndy);
+ CPPUNIT_ASSERT_EQUAL(si1, si2);
// Test case insensitive string ID's.
OUString aAndyLower("andy"), aAndyUpper("ANDY");
- p1 = aPool.getIdentifier("Andy");
- CPPUNIT_ASSERT_MESSAGE("This shouldn't be NULL.", p1);
- p2 = aPool.intern(aAndyLower);
- CPPUNIT_ASSERT_MESSAGE("They must differ.", p1 != p2);
- p2 = aPool.intern(aAndyUpper);
- CPPUNIT_ASSERT_MESSAGE("They must differ.", p1 != p2);
-
- p1 = aPool.getIdentifierIgnoreCase("Andy");
- CPPUNIT_ASSERT_MESSAGE("This shouldn't be NULL.", p1);
- p2 = aPool.getIdentifierIgnoreCase("andy");
- CPPUNIT_ASSERT_MESSAGE("This shouldn't be NULL.", p2);
- CPPUNIT_ASSERT_EQUAL(p1, p2);
-
- p2 = aPool.getIdentifierIgnoreCase("ANDY");
- CPPUNIT_ASSERT_MESSAGE("This shouldn't be NULL.", p2);
- CPPUNIT_ASSERT_EQUAL(p1, p2);
+ si1 = aPool.getIdentifier("Andy");
+ CPPUNIT_ASSERT_MESSAGE("This shouldn't be NULL.", si1);
+ aPool.intern(aAndyLower);
+ si2 = aPool.getIdentifier(aAndyLower);
+ CPPUNIT_ASSERT_MESSAGE("They must differ.", si1 != si2);
+ aPool.intern(aAndyUpper);
+ si2 = aPool.getIdentifier(aAndyUpper);
+ CPPUNIT_ASSERT_MESSAGE("They must differ.", si1 != si2);
+
+ si1 = aPool.getIdentifierIgnoreCase("Andy");
+ CPPUNIT_ASSERT_MESSAGE("This shouldn't be NULL.", si1);
+ si2 = aPool.getIdentifierIgnoreCase("andy");
+ CPPUNIT_ASSERT_MESSAGE("This shouldn't be NULL.", si2);
+ CPPUNIT_ASSERT_EQUAL(si1, si2);
+
+ si2 = aPool.getIdentifierIgnoreCase("ANDY");
+ CPPUNIT_ASSERT_MESSAGE("This shouldn't be NULL.", si2);
+ CPPUNIT_ASSERT_EQUAL(si1, si2);
}
void Test::checkPreviewString(SvNumberFormatter& aFormatter,