TVerdict CEglTest_LocalTestStep_EndpointApiExposure::doTestStepL() { //First, test the local side. //temp solution. We probably want an Egl helper class for the local side too. eglInitialize(eglGetDisplay(EGL_DEFAULT_DISPLAY), NULL, NULL); //Check that the extension does not exist in the egl implementation. TPtrC8 extensionString((TUint8*)eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS)); _LIT8(KExtensionName, "EGL_NOK_image_endpoint"); if(extensionString.Find(KExtensionName) != KErrNotFound) { ERR_PRINTF1(_L("Incorrect result for extensionString")); INFO_PRINTF1(_L("Rest of test is being skipped due to failure.")); eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY)); SetTestStepResult(EFail); return TestStepResult(); } else { INFO_PRINTF1(_L("Correct result for extensionString")); } //If this function leaves, a function pointer was returned from EGL. //Since we are outside wserv, we expect EGL never to advertise the existance //of the Endpoint API. TRAPD(err, AttemptToGetProcAddressForAllEndpointFunctionsL()); if(err != KErrNone) { INFO_PRINTF1(_L("Rest of test is being skipped due to failure.")); eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY)); SetTestStepResult(EFail); return TestStepResult(); } eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY)); //Now test remote side. //Params for the remote test step. TRemoteTestParams params; //Run the test step and return the result. StartRemoteTestStep(TRemoteTestParams()); RunRemoteTestCase(0, params); EndRemoteTestStep(TRemoteTestParams()); return TestStepResult(); }
std::string FixFilePath(const char* fileName, const char* basePath, const char* extension) { if ( !g_Files->Exists(fileName) ) { std::string fileNameString(fileName); std::string basePathString(basePath); std::string extensionString(extension); if (fileNameString.substr( 0, basePathString.length() ) != basePathString) fileNameString = basePathString + fileNameString; if (g_Files->GetExt(fileName) == "") fileNameString.append(extensionString); return fileNameString; } return std::string(fileName); }
TrackSupplier* FilePlaylistItem::CreateTrackSupplier() const { MediaFileTrackSupplier* supplier = new(std::nothrow) MediaFileTrackSupplier(); if (supplier == NULL) return NULL; for (vector<entry_ref>::size_type i = 0; i < fRefs.size(); i++) { BMediaFile* mediaFile = new(std::nothrow) BMediaFile(&fRefs[i]); if (mediaFile == NULL) { delete supplier; return NULL; } if (supplier->AddMediaFile(mediaFile) != B_OK) delete mediaFile; } for (vector<entry_ref>::size_type i = 0; i < fImageRefs.size(); i++) { BBitmap* bitmap = BTranslationUtils::GetBitmap(&fImageRefs[i]); if (bitmap == NULL) continue; if (supplier->AddBitmap(bitmap) != B_OK) delete bitmap; } // Search for subtitle files in the same folder // TODO: Error checking BEntry entry(&fRefs[0], true); char originalName[B_FILE_NAME_LENGTH]; entry.GetName(originalName); BString nameWithoutExtension(originalName); int32 extension = nameWithoutExtension.FindLast('.'); if (extension > 0) nameWithoutExtension.Truncate(extension); BPath path; entry.GetPath(&path); path.GetParent(&path); BDirectory directory(path.Path()); while (directory.GetNextEntry(&entry) == B_OK) { char name[B_FILE_NAME_LENGTH]; if (entry.GetName(name) != B_OK) continue; BString nameString(name); if (nameString == originalName) continue; if (nameString.IFindFirst(nameWithoutExtension) < 0) continue; BFile file(&entry, B_READ_ONLY); if (file.InitCheck() != B_OK) continue; int32 pos = nameString.FindLast('.'); if (pos < 0) continue; BString extensionString(nameString.String() + pos + 1); extensionString.ToLower(); BString language = "default"; if (pos > 1) { int32 end = pos; while (pos > 0 && *(nameString.String() + pos - 1) != '.') pos--; language.SetTo(nameString.String() + pos, end - pos); } if (extensionString == "srt") { SubTitles* subTitles = new(std::nothrow) SubTitlesSRT(&file, language.String()); if (subTitles != NULL && !supplier->AddSubTitles(subTitles)) delete subTitles; } } return supplier; }