diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-17 15:19:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-20 08:02:25 +0200 |
commit | ec7ba61a6164c805f5a71b077715b7e1521a2d62 (patch) | |
tree | 4d4f3fb1ad960465897754601b0842c78db564bf /svl/qa | |
parent | 7d58f26bf4dbeb4e138c2a91f039d8bc7fa00f0c (diff) |
simplify SfxPoolItemArray_Impl (tdf#81765 related)
Since we want to look up items by pointer, just store them in a
std::unordered_set, which allows fast find().
This dramatically simplifies most operations on this data structure.
Fix a dodgy sd test that was relying on items with the same whichid
being in the pool being in a certain order.
Change-Id: I4d79fc718f95e3083a20788be1050fbe9fca7263
Reviewed-on: https://gerrit.libreoffice.org/70881
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl/qa')
-rw-r--r-- | svl/qa/unit/items/test_itempool.cxx | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/svl/qa/unit/items/test_itempool.cxx b/svl/qa/unit/items/test_itempool.cxx index cde5dee62f2c..9b5528532515 100644 --- a/svl/qa/unit/items/test_itempool.cxx +++ b/svl/qa/unit/items/test_itempool.cxx @@ -79,24 +79,17 @@ void PoolItemTest::testPool() CPPUNIT_ASSERT(&rVal2 != &rVal); } - // Test rehash - for (auto & pSlice : pImpl->maPoolItems) - { - if (pSlice) - pSlice->ReHash(); - } - // Test removal. SfxVoidItem aRemoveFour(4); SfxVoidItem aNotherFour(4); const SfxPoolItem &rKeyFour = pPool->Put(aRemoveFour); pPool->Put(aNotherFour); CPPUNIT_ASSERT(pImpl->maPoolItems[3]->size() > 0); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pImpl->maPoolItems[3]->maFree.size()); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pImpl->maPoolItems[3]->size()); pPool->Remove(rKeyFour); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pImpl->maPoolItems[3]->maFree.size()); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pImpl->maPoolItems[3]->size()); pPool->Put(aNotherFour); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pImpl->maPoolItems[3]->maFree.size()); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pImpl->maPoolItems[3]->size()); } |