diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-05 17:08:49 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-06 16:23:44 +0200 |
commit | 16a338e173083954a9932a3a4005f172309c784e (patch) | |
tree | c401b0f8857e61147d5a0b2d7dc239fed9e047d5 /o3tl/qa/test-lru_map.cxx | |
parent | 01a782d2ceb741d20721b44d26d862d80b47d226 (diff) |
Convert ImplFontCache to use o3tl::lru_map
We still do our own cleanup of the LRU map, as we can't drop
any fonts in use.
Change-Id: I8ec5c6ce8f80893635621357e9085950e7010f5b
Reviewed-on: https://gerrit.libreoffice.org/61455
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'o3tl/qa/test-lru_map.cxx')
-rw-r--r-- | o3tl/qa/test-lru_map.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/o3tl/qa/test-lru_map.cxx b/o3tl/qa/test-lru_map.cxx index 7a4886d3be3e..a7f9777e2c5f 100644 --- a/o3tl/qa/test-lru_map.cxx +++ b/o3tl/qa/test-lru_map.cxx @@ -28,6 +28,7 @@ public: void testLruRemoval(); void testCustomHash(); void testRemoveIf(); + void testNoAutoCleanup(); CPPUNIT_TEST_SUITE(lru_map_test); CPPUNIT_TEST(testBaseUsage); @@ -36,6 +37,7 @@ public: CPPUNIT_TEST(testLruRemoval); CPPUNIT_TEST(testCustomHash); CPPUNIT_TEST(testRemoveIf); + CPPUNIT_TEST(testNoAutoCleanup); CPPUNIT_TEST_SUITE_END(); }; @@ -289,6 +291,24 @@ void lru_map_test::testRemoveIf() CPPUNIT_ASSERT_EQUAL(size_t(0), lru.size()); } +void lru_map_test::testNoAutoCleanup() +{ + o3tl::lru_map<int, int> lru(0); + CPPUNIT_ASSERT_EQUAL(size_t(0), lru.size()); + lru.insert({0,0}); + lru.insert({1,1}); + CPPUNIT_ASSERT_EQUAL(size_t(2), lru.size()); + lru.insert({0,0}); + CPPUNIT_ASSERT_EQUAL(size_t(2), lru.size()); + + int i = 0; + for (auto &rPair : lru) + { + CPPUNIT_ASSERT_EQUAL(i, rPair.first); + ++i; + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(lru_map_test); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |