Commit 4a1ba59cb3f433cf7e36f5efb91eeb8c754eeb37

henry 2003-01-08T21:46:53

Implemented Attach from memory test

diff --git a/test/FTFace-Test.cpp b/test/FTFace-Test.cpp
index 0928057..db53df4 100755
--- a/test/FTFace-Test.cpp
+++ b/test/FTFace-Test.cpp
@@ -41,14 +41,14 @@ class FTFaceTest : public CppUnit::TestCase
         FTFace face1( (unsigned char*)100, 0);
         CPPUNIT_ASSERT( face1.Error() == 85);        
 
-        FTFace face2( arial_ttf.dataBytes, arial_ttf.numBytes);
+        FTFace face2( HPGCalc_pfb.dataBytes, HPGCalc_pfb.numBytes);
         CPPUNIT_ASSERT( face2.Error() == 0);        
     }
     
     
     void testAttachFile()
     {
-        CPPUNIT_ASSERT( !testFace->Attach( GOOD_FONT_FILE));
+        CPPUNIT_ASSERT( !testFace->Attach( TYPE1_AFM_FILE));
         CPPUNIT_ASSERT( testFace->Error() == 7);
 
         FTFace test( TYPE1_FONT_FILE);
@@ -63,6 +63,12 @@ class FTFaceTest : public CppUnit::TestCase
     {
         CPPUNIT_ASSERT( !testFace->Attach((unsigned char*)100, 0));
         CPPUNIT_ASSERT( testFace->Error() == 7);        
+
+        FTFace test( TYPE1_FONT_FILE);
+        CPPUNIT_ASSERT( test.Error() == 0);
+
+        CPPUNIT_ASSERT( test.Attach( HPGCalc_afm.dataBytes, HPGCalc_afm.numBytes));
+        CPPUNIT_ASSERT( test.Error() == 0);
     }
     
 
diff --git a/test/FTFont-Test.cpp b/test/FTFont-Test.cpp
index 1c34e72..0d31242 100755
--- a/test/FTFont-Test.cpp
+++ b/test/FTFont-Test.cpp
@@ -82,14 +82,14 @@ class FTFontTest : public CppUnit::TestCase
         TestFont badFont( (unsigned char*)100, 0);
         CPPUNIT_ASSERT( badFont.Error() == 85);        
 
-        TestFont goodFont( arial_ttf.dataBytes, arial_ttf.numBytes);
+        TestFont goodFont( HPGCalc_pfb.dataBytes, HPGCalc_pfb.numBytes);
         CPPUNIT_ASSERT( goodFont.Error() == 0);        
     }
     
     
     void testAttachFile()
     {
-        testFont->Attach( GOOD_FONT_FILE);
+        testFont->Attach( TYPE1_AFM_FILE);
         CPPUNIT_ASSERT( testFont->Error() == 7);        
     }
     
diff --git a/test/Fontdefs.h b/test/Fontdefs.h
index 50ae9cc..34f5b56 100644
--- a/test/Fontdefs.h
+++ b/test/Fontdefs.h
@@ -32,6 +32,7 @@ const unsigned int NUMBER_OF_GLYPHS = 50;
 const unsigned int TOO_MANY_GLYPHS  = 14100; // MHei-Medium-Acro has 14099
 
 
-#include "arial_ttf.cpp"
+#include "HPGCalc_pfb.cpp"
+#include "HPGCalc_afm.cpp"
 
 #endif // __Font_defs__
\ No newline at end of file
diff --git a/test/HPGCalc_afm.cpp b/test/HPGCalc_afm.cpp
index 1c24485..75e1a9d 100755
--- a/test/HPGCalc_afm.cpp
+++ b/test/HPGCalc_afm.cpp
@@ -6,13 +6,13 @@
 #define DEFINED_BINARYFILEDUMP
 
 typedef struct BINARYFILEDUMP_struct {
-	unsigned char * dataBytes;
+	const unsigned char * dataBytes;
 	size_t numBytes;
 } BINARYFILEDUMP;
 
 #endif
 
