mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-1880 use InltTest:loadTestData static method for data loading consistency
X-SVN-Rev: 8889
This commit is contained in:
parent
c109642873
commit
cd14071b07
2 changed files with 2 additions and 52 deletions
|
@ -153,7 +153,8 @@ RBTestDataModule::getTestBundle(const char* bundleName, UErrorCode &status)
|
|||
{
|
||||
if(U_SUCCESS(status)) {
|
||||
UResourceBundle *testBundle = NULL;
|
||||
const char* icu_data = (char*)loadTestData(status);
|
||||
//const char* icu_data = (char*)loadTestData(status);
|
||||
const char* icu_data = IntlTest::loadTestData(status);
|
||||
if (testBundle == NULL) {
|
||||
testBundle = ures_openDirect(icu_data, bundleName, &status);
|
||||
if (status != U_ZERO_ERROR) {
|
||||
|
@ -167,53 +168,3 @@ RBTestDataModule::getTestBundle(const char* bundleName, UErrorCode &status)
|
|||
}
|
||||
}
|
||||
|
||||
const char*
|
||||
RBTestDataModule::loadTestData(UErrorCode& err){
|
||||
const char* directory=NULL;
|
||||
UResourceBundle* test =NULL;
|
||||
const char* tdrelativepath = ".."U_FILE_SEP_STRING"test"U_FILE_SEP_STRING"testdata"U_FILE_SEP_STRING"out"U_FILE_SEP_STRING;
|
||||
if( tdpath == NULL){
|
||||
directory= u_getDataDirectory();
|
||||
|
||||
tdpath = (char*) uprv_malloc(sizeof(char) *(( strlen(directory) * strlen(tdrelativepath)) + 10));
|
||||
|
||||
|
||||
/* u_getDataDirectory shoul return \source\data ... set the
|
||||
* directory to ..\source\data\..\test\testdata\out\testdata
|
||||
*
|
||||
* Fallback: When Memory mapped file is built
|
||||
* ..\source\data\out\..\..\test\testdata\out\testdata
|
||||
*/
|
||||
strcpy(tdpath, directory);
|
||||
strcat(tdpath, tdrelativepath);
|
||||
strcat(tdpath,"testdata");
|
||||
|
||||
|
||||
test=ures_open(tdpath, "testtypes", &err);
|
||||
|
||||
/* we could not find the data in tdpath
|
||||
* try tdpathFallback
|
||||
*/
|
||||
if(U_FAILURE(err))
|
||||
{
|
||||
strcpy(tdpath,directory);
|
||||
strcat(tdpath,".."U_FILE_SEP_STRING);
|
||||
strcat(tdpath, tdrelativepath);
|
||||
strcat(tdpath,"testdata");
|
||||
err =U_ZERO_ERROR;
|
||||
test=ures_open(tdpath, "ja_data", &err);
|
||||
/* Fall back did not succeed either so return */
|
||||
if(U_FAILURE(err)){
|
||||
err = U_FILE_ACCESS_ERROR;
|
||||
log.errln("construction of NULL did not succeed : %s \n", u_errorName(err));
|
||||
return "";
|
||||
}
|
||||
ures_close(test);
|
||||
return tdpath;
|
||||
}
|
||||
ures_close(test);
|
||||
return tdpath;
|
||||
}
|
||||
return tdpath;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,6 @@ public:
|
|||
|
||||
private:
|
||||
UResourceBundle *getTestBundle(const char* bundleName, UErrorCode &status);
|
||||
const char* loadTestData(UErrorCode& err);
|
||||
|
||||
private:
|
||||
UResourceBundle *fModuleBundle;
|
||||
|
|
Loading…
Add table
Reference in a new issue