summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvisvgm/dvisvgm-src/tests/FontCacheTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/tests/FontCacheTest.cpp')
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/tests/FontCacheTest.cpp35
1 files changed, 29 insertions, 6 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/tests/FontCacheTest.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/tests/FontCacheTest.cpp
index e4900f66756..45a65f8587e 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/tests/FontCacheTest.cpp
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/tests/FontCacheTest.cpp
@@ -2,7 +2,7 @@
** FontCacheTest.cpp **
** **
** This file is part of dvisvgm -- a fast DVI to SVG converter **
-** Copyright (C) 2005-2017 Martin Gieseking <martin.gieseking@uos.de> **
+** Copyright (C) 2005-2018 Martin Gieseking <martin.gieseking@uos.de> **
** **
** This program is free software; you can redistribute it and/or **
** modify it under the terms of the GNU General Public License as **
@@ -24,16 +24,39 @@
#include "FileSystem.hpp"
#include "FontCache.hpp"
-#ifndef SRCDIR
-#define SRCDIR "."
+#ifndef BUILDDIR
+#define BUILDDIR "."
#endif
using namespace std;
-class FontCacheTest : public testing::Test
-{
+class LocalCache {
+ public:
+ LocalCache (const string &cachedir)
+ : _cachedir(cachedir),
+ _created(!FileSystem::exists(cachedir) && FileSystem::mkdir(cachedir))
+ {
+ }
+
+ ~LocalCache () {
+ if (_created)
+ FileSystem::rmdir(_cachedir);
+ }
+
+ string cachedir () const {return _cachedir;}
+
+ private:
+ string _cachedir;
+ bool _created;
+};
+
+
+static LocalCache localCache(BUILDDIR"/data");
+
+
+class FontCacheTest : public testing::Test {
protected:
- FontCacheTest () : testing::Test(), cachedir("data") {
+ FontCacheTest () : testing::Test(), cachedir(localCache.cachedir()) {
glyph1.moveto(0, 0);
glyph1.lineto(10, 0);
glyph1.lineto(10, 10);