Read icon theme cache from memory mapped file and validate it.
Read icon theme cache from data and validate it.
Test if icon is listed in cache.
Test if icon is listed in cache and belongs to specified subdirectory.
Sub directories of icon theme listed in cache.
Path of cache file.
Find all sub directories the icon belongs to according to cache.
All icon names listed in cache.
Test if icon theme file is outdated, i.e. modification time of cache file is older than modification time of icon theme directory.
Test if icon theme file is outdated, i.e. modification time of cache file is older than modification time of icon theme directory.
string cachePath = "./test/Tango/icon-theme.cache"; assert(cachePath.exists); const(IconThemeCache) cache = new IconThemeCache(cachePath); assert(cache.fileName == cachePath); assert(cache.containsIcon("folder")); assert(cache.containsIcon("folder", "24x24/places")); assert(cache.containsIcon("edit-copy", "32x32/actions")); assert(cache.iconDirectories("text-x-generic").canFind("32x32/mimetypes")); assert(cache.directories().canFind("32x32/devices")); auto icons = cache.icons(); assert(icons.canFind("folder")); assert(icons.canFind("text-x-generic")); try { SysTime pathAccessTime, pathModificationTime; SysTime fileAccessTime, fileModificationTime; getTimes(cachePath, fileAccessTime, fileModificationTime); getTimes(cachePath.dirName, pathAccessTime, pathModificationTime); setTimes(cachePath, pathAccessTime, pathModificationTime); assert(!IconThemeCache.isOutdated(cachePath)); } catch(Exception e) { // some environmental error, just ignore } try { auto fileData = assumeUnique(std.file.read(cachePath)); assertNotThrown(new IconThemeCache(fileData, cachePath)); } catch(FileException e) { } immutable(ubyte)[] data = [0,2,0,0]; IconThemeCacheException thrown = collectException!IconThemeCacheException(new IconThemeCache(data, cachePath)); assert(thrown !is null, "Invalid cache must throw"); assert(thrown.context == "major version"); data = [0,1,0,1]; thrown = collectException!IconThemeCacheException(new IconThemeCache(data, cachePath)); assert(thrown !is null, "Invalid cache must throw"); assert(thrown.context == "minor version");
Class representation of icon-theme.cache file contained icon theme cache.