int main(int argc, const char** argv) { auto testsPath = boost::filesystem::path("./tests/"); boost::filesystem::directory_iterator endDirectoryIterator; for(boost::filesystem::directory_iterator directoryIterator(testsPath); directoryIterator != endDirectoryIterator; directoryIterator++) { auto testPath = directoryIterator->path(); auto stream = Framework::CreateInputStdStream(testPath.native()); CGameTestSheet testSheet(stream); for(const auto& test : testSheet.GetTests()) { auto environment = testSheet.GetEnvironment(test.environmentId); PrepareTestEnvironment(environment); ExecuteTest(test); } } return 0; }
/** Function to create a font, draw the text, and compare the hash value @param aHashId a string with the hash ID. @param aFont the font name @param aOutputString the output string @param aPosition the position where to draw the text @param aSize the height of the font in pixels @param aAttributes the attributes for the font @see TFontEffectsFlags */ void CTLinkedFontsComparison::DoTestDrawingOutputL(const TDesC& aHashId, const TPtrC& aFont, const TDesC& aOutputString, TPoint aPosition, TInt aSize, TUint32 aAttributes) { TFontSpec fontSpec; PrepareTestEnvironment(fontSpec, aFont, aSize, aAttributes, ETrue, ETrue); CFont* font; TEST(iBitmapDevice->GetNearestFontToDesignHeightInPixels((CFont*&)font, fontSpec) == KErrNone); SCleanFont cleanupFont = {iBitmapDevice, font}; CleanupStack::PushL(TCleanupItem(CleanUpFont, &cleanupFont)); //may need to add attributes for the font CBitmapFont* bitmapFont=CFbsFontEx::FontAddress(static_cast<CFbsFont*>(font)); if (aAttributes& EItalicOn) { bitmapFont->iAlgStyle.SetIsItalic(ETrue); } if (aAttributes& ERegularBoldOn) { bitmapFont->iAlgStyle.SetIsBold(ETrue); } iGc->SetBrushColor(KRgbWhite); iGc->Clear(); iGc->SetBrushColor(KRgbYellow); iGc->UseFont(font); if(EVerticalDraw & aAttributes) { iGc->DrawTextVertical(aOutputString, aPosition, ERotate90Degrees & aAttributes); } else { iGc->DrawText(aOutputString, aPosition); } iHashUtil->CompareHashValuesL(aHashId); CleanupStack::Pop();//font iBitmapDevice->ReleaseFont(font); iGc->DiscardFont(); }