Reset the error when setting the charmap
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/src/FTCharmap.cpp b/src/FTCharmap.cpp
index 87b2f23..20cca4a 100644
--- a/src/FTCharmap.cpp
+++ b/src/FTCharmap.cpp
@@ -25,6 +25,7 @@ bool FTCharmap::CharMap( FT_Encoding encoding)
{
if( ftEncoding == encoding)
{
+ err = 0;
return true;
}
diff --git a/test/FTCharmap-Test.cpp b/test/FTCharmap-Test.cpp
index 06b9c8b..a29a7db 100755
--- a/test/FTCharmap-Test.cpp
+++ b/test/FTCharmap-Test.cpp
@@ -57,7 +57,7 @@ class FTCharmapTest : public CppUnit::TestCase
CPPUNIT_ASSERT( !charmap->CharMap( ft_encoding_johab));
CPPUNIT_ASSERT( charmap->Error() == 0x06); // invalid argument
- CPPUNIT_ASSERT( charmap->Encoding() == ft_encoding_none);
+ CPPUNIT_ASSERT( charmap->Encoding() == ft_encoding_unicode);
}
@@ -77,6 +77,11 @@ class FTCharmapTest : public CppUnit::TestCase
CPPUNIT_ASSERT( charmap->GlyphListIndex( BIG_CHARACTER_CODE) == 0);
CPPUNIT_ASSERT( charmap->GlyphListIndex( NULL_CHARACTER_CODE) == 0);
+ // Check that the error flag is reset.
+ charmap->CharMap( ft_encoding_johab);
+ CPPUNIT_ASSERT( charmap->Error() == 0x06); // invalid argument
+ charmap->CharMap( ft_encoding_unicode);
+ CPPUNIT_ASSERT( charmap->Error() == 0);
}