summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/tests/FontCacheTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dviware/dvisvgm/tests/FontCacheTest.cpp')
-rw-r--r--dviware/dvisvgm/tests/FontCacheTest.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/dviware/dvisvgm/tests/FontCacheTest.cpp b/dviware/dvisvgm/tests/FontCacheTest.cpp
index 720db08115..d7928b5bb8 100644
--- a/dviware/dvisvgm/tests/FontCacheTest.cpp
+++ b/dviware/dvisvgm/tests/FontCacheTest.cpp
@@ -66,11 +66,11 @@ class FontCacheTest : public testing::Test {
glyph2.moveto(0, 0);
glyph2.cubicto(10, 10, 20, 0, 50, 50);
glyph2.lineto(30, 20);
- glyph2.conicto(20, 40, 20, 20);
+ glyph2.quadto(20, 40, 20, 20);
glyph2.closepath();
}
- ~FontCacheTest () {
+ ~FontCacheTest () override {
FileSystem::remove(cachedir+"/testfont.fgd");
}
@@ -103,37 +103,37 @@ TEST_F(FontCacheTest, glyph) {
TEST_F(FontCacheTest, write1) {
cache.setGlyph(1, glyph1);
ASSERT_TRUE(cache.fontname().empty());
- ASSERT_FALSE(cache.write(cachedir.c_str()));
+ ASSERT_FALSE(cache.write(cachedir));
}
TEST_F(FontCacheTest, write2) {
cache.setGlyph(1, glyph1);
ASSERT_TRUE(FileSystem::exists(cachedir));
- ASSERT_TRUE(cache.write("testfont", cachedir.c_str()));
+ ASSERT_TRUE(cache.write("testfont", cachedir));
cache.setGlyph(10, glyph2);
- ASSERT_TRUE(cache.write("testfont", cachedir.c_str()));
- ASSERT_TRUE(cache.fontname().empty());
+ EXPECT_TRUE(cache.write("testfont", cachedir));
+ EXPECT_TRUE(cache.fontname().empty());
}
TEST_F(FontCacheTest, read) {
cache.setGlyph(1, glyph1);
cache.setGlyph(10, glyph2);
- ASSERT_TRUE(cache.write("testfont", cachedir.c_str()));
+ ASSERT_TRUE(cache.write("testfont", cachedir));
// clear cache object
cache.clear();
- ASSERT_EQ(cache.getGlyph(1), nullptr);
- ASSERT_EQ(cache.getGlyph(2), nullptr);
- ASSERT_EQ(cache.getGlyph(10), nullptr);
+ EXPECT_EQ(cache.getGlyph(1), nullptr);
+ EXPECT_EQ(cache.getGlyph(2), nullptr);
+ EXPECT_EQ(cache.getGlyph(10), nullptr);
// read glyph data from cache file
- ASSERT_TRUE(cache.read("testfont", cachedir.c_str()));
- ASSERT_EQ(cache.fontname(), "testfont");
+ ASSERT_TRUE(cache.read("testfont", cachedir));
+ EXPECT_EQ(cache.fontname(), "testfont");
ASSERT_NE(cache.getGlyph(1), nullptr);
- ASSERT_EQ(cache.getGlyph(2), nullptr);
+ EXPECT_EQ(cache.getGlyph(2), nullptr);
ASSERT_NE(cache.getGlyph(10), nullptr);
- ASSERT_EQ(*cache.getGlyph(1), glyph1);
- ASSERT_EQ(*cache.getGlyph(10), glyph2);
+ EXPECT_EQ(*cache.getGlyph(1), glyph1);
+ EXPECT_EQ(*cache.getGlyph(10), glyph2);
}
@@ -141,7 +141,7 @@ TEST_F(FontCacheTest, fontinfo1) {
ostringstream oss;
cache.clear();
FileSystem::remove(cachedir+"/testfont.fgd");
- cache.fontinfo(cachedir.c_str(), oss);
+ cache.fontinfo(cachedir, oss);
ASSERT_EQ(oss.str(), "cache is empty\n");
// check removal of invalid cache files
@@ -150,7 +150,7 @@ TEST_F(FontCacheTest, fontinfo1) {
cachefile.close();
ASSERT_TRUE(FileSystem::exists(cachedir+"/invalid.fgd"));
oss.str("");
- cache.fontinfo(cachedir.c_str(), oss, true);
+ cache.fontinfo(cachedir, oss, true);
ASSERT_EQ(oss.str(),
"cache is empty\n"
"invalid cache file invalid.fgd removed\n"
@@ -162,12 +162,12 @@ TEST_F(FontCacheTest, fontinfo1) {
TEST_F(FontCacheTest, fontinfo2) {
cache.setGlyph(1, glyph1);
cache.setGlyph(10, glyph2);
- ASSERT_TRUE(cache.write("testfont", cachedir.c_str()));
+ ASSERT_TRUE(cache.write("testfont", cachedir));
ostringstream oss;
- cache.fontinfo(cachedir.c_str(), oss);
+ cache.fontinfo(cachedir, oss);
ASSERT_EQ(oss.str(),
"cache format version 5\n"
- "testfont 2 glyphs 10 cmds 58 bytes crc:38cb5c67\n"
+ "testfont 2 glyphs 10 cmds 58 bytes hash:3cb32ab6\n"
);
}