Commit 06d1b14553ba17967dc0c6d33eb9a389fdf93a9c

henry 2005-01-03T09:09:35

Reset the error when setting the charmap

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);
         }