Commit 7556ce867830935e1d341a31662ce4e5fe56100a

henry 2003-01-08T09:02:38

Added Type1 file attach test

diff --git a/test/FTBBox-Test.cpp b/test/FTBBox-Test.cpp
index a2200c0..859ea70 100755
--- a/test/FTBBox-Test.cpp
+++ b/test/FTBBox-Test.cpp
@@ -132,7 +132,7 @@ class FTBBoxTest : public CppUnit::TestCase
             
             long glyphIndex = FT_Get_Char_Index( face, CHARACTER_CODE_G);
             
-            FT_Set_Char_Size( face, 0L, GOOD_SIZE * 64, RESOLUTION, RESOLUTION);
+            FT_Set_Char_Size( face, 0L, FONT_POINT_SIZE * 64, RESOLUTION, RESOLUTION);
             
             error = FT_Load_Glyph( face, glyphIndex, FT_LOAD_DEFAULT);
             assert(!error);
diff --git a/test/FTFace-Test.cpp b/test/FTFace-Test.cpp
index ca6e475..0928057 100755
--- a/test/FTFace-Test.cpp
+++ b/test/FTFace-Test.cpp
@@ -49,7 +49,13 @@ class FTFaceTest : public CppUnit::TestCase
     void testAttachFile()
     {
         CPPUNIT_ASSERT( !testFace->Attach( GOOD_FONT_FILE));
-        CPPUNIT_ASSERT( testFace->Error() == 7);        
+        CPPUNIT_ASSERT( testFace->Error() == 7);
+
+        FTFace test( TYPE1_FONT_FILE);
+        CPPUNIT_ASSERT( test.Error() == 0);
+
+        CPPUNIT_ASSERT( test.Attach( TYPE1_AFM_FILE));
+        CPPUNIT_ASSERT( test.Error() == 0);
     }
     
 
@@ -68,7 +74,7 @@ class FTFaceTest : public CppUnit::TestCase
 
     void testSetFontSize()
     {
-        FTSize size = testFace->Size( GOOD_SIZE, RESOLUTION);
+        FTSize size = testFace->Size( FONT_POINT_SIZE, RESOLUTION);
         CPPUNIT_ASSERT( testFace->Error() == 0);
     }
     
diff --git a/test/FTFont-Test.cpp b/test/FTFont-Test.cpp
index 4b57269..1c34e72 100755
--- a/test/FTFont-Test.cpp
+++ b/test/FTFont-Test.cpp
@@ -106,18 +106,18 @@ class FTFontTest : public CppUnit::TestCase
         CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, testFont->Ascender(), 0.01);
         CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, testFont->Descender(), 0.01);
 
-        CPPUNIT_ASSERT( testFont->FaceSize( GOOD_SIZE));
+        CPPUNIT_ASSERT( testFont->FaceSize( FONT_POINT_SIZE));
         CPPUNIT_ASSERT( testFont->Error() == 0);
         
-        CPPUNIT_ASSERT( testFont->FaceSize() == GOOD_SIZE);
+        CPPUNIT_ASSERT( testFont->FaceSize() == FONT_POINT_SIZE);
         
         CPPUNIT_ASSERT_DOUBLES_EQUAL(  52, testFont->Ascender(), 0.01);
         CPPUNIT_ASSERT_DOUBLES_EQUAL( -14, testFont->Descender(), 0.01);
 
-        CPPUNIT_ASSERT( testFont->FaceSize( GOOD_SIZE * 2));
+        CPPUNIT_ASSERT( testFont->FaceSize( FONT_POINT_SIZE * 2));
         CPPUNIT_ASSERT( testFont->Error() == 0);
 
-        CPPUNIT_ASSERT( testFont->FaceSize() == GOOD_SIZE * 2);
+        CPPUNIT_ASSERT( testFont->FaceSize() == FONT_POINT_SIZE * 2);
 
         CPPUNIT_ASSERT_DOUBLES_EQUAL( 103, testFont->Ascender(), 0.01);
         CPPUNIT_ASSERT_DOUBLES_EQUAL( -29, testFont->Descender(), 0.01);
