fbs/fontandbitmapserver/tfbs/tfbsglyphdatapanic.cpp
changeset 136 62bb7c97884c
parent 121 d72fc2aace31
--- a/fbs/fontandbitmapserver/tfbs/tfbsglyphdatapanic.cpp	Tue Jul 20 13:27:44 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/tfbsglyphdatapanic.cpp	Fri Jul 30 11:41:40 2010 +0300
@@ -18,6 +18,7 @@
  @internalComponent - Internal Symbian test code
 */
 
+#include <test/graphicsfontutils.h>
 #include <graphics/fbsglyphmetricsarray.h> 
 #include <graphics/fbsglyphdataiterator.h>
 #include "tfbsglyphdatapanic.h"
@@ -25,27 +26,6 @@
 _LIT(KTypefaceName, "DejaVu Sans Condensed");
 const TInt KNumGlyphCodes = 96;
 
-/*
-Lookup table to convert from ascii code to
-glyph code for the Deja Vu family of fonts.
- */
-const TUint DejaVuASCIIToGlyphCode[] = 
-    {
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 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, 38, 39, 40,
-    41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
-    51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 
-    61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
-    71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
-    81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
-    91, 92, 93, 94, 95, 96, 97, 98, 
-    };
-
 CTFbsGlyphDataPanic::CTFbsGlyphDataPanic(CTestStep* aStep):
     CTGraphicsBase(aStep)
     {
@@ -69,12 +49,15 @@
     User::LeaveIfError(iSgDriver.Open());
     
     //initialize the array with ASCII characters from 0020 to 007F
+    CCharCodeConverter* converter = CCharCodeConverter::NewLC();
+    converter->UseFontL(iFont);
     iGlyphCodes = new(ELeave) TUint[KNumGlyphCodes];
     for (TInt i = 0; i < KNumGlyphCodes; ++i)
         {
-        TUint asciiCode = i+0x20; 
-        iGlyphCodes[i] = DejaVuASCIIToGlyphCode[asciiCode];
+        TUint asciiCode = i + 0x20; 
+        iGlyphCodes[i] = converter->GlyphCodeL(asciiCode);
         }
+    CleanupStack::PopAndDestroy(1); // converter
     }
 
 void CTFbsGlyphDataPanic::RunTestCaseL(TInt /*aCurTestCase*/)
@@ -147,7 +130,7 @@
 	Call Next() on an RFbsGlyphDataIterator instance without opening it.
 
 @SYMTestExpectedResults
-	The call to Next() should panic with GDI 4.
+	The call to Next() should panic with FBSCLI 31.
 */
 void CTFbsGlyphDataPanic::TestGlyphDataIteratorNotInitializedNext()
     {
@@ -171,7 +154,7 @@
 	Call Image() on an RFbsGlyphDataIterator instance without opening it.
 
 @SYMTestExpectedResults
-	The call to Image() should panic with GDI 4.
+	The call to Image() should panic with FBSCLI 31.
 */
 void CTFbsGlyphDataPanic::TestGlyphDataIteratorNotInitializedImage()
     {
@@ -195,7 +178,7 @@
 	Call Metrics() on an RFbsGlyphDataIterator instance without opening it.
 
 @SYMTestExpectedResults
-	The call to Metrics() should panic with GDI 4.
+	The call to Metrics() should panic with FBSCLI 31.
 */
 void CTFbsGlyphDataPanic::TestGlyphDataIteratorNotInitializedMetrics()
     {
@@ -219,7 +202,7 @@
 	Call GlyphCode() on an RFbsGlyphDataIterator instance without opening it.
 
 @SYMTestExpectedResults
-	The call to GlyphCode() should panic with GDI 4.
+	The call to GlyphCode() should panic with FBSCLI 31.
 */
 void CTFbsGlyphDataPanic::TestGlyphDataIteratorNotInitializedGlyphCode()
     {
@@ -246,7 +229,7 @@
 
 @SYMTestExpectedResults
 	The call to Next() should fail with KErrNotFound, signifying the iterator is still open.
-	The final call to Next() should panic with GDI 4.
+	The final call to Next() should panic with FBSCLI 31.
 */
 void CTFbsGlyphDataPanic::TestGlyphDataIteratorClosedNext()
     {
@@ -276,7 +259,7 @@
 	iii. Call Image() on an RFbsGlyphDataIterator instance which has been closed.
 
 @SYMTestExpectedResults
-	The call to Image() should panic with GDI 4.
+	The call to Image() should panic with FBSCLI 31.
 */
 void CTFbsGlyphDataPanic::TestGlyphDataIteratorClosedImage()
     {
@@ -303,7 +286,7 @@
 	iii. Call Metrics() on an RFbsGlyphDataIterator instance which has been closed.
 
 @SYMTestExpectedResults
-	The call to Metrics() should panic with GDI 4.
+	The call to Metrics() should panic with FBSCLI 31.
 */
 void CTFbsGlyphDataPanic::TestGlyphDataIteratorClosedMetrics()
     {
@@ -330,7 +313,7 @@
 	iii. Call GlyphCode() on an RFbsGlyphDataIterator instance which has been closed.
 
 @SYMTestExpectedResults
-	The call to GlyphCode() should panic with GDI 4.
+	The call to GlyphCode() should panic with FBSCLI 31.
 */
 void CTFbsGlyphDataPanic::TestGlyphDataIteratorClosedGlyphCode()
     {
@@ -401,7 +384,7 @@
 	ii. Try to access glyph metrics entry with a negative index.
 
 @SYMTestExpectedResults
-	Should panic with GDI 5.
+	Should panic with FBSCLI 32.
 */
 void CTFbsGlyphDataPanic::TestGlyphMetricsArrayIndexNegative()
     {
@@ -431,7 +414,7 @@
 	ii. Try to access glyph metrics entry with index equals 2.
 
 @SYMTestExpectedResults
-	Should panic with GDI 5.
+	Should panic with FBSCLI 32.
 */
 void CTFbsGlyphDataPanic::TestGlyphMetricsArrayIndexTooHigh()
     {