Exemple #1
0
/** Calls CFbsFont::RawTextWidthInPixels() */
void CT_DataFbsFont::DoCmdRawTextWidthInPixels(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("Calls CFbsFont::RawTextWidthInPixels()"));

	// get text from parameters
	TPtrC	text;
	if (!GetStringFromConfig(aSection, KText(), text))
		{
		ERR_PRINTF2(_L("No %S"), &KText());
		SetBlockResult(EFail);
		}
	else
		{
		// call RawTextWidthInPixels()
		TInt	width = iFbsFont->RawTextWidthInPixels(text);

		// check result against MeasureText()
		TInt	measureTextWidth = iFbsFont->MeasureText(text);
		if ( width != measureTextWidth)
			{
			ERR_PRINTF3(_L("The result of RawTextWidthInPixels() is not the same as for MeasureText(): %d, and %d"), width, measureTextWidth);
			SetBlockResult(EFail);
			}
		}
	}
Exemple #2
0
/** Calls CFbsFont::TextWidthInPixels() using SCharWidth output paramter */
void CT_DataFbsFont::DoCmdTextWidthInPixelsWithCharWidth(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("Calls CFbsFont::TextWidthInPixels() using SCharWidth output paramter"));

	// get text from parameters
	TPtrC	text;
	if (!GetStringFromConfig(aSection, KText(), text))
		{
		ERR_PRINTF2(_L("No %S"), &KText());
		SetBlockResult(EFail);
		}
	else
		{
		//	call TextWidthInPixels()
		SCharWidth	charWidth;
		iFbsFont->TextWidthInPixels(text, charWidth);

		// validate SCharWidth
		if (charWidth.iMove != charWidth.iLeftAdjust + charWidth.iWidth + charWidth.iRightAdjust)
			{
			ERR_PRINTF5(_L("Move is not equal to left adjust + width + right adjust!, move: %d, leftAdjust: %d, width: %d, rightAdjust: %d"), charWidth.iMove, charWidth.iLeftAdjust, charWidth.iWidth, charWidth.iRightAdjust);
			SetBlockResult(EFail);
			}
		}
	}
void CTestLtsyPhbkWrite::WriteEntryL(TInt aIndex)
	{
	TRequestStatus status;
	TBuf8<800> pbData; // Client reserved space for phonebook data
	TInt ret;
	    
	_LIT16(KTel,"123456%03d");
	_LIT16(KText,"TelNo %03d");
	TBuf16<20> text(KTel), number(KText);

	CPhoneBookBuffer* pbBuffer = new(ELeave) CPhoneBookBuffer(); // used to write phonebook data
	CleanupStack::PushL(pbBuffer);
	pbBuffer->Set(&pbData); // Set it to point to the Client buffer
	pbBuffer->AddNewEntryTag();
	// convert number into TLV format and append it to allocated buffer
	TInt index = aIndex;
	ret = pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBAdnIndex,(TUint16)index);
	if( ret != KErrNone )
		{
		CleanupStack::PopAndDestroy();
		SetTestStepResult(EFail);
		}
	number.Format(KTel(), index);
	ret=pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, number);
//	ret=pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNewEntry, number);
	if( ret != KErrNone )
		{
		CleanupStack::PopAndDestroy();
		SetTestStepResult(EFail);
		}
	// convert number type into TLV format and append it to allocated buffer
	TUint8 tonNpi=KTypeOfNumber; 
	ret=pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBTonNpi, tonNpi);
	if(ret!=KErrNone)
		{
		CleanupStack::PopAndDestroy();
		SetTestStepResult(EFail);
		}

	text.Format(KText(), index);
// convert text into TLV format and append it to allocated buffer
	ret=pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBText, text);
	if(ret != KErrNone)
		{
		CleanupStack::PopAndDestroy();
		SetTestStepResult(EFail);
		}
	PhoneBookStore().Write(status, pbData,index);
	User::WaitForRequest(status);
	TInt r=status.Int();
	INFO_PRINTF2(_L("Write() request status = %d"),r);
	CleanupStack::PopAndDestroy();
	}