@@ -135,7 +135,7 @@ class FTFontTest : public CppUnit::TestCase
     
     void testBoundingBox()
     {
-        CPPUNIT_ASSERT( testFont->FaceSize( GOOD_SIZE));
+        CPPUNIT_ASSERT( testFont->FaceSize( FONT_POINT_SIZE));
         CPPUNIT_ASSERT( testFont->Error() == 0);
         
         float llx, lly, llz, urx, ury, urz;
@@ -180,7 +180,7 @@ class FTFontTest : public CppUnit::TestCase
 
     void testAdvance()
     {
-        CPPUNIT_ASSERT( testFont->FaceSize( GOOD_SIZE));
+        CPPUNIT_ASSERT( testFont->FaceSize( FONT_POINT_SIZE));
         CPPUNIT_ASSERT( testFont->Error() == 0);
         
         float advance = testFont->Advance( GOOD_ASCII_TEST_STRING);
diff --git a/test/FTSize-Test.cpp b/test/FTSize-Test.cpp
index cfeb793..68b8e0a 100755
--- a/test/FTSize-Test.cpp
+++ b/test/FTSize-Test.cpp
@@ -45,7 +45,7 @@ class FTSizeTest : public CppUnit::TestCase
             
             FTSize size;
             
-            CPPUNIT_ASSERT( size.CharSize( &face, GOOD_SIZE, RESOLUTION, RESOLUTION));
+            CPPUNIT_ASSERT( size.CharSize( &face, FONT_POINT_SIZE, RESOLUTION, RESOLUTION));
             CPPUNIT_ASSERT( size.Error() == 0);
             
             CPPUNIT_ASSERT_DOUBLES_EQUAL(  72, size.CharSize(), 0.01);
diff --git a/test/FTVectoriser-Test.cpp b/test/FTVectoriser-Test.cpp
index 07b4d00..9bf440d 100755
--- a/test/FTVectoriser-Test.cpp
+++ b/test/FTVectoriser-Test.cpp
@@ -431,7 +431,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             long glyphIndex = FT_Get_Char_Index( face, characterIndex);
             
-            FT_Set_Char_Size( face, 0L, GOOD_SIZE * 64, RESOLUTION, RESOLUTION);
+            FT_Set_Char_Size( face, 0L, FONT_POINT_SIZE * 64, RESOLUTION, RESOLUTION);
             
             FT_Error error = FT_Load_Glyph( face, glyphIndex, FT_LOAD_DEFAULT);
             assert(!error);
diff --git a/test/Fontdefs.h b/test/Fontdefs.h
index 701d71a..50ae9cc 100644
--- a/test/Fontdefs.h
+++ b/test/Fontdefs.h
@@ -2,16 +2,18 @@
 #define    __Font_defs__
 
 
-const char* const BAD_FONT_FILE  = "missing_font.ttf";
-const char* const GOOD_FONT_FILE = "../../test/MHei-Medium-Acro";
-const char* const FONT_FILE      = "../../test/arial.ttf";
-
-const char* const    GOOD_ASCII_TEST_STRING        = "test string";
-const char* const    BAD_ASCII_TEST_STRING         = "";
+const char* const BAD_FONT_FILE   = "missing_font.ttf";
+const char* const GOOD_FONT_FILE  = "../../test/MHei-Medium-Acro";
+const char* const FONT_FILE       = "../../test/arial.ttf";
+const char* const TYPE1_FONT_FILE = "../../test/HPGCalc.pfb";
+const char* const TYPE1_AFM_FILE  = "../../test/HPGCalc.afm";
+
+const char*    const GOOD_ASCII_TEST_STRING        = "test string";
+const char*    const BAD_ASCII_TEST_STRING         = "";
 const wchar_t        GOOD_UNICODE_TEST_STRING[4]   = { 0x6FB3, 0x9580, 0x0};
 const wchar_t* const BAD_UNICODE_TEST_STRING       = L"";
 
-const unsigned int GOOD_SIZE  = 72;
+const unsigned int FONT_POINT_SIZE  = 72;
 const unsigned int RESOLUTION = 72;
 
 const unsigned int CHARACTER_CODE_A        = 'A';