Fix testCharacterTableIsPresent to use BinaryDictUtils.getDictFile

Bug:17097992
Change-Id: Ic26c95fccb63d592883f85fe34f4570f1861b8c3
This commit is contained in:
Akifumi Yoshimoto 2014-10-03 19:49:44 +09:00
parent 71f9b8d50b
commit 6164f1fcb9
2 changed files with 6 additions and 2 deletions

View File

@ -311,7 +311,8 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
final String dictName = "codePointTableTest";
final String dictVersion = Long.toString(System.currentTimeMillis());
final String codePointTableAttribute = DictionaryHeader.CODE_POINT_TABLE_KEY;
final File file = new File(dictName);
final File file = BinaryDictUtils.getDictFile(dictName, dictVersion,
BinaryDictUtils.VERSION201_OPTIONS, getContext().getCacheDir());
// Write a test dictionary
final DictEncoder dictEncoder = new Ver2DictEncoder(file,

View File

@ -30,6 +30,8 @@ public class BinaryDictUtils {
public static final FormatSpec.FormatOptions VERSION2_OPTIONS =
new FormatSpec.FormatOptions(FormatSpec.VERSION2);
public static final FormatSpec.FormatOptions VERSION201_OPTIONS =
new FormatSpec.FormatOptions(FormatSpec.VERSION201);
public static final FormatSpec.FormatOptions VERSION4_OPTIONS_WITHOUT_TIMESTAMP =
new FormatSpec.FormatOptions(FormatSpec.VERSION4, false /* hasTimestamp */);
public static final FormatSpec.FormatOptions VERSION4_OPTIONS_WITH_TIMESTAMP =
@ -52,7 +54,8 @@ public class BinaryDictUtils {
public static File getDictFile(final String name, final String version,
final FormatOptions formatOptions, final File directory) {
if (formatOptions.mVersion == FormatSpec.VERSION2) {
if (formatOptions.mVersion == FormatSpec.VERSION2
|| formatOptions.mVersion == FormatSpec.VERSION201) {
return new File(directory, name + "." + version + TEST_DICT_FILE_EXTENSION);
} else if (formatOptions.mVersion == FormatSpec.VERSION4) {
return new File(directory, name + "." + version);