Exemple #4
0
Main::Main(sf::RenderWindow & window) : window(window)
{
	playingGame = true;
	
	/*
	Create the language variable (default: American English)
	*/
	l = Language("en-US");

	/*
	Load options from Options.txt
	Current things the program is looking for:
		openFile;
		language	=	[ja-JP]
	*/
	KFile options(sf::String(RESOURCES + "Options.txt"));
	wstring w;
	options.readLine(w);
	l = Language(StringEditor::substring(w, StringEditor::findCharacter(w, L'=', 1) + 1, w.length()));

	/*
	Instantiate the font based off of the game language
	English users don't need the Japanese character set loaded (saves space)
	*/
	font = KText(l);

	/*
	Sets the game state; the final version of the game should have this set to logo screen,
	then goes to the main menu
	*/
	gs = GameState::MAIN_MENU;

	/*
	Loads the game modes.
	Only one variable should be loaded at one point, so we need to figure out how to unload modes
	when you aren't using them. Ie, single player and multiplayer shouldn't be loaded on the stack
	(I don't think I am using that term correctly)
	*/
	mainMenu = MainMenu(l);

	/*
	Create a black background
	*/
	bg.setSize(sf::Vector2f((float)INT_MAX, (float)INT_MAX));
	bg.setFillColor(sf::Color::Black);
	bg.setPosition(sf::Vector2f((float)(INT_MIN / 2), (float)(INT_MIN / 2)));
}
TVerdict CWriteStringStep::doTestStepL()
/**
 * @return - TVerdict code
 * Override of base class pure virtual
 * Our implementation only gets called if the base class doTestStepPreambleL() did
 * not leave. That being the case, the current test result value will be EPass.
 */
	{
	INFO_PRINTF1(_L("This step tests WriteStringToConfig function."));
	SetTestStepResult(EFail);
	
	TPtrC originalValue;
	TBool ret = EFalse;
	
	if(!GetStringFromConfig(ConfigSection(),KTe_RegStepTestSuiteString, originalValue))
		{
		// Leave if there's any error.
		User::Leave(KErrNotFound);
		}

	INFO_PRINTF2(_L("The Original String is %S"), &originalValue); // Block end
	
	RBuf buf;
	buf.Create(originalValue.Length());
	buf.Copy(originalValue);
	
	_LIT(KText,"GoodBye Jason");
	TBufC<16> buf1(KText); 
	TPtrC TheString1(buf1);
	if (WriteStringToConfig(ConfigSection(), KTe_RegStepTestSuiteString, TheString1))
		{
		if (GetStringFromConfig(ConfigSection(), KTe_RegStepTestSuiteString, TheString1) && 0==TheString1.Compare(KText()))
			{
			INFO_PRINTF2(_L("Changed String To %S"),&TheString1); 
			ret = ETrue;
			}
		}
		
	_LIT(KText2,"Hello Jason");
	TBufC<16> buf2(KText2); 
	TPtrC TheString2(buf2);
	
	if (WriteStringToConfig(ConfigSection(), KTe_RegStepTestSuiteString, TheString2))
		{
		if (GetStringFromConfig(ConfigSection(), KTe_RegStepTestSuiteString, TheString2) && 0==TheString2.Compare(KText2()))
			{
			INFO_PRINTF2(_L("Changed String To %S"), &TheString2); 
			}
		}
	else
		{
		ret = EFalse;
		}
	
	if (!WriteStringToConfig(ConfigSection(), KTe_RegStepTestSuiteString, buf))
		{
		ret = EFalse;
		}
	buf.Close();
	
	if (ret)
		{
		SetTestStepResult(EPass);
		}
	
	return TestStepResult();
	}
// ---------------------------------------------------------------------------
// CBasicPinQueryOperation::RunL()
// ---------------------------------------------------------------------------
//
void CBasicPinQueryOperation::RunL()
    {
    TRACE( "CBasicPinQueryOperation::RunL, iStatus.Int()=%d", iStatus.Int() );
    User::LeaveIfError( iStatus.Int() );

    TBool isRetry = ( iPinInput->iOperation & EPINValueIncorrect );
    if( isRetry )
        {
        // Show "Invalid PIN code" error note, as previous attempt was failed.
        // TODO: localized UI string needed
        _LIT( KInvalidPinCode, "Invalid PIN code" );
        ShowWarningNoteL( KInvalidPinCode );
        }

    HBufC* caption = NULL;
    TInt minLength = 0;
    TInt maxLength = 0;
    TInt mode = ESecUiAlphaSupported | ESecUiSecretSupported | ESecUiCancelSupported |
            ESecUiEmergencyNotSupported;
    if( iPinInput->iPIN.iPINLabel == KBasicPinQueryKeyStorePassphrase )
        {
        // "Enter code for phone keystore:"
        minLength = KMinimunAcceptedKeystorePassphraseLength;
        // TODO: localized UI string needed
        _LIT( KText, "Keystore password:"******"Keystore password must be created for using private keys."
        minLength = KMinimunAcceptedKeystorePassphraseLength;
        // SecUi creates two input fields when caption contains two labels
        // separated with a vertical bar. SecUi verifies that user types the
        // same passphrase in both fields.
        // TODO: localized UI strings needed
        _LIT( KText, "Create keystore password:|Verify:" );
        caption = KText().AllocLC();
        }
    else if( iPinInput->iPIN.iPINLabel == KBasicPinQueryImportedKeyFilePassphrase )
        {
        // "Enter code for imported key:"
        // TODO: localized UI strings needed
        _LIT( KText, "Enter code for imported key:|Verify:" );
        caption = KText().AllocLC();
        }
    else if( iPinInput->iPIN.iPINLabel == KBasicPinQueryExportedKeyFilePassphrase )
        {
        // "Enter new code for exported key:"
        // TODO: localized UI strings needed
        _LIT( KText, "Enter new code for exported key:|Verify:" );
        caption = KText().AllocLC();
        }
    else if( iPinInput->iPIN.iPINLabel == KBasicPinQueryPKCS12 )
        {
        // "Password for %U:", PKCS#12 password query prompt
        // TODO: localized UI string needed
        _LIT( KText, "Password for PKCS#12 file:" );
        caption = KText().AllocLC();
        }
    else
        {
        // "Enter code for %0U in %1U"
        // Data query for PIN request in keystore where %0U is the PIN's name %1U is the keystore's name.
        // TODO: EEnterPinNR
        caption = iPinInput->iPIN.iPINLabel.AllocLC();
        }

    ASSERT( iQueryUi == NULL );
    iQueryUi = CSecQueryUi::NewL();
    TInt resultCode = iQueryUi->SecQueryDialog( *caption, iPinValue, minLength, maxLength, mode );
    ReturnResultL( resultCode );

    if( caption )
        {
        CleanupStack::PopAndDestroy( caption );
        caption = NULL;
        }
    }