11#include <catch2/catch.hpp>
42 REQUIRE(count == range.size());
50 const size_t leftOffset =
53 const size_t rightOffset =
57 const auto age = range.first->LastCacheAccess;
61 REQUIRE(range.first.GetLeftOffset() == leftOffset);
62 REQUIRE(range.first.GetRightOffset() == rightOffset);
66 REQUIRE(range.first.GetLeftOffset() == leftOffset);
67 REQUIRE(range.first.GetRightOffset() == 0);
69 auto it = range.first;
74 REQUIRE(it.GetLeftOffset() == 0);
75 REQUIRE(it.GetRightOffset() == 0);
76 REQUIRE(it->LastCacheAccess == age);
81 REQUIRE(it.GetLeftOffset() == 0);
82 REQUIRE(it.GetRightOffset() == rightOffset);
83 REQUIRE(it->LastCacheAccess == age);
94 REQUIRE(cache.PerformLookup(info, 0, 0).empty());
95 REQUIRE(!cache.PerformLookup(info, 0, 1).empty());
97 REQUIRE(cache.PerformLookup(info, 0, 1).first->LastCacheAccess == 2);
108 for (
int i = 0; i < 128; ++i)
111 const double t1 = t0 + 2;
113 const int64_t itemsCount = 1 +
TEST_CASE("graphics-data-cache", "")
static constexpr uint32_t CacheElementWidth
IteratorRange< GraphicsDataCacheIterator< CacheElementType > > PerformLookup(const ZoomInfo &zoomInfo, double t0, double t1)
static double GetDefaultZoom()
int64 TimeToPosition(double time, int64 origin=0, bool ignoreFisheye=false) const
STM: Converts a project time to screen x position.
void CheckCacheElementLookup(GraphicsDataCache< CacheElement > &cache, const ZoomInfo &zoomInfo, double t0, double t1, size_t count)
A base class for the for cache elements.
A key into the graphics data cache.
void Dispose() override
This method is called when the item is evicted from the cache. Default implementation is empty.
CacheElement & operator=(GraphicsDataCacheKey key)