am 3a41528c: Merge "Fix testCharacterTableIsPresent to use BinaryDictUtils.getDictFile"

* commit '3a41528cbe4dbca8781b63457e49c78a78285338':
  Fix testCharacterTableIsPresent to use BinaryDictUtils.getDictFile
main
Ken Wakasa 2014-10-03 12:07:59 +00:00 committed by Android Git Automerger
commit fd1233f81c
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);