-unsigned char byte_data_HPGCalc_afm[ ] =
+const unsigned char byte_data_HPGCalc_afm[ ] =
 {
 	0x53, 0x74, 0x61, 0x72, 0x74, 0x46, 0x6f, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x20, 0x32, 0x2e, 0x30, 0x0d, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x70, 0x66, 0x61, 0x65, 0x64, 0x69, 0x74, 0x0d, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x44, 0x61, 0x74, 0x65, 0x3a, 0x20, 0x54, 0x68, 0x75, 0x20, 0x4f, 0x63, 0x74, 0x20, 0x33, 0x31, 0x20, 0x31, 0x37, 0x3a, 0x33, 0x31, 0x3a, 0x30, 0x33, 0x20, 0x32, 0x30, 0x30, 0x32, 0x0d, 0x0a, 0x46, 0x6f, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x20, 0x48, 0x50, 0x47, 0x43, 0x61, 0x6c, 0x63, 0x0d, 0x0a, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x20, 0x48, 0x50, 0x20, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x0d, 0x0a, 0x46, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x20, 0x48, 0x50, 0x47, 0x43, 0x61, 0x6c, 0x63, 0x0d, 0x0a, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x20, 0x4d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x0d, 0x0a, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x20, 0x28, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x4a, 0x6f, 0x73, 0x68, 0x75, 0x61, 0x20, 0x4b, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x50, 0x66, 0x61, 0x45, 0x64, 0x69, 0x74, 0x20, 0x31, 0x2e, 0x30, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x70, 0x66, 0x61, 0x65, 0x64, 
 	0x69, 0x74, 0x2e, 0x73, 0x66, 0x2e, 0x6e, 0x65, 0x74, 0x29, 0x20, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x20, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x48, 0x65, 0x77, 0x6c, 0x65, 0x74, 0x74, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x72, 0x64, 0x20, 0x61, 0x73, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x69, 0x72, 0x20, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x48, 0x50, 0x33, 0x38, 0x47, 0x2c, 0x20, 0x48, 0x50, 0x33, 0x39, 0x47, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x48, 0x50, 0x34, 0x30, 0x47, 0x2e, 0x29, 0x0d, 0x0a, 0x49, 0x74, 0x61, 0x6c, 0x69, 0x63, 0x41, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x30, 0x0d, 0x0a, 0x49, 0x73, 0x46, 0x69, 0x78, 0x65, 0x64, 0x50, 0x69, 0x74, 0x63, 0x68, 0x20, 0x74, 0x72, 0x75, 0x65, 0x0d, 0x0a, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x6c, 0x69, 0x6e, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x2d, 0x31, 0x30, 0x30, 0x0d, 0x0a, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x6c, 0x69, 0x6e, 0x65, 0x54, 0x68, 0x69, 0x63, 0x6b, 0x6e, 0x65, 0x73, 0x73, 0x20, 0x35, 0x30, 0x0d, 0x0a, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x30, 0x30, 0x34, 0x2e, 0x30, 0x30, 0x30, 0x0d, 0x0a, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x20, 0x46, 0x6f, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x0d, 0x0a, 0x46, 0x6f, 0x6e, 
@@ -63,7 +63,7 @@ unsigned char byte_data_HPGCalc_afm[ ] =
 
 const int byte_size_HPGCalc_afm = 11394;
 
-BINARYFILEDUMP HPGCalc_afm =
+BINARYFILEDUMP const HPGCalc_afm =
 {
 	byte_data_HPGCalc_afm,
 	byte_size_HPGCalc_afm
diff --git a/test/HPGCalc_pfb.cpp b/test/HPGCalc_pfb.cpp
index e2aaef1..10e86d9 100755
--- a/test/HPGCalc_pfb.cpp
+++ b/test/HPGCalc_pfb.cpp
@@ -6,13 +6,13 @@
 #define DEFINED_BINARYFILEDUMP
 
 typedef struct BINARYFILEDUMP_struct {
-	unsigned char * dataBytes;
+	const unsigned char * dataBytes;
 	size_t numBytes;
 } BINARYFILEDUMP;
 
 #endif
 
-unsigned char byte_data_HPGCalc_pfb[ ] =
+const unsigned char byte_data_HPGCalc_pfb[ ] =
 {
 	0x80, 0x01, 0xc9, 0x15, 0x00, 0x00, 0x25, 0x21, 0x50, 0x53, 0x2d, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x46, 0x6f, 0x6e, 0x74, 0x2d, 0x31, 0x2e, 0x30, 0x3a, 0x20, 0x48, 0x50, 0x47, 0x43, 0x61, 0x6c, 0x63, 0x20, 0x30, 0x30, 0x34, 0x2e, 0x30, 0x30, 0x30, 0x0a, 0x25, 0x25, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x3a, 0x20, 0x48, 0x50, 0x47, 0x43, 0x61, 0x6c, 0x63, 0x0a, 0x25, 0x25, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x65, 0x3a, 0x20, 0x54, 0x68, 0x75, 0x20, 0x4f, 0x63, 0x74, 0x20, 0x33, 0x31, 0x20, 0x31, 0x37, 0x3a, 0x33, 0x31, 0x3a, 0x30, 0x33, 0x20, 0x32, 0x30, 0x30, 0x32, 0x0a, 0x25, 0x25, 0x43, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x3a, 0x20, 0x4a, 0x6f, 0x73, 0x68, 0x75, 0x61, 0x20, 0x4b, 0x69, 0x6e, 0x67, 0x2c, 0x2c, 0x2c, 0x28, 0x30, 0x38, 0x29, 0x20, 0x39, 0x34, 0x30, 0x31, 0x20, 0x37, 0x32, 0x36, 0x39, 0x0a, 0x25, 0x25, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x48, 0x50, 0x47, 0x43, 0x61, 0x6c, 0x63, 0x0a, 0x25, 0x20, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x4a, 0x6f, 0x73, 0x68, 0x75, 0x61, 0x20, 0x4b, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x50, 0x66, 0x61, 0x45, 0x64, 0x69, 0x74, 0x20, 0x31, 0x2e, 0x30, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x70, 0x66, 0x61, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x73, 0x66, 0x2e, 0x6e, 0x65, 0x74, 0x29, 0x20, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x0a, 0x25, 
 	0x20, 0x32, 0x30, 0x30, 0x32, 0x2d, 0x31, 0x30, 0x2d, 0x33, 0x31, 0x3a, 0x20, 0x46, 0x69, 0x78, 0x65, 0x64, 0x20, 0x6d, 0x61, 0x70, 0x20, 0x6f, 0x66, 0x20, 0x58, 0x20, 0x42, 0x61, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x68, 0x69, 0x20, 0x2d, 0x20, 0x6e, 0x6f, 0x20, 0x58, 0x20, 0x42, 0x61, 0x72, 0x20, 0x69, 0x6e, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x20, 0x55, 0x6e, 0x69, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x73, 0x2e, 0x20, 0x0a, 0x25, 0x20, 0x32, 0x30, 0x30, 0x32, 0x2d, 0x31, 0x30, 0x2d, 0x31, 0x33, 0x3a, 0x20, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x0a, 0x25, 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x50, 0x66, 0x61, 0x45, 0x64, 0x69, 0x74, 0x20, 0x31, 0x2e, 0x30, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x70, 0x66, 0x61, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x73, 0x66, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x29, 0x0a, 0x25, 0x25, 0x45, 0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x0a, 0x46, 0x6f, 0x6e, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x48, 0x50, 0x47, 0x43, 0x61, 0x6c, 0x63, 0x20, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x7b, 0x2f, 0x48, 0x50, 0x47, 0x43, 0x61, 0x6c, 0x63, 0x20, 0x66, 0x69, 0x6e, 0x64, 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x64, 0x75, 0x70, 0x2f, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x44, 0x20, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x7b, 0x64, 0x75, 0x70, 0x0a, 0x2f, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x44, 0x20, 0x67, 0x65, 0x74, 0x20, 0x34, 0x32, 0x35, 0x38, 0x38, 0x39, 0x30, 0x20, 
@@ -268,7 +268,7 @@ unsigned char byte_data_HPGCalc_pfb[ ] =
 
 const int byte_size_HPGCalc_pfb = 63877;
 
-BINARYFILEDUMP HPGCalc_pfb =
+BINARYFILEDUMP const HPGCalc_pfb =
 {
 	byte_data_HPGCalc_pfb,
 	byte_size_HPGCalc_pfb