From 982faba190cefc3ae458f5400a062ccc0e7bd98e Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Thu, 15 Sep 2016 01:21:15 -0500 Subject: [PATCH] Fixing DiskCache unittest, and adding some better clean-up code to remove the cache folder after running unittests. --- tests/Cache_Tests.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/Cache_Tests.cpp b/tests/Cache_Tests.cpp index 0d7df51b..419d4c55 100644 --- a/tests/Cache_Tests.cpp +++ b/tests/Cache_Tests.cpp @@ -333,11 +333,22 @@ TEST(CacheDisk_Set_Max_Bytes) CHECK_EQUAL(320, f->GetWidth()); CHECK_EQUAL(180, f->GetHeight()); CHECK_EQUAL(2, f->GetAudioChannelsCount()); - //TODO: Determine why GetAudioSamplesCount() is returning 0 - //CHECK_EQUAL(500, f->GetAudioSamplesCount()); + CHECK_EQUAL(500, f->GetAudioSamplesCount()); CHECK_EQUAL(LAYOUT_STEREO, f->ChannelsLayout()); CHECK_EQUAL(44100, f->SampleRate()); + // Check count of cache + CHECK_EQUAL(20, c.Count()); + + // Clear cache + c.Clear(); + + // Check count of cache + CHECK_EQUAL(0, c.Count()); + + // Delete cache directory + QDir path = QDir::tempPath() + QString("/preview-cache/"); + path.removeRecursively(); } TEST(CacheDisk_Multiple_Remove) @@ -366,6 +377,10 @@ TEST(CacheDisk_Multiple_Remove) // Should have 20 frames CHECK_EQUAL(0, c.Count()); + + // Delete cache directory + QDir path = QDir::tempPath() + QString("/preview-cache/"); + path.removeRecursively(); } TEST(CacheDisk_JSON) @@ -403,6 +418,9 @@ TEST(CacheDisk_JSON) CHECK_EQUAL(1, c.JsonValue()["ranges"].size()); CHECK_EQUAL("5", c.JsonValue()["version"].asString()); + // Delete cache directory + QDir path = QDir::tempPath() + QString("/preview-cache/"); + path.removeRecursively(); } TEST(CacheMemory_JSON)