Пример #1
0
void TestDocFileformfield::TestTranslateBinaryProperty()
{
    CStdString expectedName(_T("Text1"));
    RTFfile theFile(new RTFFileContext);
    AutoDocFileReaderImpl4Tests reader(DEFAULT_FORMTEXT_FILE, &theFile);
    reader.Initialize();

    WordParserInfo wpi(&reader);

    WrdFormFieldBinaryData data;
    WrdEshRoot root;
    data.setCP(11);
    wpi.m_Reader.read(data);

    CQuickBuildString conversionResult = _T("");
    RTFFileContext context;
    DocFileFormField docFileFormField(&context);
    assertTest(docFileFormField.TranslateBinaryProperty(conversionResult , data.getFieldNameDataReference()));

    std::strstream msg;
    msg << _T("Expected [") << expectedName << _T("], but the received [") << conversionResult << _T("]") << std::ends;
    assertMessage(expectedName == conversionResult, CStdString(msg.str()));
}
Пример #2
0
TVerdict RRamPluginLoadTest::DoTestStepL()
	{
	TVerdict result = EPass;
#ifndef __WINSCW__
	TBuf<KMaxFileName*2> dllNames(KOriginalDllOnZ);
	TBuf<KMaxFileName*2> rscNames(KOriginalRscFileOnZ);

	dllNames.Append(KSeparator);
	dllNames.Append(KMovedDllOnC);
	rscNames.Append(KSeparator);
	rscNames.Append(KMovedRscFileOnC);
	TBufC<KMaxProcessNameLength> copyProcess(KProcessFileManCopyFile);

	// launch copyfile.exe to copy plugin from z: to c:
	TRAPD(ret, LaunchProcessL(copyProcess, dllNames));
	if(ret == KErrNone)
		{
		INFO_PRINTF1(_L("Succesfully copied dll"));
		}
	else
		{
		INFO_PRINTF2(_L("Copying dll failed with %d"), ret);
		result = EFail;
		return result;
		}
	TRAP(ret, LaunchProcessL(copyProcess, rscNames));
	if(ret == KErrNone)
		{
		INFO_PRINTF1(_L("Succesfully copied rsc file"));
		}
	else
		{
		INFO_PRINTF2(_L("Copying rsc file failed with %d"), ret);
		result = EFail;
		return result;
		}

	User::After(KWaitThreeSeconds); // Wait for ECom to re-scan drives so it can pick up new plugin now on c:
#endif
	_LIT(KRamPluginDisplayName, "Ram ECam Plugin");
	TBufC<15> expectedName(KRamPluginDisplayName);

	TBool pluginFound = EFalse;
	TInt error = KErrNone;

	INFO_PRINTF1(_L("Listing available plugins using REComSession::ListImplementationsL()..."));
	TUid interfaceUid = {KUidOnboardCameraPlugin};
	TEComResolverParams resolverParams;
	resolverParams.SetDataType(KECamPluginMatchString);
	RImplInfoPtrArray pluginArray;

	TRAP(error, REComSession::ListImplementationsL(interfaceUid, resolverParams, pluginArray));	
	if (error != KErrNone)
		{
		INFO_PRINTF2(_L("ListImplementationsL() failed - %d"), error);
		result = EFail;
		return result;
		}
	else
		{
		pluginArray.Sort(VersionLinearOrderFunction);
		for (TInt i = 0; i < pluginArray.Count(); ++i)
			{
			TBuf<2> drive;
			drive = pluginArray[i]->Drive().Name();
			INFO_PRINTF3(_L("%S located on drive %S"), &(pluginArray[i]->DisplayName()), &(drive));
			if((pluginArray[i]->DisplayName() == expectedName) && (pluginArray[i]->Drive() == 2))
				{
				pluginFound = ETrue;
				}
			}
		pluginArray.Close();

		if(!pluginFound)
			{
			INFO_PRINTF1(_L("REComSession::ListImplementationsL() could not find plugin in RAM"));
			}
		}

	INFO_PRINTF1(_L("Checking if CCamera::New2L() can successfully load plugin residing in RAM"));
	MCameraObserver2* observer2 = NULL;
	TRAP(error, CCamera* camera = CCamera::New2L(*observer2, 0, 0));
#ifdef _DEBUG
	if(error == KErrNone)
		{
		INFO_PRINTF1(_L("UDEB mode: Expected behaviour - successfully loaded plugin"));
		}
	else
		{
		INFO_PRINTF2(_L("UDEB mode: Unexpected behaviour - could not load plugin, error = %d"), error);
		result = EFail;
		}
#else
	if (error == KErrNone)
		{
		INFO_PRINTF1(_L("UREL mode: Unexpected behaviour - successfully loaded plugin"));
		result = EFail;
		}
	else
		{
		INFO_PRINTF2(_L("UREL mode: Expected behaviour - could not load plugin, error = %d"), error);
		}
#endif

	return result;
	}
Пример #3
0
void testCloneParticleFixedAttributes(Partio::ParticlesData* other, int& test)
{
    Partio::ParticlesData* p=Partio::cloneSchema(*other);

    int numFixedAttributes = p->numFixedAttributes();
    if (numFixedAttributes == 3) {
        std::cout << "ok " << test++
                  << " - Partio::cloneSchema() numFixedAttributes()" << std::endl;
    } else {
        std::cerr << "not ok " << test++
                  << " - Partio::cloneSchema() fixed attribute count is "
                  << numFixedAttributes << ", expected 3" << std::endl;
        exit(EXIT_FAILURE);
    }

    std::vector<std::string> expectedName(numFixedAttributes);
    std::vector<Partio::ParticleAttributeType> expectedType(numFixedAttributes);
    std::vector<int> expectedCount(numFixedAttributes);

    expectedName[0] = "origin";
    expectedType[0] = Partio::VECTOR;
    expectedCount[0] = 3;

    expectedName[1] = "uv";
    expectedType[1] = Partio::FLOAT;
    expectedCount[1] = 2;

    expectedName[2] = "sid";
    expectedType[2] = Partio::INT;
    expectedCount[2] = 1;

    // Test attributes
    for (int i=0;i<numFixedAttributes;++i) {
        Partio::FixedAttribute attr;
        p->fixedAttributeInfo(i,attr);

        if (attr.name == expectedName[i]) {
            std::cout << "ok " << test++
                      << " - Partio::cloneSchema() fixed attribute name for "
                      << attr.name << std::endl;
        } else {
            std::cerr << "not ok " << test++
                      << " - Partio::cloneSchema() fixed attribute name is "
                      << attr.name << ", expected " << expectedName[i] << std::endl;
            exit(EXIT_FAILURE);
        }

        if (attr.type == expectedType[i]) {
            std::cout << "ok " << test++
                      << " - Partio::cloneSchema() fixed attribute type for "
                      << attr.name << std::endl;
        } else {
            std::cerr << "not ok " << test++
                      << " - Partio::cloneSchema() fixed attribute type for "
                      << attr.name << ", expected "
                      << expectedType[i] << ", got " << attr.type << std::endl;
        }

        if (attr.count == expectedCount[i]) {
            std::cout << "ok " << test++
                      << " - Partio::cloneSchema() fixed attribute count for "
                      << attr.name << std::endl;
        } else {
            std::cerr << "not ok " << test++
                      << " - Partio::cloneSchema() fixed attribute count for "
                      << attr.name << ", expected "
                      << expectedCount[i] << ", got " << attr.count << std::endl;
        }
    }

    p->release();
}