Fix testCharacterTableIsPresent to use BinaryDictUtils.getDictFile
Bug:17097992 Change-Id: Ic26c95fccb63d592883f85fe34f4570f1861b8c3main
parent
71f9b8d50b
commit
6164f1fcb9
|
@ -311,7 +311,8 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
|
||||||
final String dictName = "codePointTableTest";
|
final String dictName = "codePointTableTest";
|
||||||
final String dictVersion = Long.toString(System.currentTimeMillis());
|
final String dictVersion = Long.toString(System.currentTimeMillis());
|
||||||
final String codePointTableAttribute = DictionaryHeader.CODE_POINT_TABLE_KEY;
|
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
|
// Write a test dictionary
|
||||||
final DictEncoder dictEncoder = new Ver2DictEncoder(file,
|
final DictEncoder dictEncoder = new Ver2DictEncoder(file,
|
||||||
|
|
|
@ -30,6 +30,8 @@ public class BinaryDictUtils {
|
||||||
|
|
||||||
public static final FormatSpec.FormatOptions VERSION2_OPTIONS =
|
public static final FormatSpec.FormatOptions VERSION2_OPTIONS =
|
||||||
new FormatSpec.FormatOptions(FormatSpec.VERSION2);
|
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 =
|
public static final FormatSpec.FormatOptions VERSION4_OPTIONS_WITHOUT_TIMESTAMP =
|
||||||
new FormatSpec.FormatOptions(FormatSpec.VERSION4, false /* hasTimestamp */);
|
new FormatSpec.FormatOptions(FormatSpec.VERSION4, false /* hasTimestamp */);
|
||||||
public static final FormatSpec.FormatOptions VERSION4_OPTIONS_WITH_TIMESTAMP =
|
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,
|
public static File getDictFile(final String name, final String version,
|
||||||
final FormatOptions formatOptions, final File directory) {
|
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);
|
return new File(directory, name + "." + version + TEST_DICT_FILE_EXTENSION);
|
||||||
} else if (formatOptions.mVersion == FormatSpec.VERSION4) {
|
} else if (formatOptions.mVersion == FormatSpec.VERSION4) {
|
||||||
return new File(directory, name + "." + version);
|
return new File(directory, name + "." + version);
|
||||||
|
|
Loading…
Reference in New Issue