am 746f94c6: Add ZWNJ_ZWJ_KEY for keyboard layout test

* commit '746f94c671607521f66fd3c989072b5ec7c390c4':
  Add ZWNJ_ZWJ_KEY for keyboard layout test
This commit is contained in:
Tadashi G. Takaoka 2014-03-14 00:55:38 -07:00 committed by Android Git Automerger
commit fbff6198e1
6 changed files with 213 additions and 183 deletions

View file

@ -145,6 +145,16 @@ public abstract class LayoutBase extends AbstractLayoutBase {
return isPhone ? EMPTY_KEYS : joinKeys(EXCLAMATION_AND_QUESTION_MARKS, SHIFT_KEY); return isPhone ? EMPTY_KEYS : joinKeys(EXCLAMATION_AND_QUESTION_MARKS, SHIFT_KEY);
} }
/**
* Get the space keys.
* @param isPhone true if requesting phone's keys.
* @return the array of {@link ExpectedKey} that should be placed at the center of the
* keyboard.
*/
public ExpectedKey[] getSpaceKeys(final boolean isPhone) {
return joinKeys(SPACE_KEY);
}
/** /**
* Get the keys left to the spacebar. * Get the keys left to the spacebar.
* @param isPhone true if requesting phone's keys. * @param isPhone true if requesting phone's keys.
@ -232,6 +242,10 @@ public abstract class LayoutBase extends AbstractLayoutBase {
KeyboardIconsSet.NAME_SHIFT_KEY); KeyboardIconsSet.NAME_SHIFT_KEY);
private static final int ICON_SHIFTED_SHIFT = KeyboardIconsSet.getIconId( private static final int ICON_SHIFTED_SHIFT = KeyboardIconsSet.getIconId(
KeyboardIconsSet.NAME_SHIFT_KEY_SHIFTED); KeyboardIconsSet.NAME_SHIFT_KEY_SHIFTED);
private static final int ICON_ZWNJ = KeyboardIconsSet.getIconId(
KeyboardIconsSet.NAME_ZWNJ_KEY);
private static final int ICON_ZWJ = KeyboardIconsSet.getIconId(
KeyboardIconsSet.NAME_ZWJ_KEY);
// Functional key. // Functional key.
static final ExpectedKey CAPSLOCK_MORE_KEY = key(" ", Constants.CODE_CAPSLOCK); static final ExpectedKey CAPSLOCK_MORE_KEY = key(" ", Constants.CODE_CAPSLOCK);
@ -249,7 +263,9 @@ public abstract class LayoutBase extends AbstractLayoutBase {
// U+00BF: "¿" INVERTED QUESTION MARK // U+00BF: "¿" INVERTED QUESTION MARK
static final ExpectedKey[] EXCLAMATION_AND_QUESTION_MARKS = joinKeys( static final ExpectedKey[] EXCLAMATION_AND_QUESTION_MARKS = joinKeys(
key("!", moreKey("\u00A1")), key("?", moreKey("\u00BF"))); key("!", moreKey("\u00A1")), key("?", moreKey("\u00BF")));
// U+200C: ZERO WIDTH NON-JOINER
// U+200D: ZERO WIDTH JOINER
static final ExpectedKey ZWNJ_ZWJ_KEY = key(ICON_ZWNJ, "\u200C", moreKey(ICON_ZWJ, "\u200D"));
// Punctuation more keys for phone form factor. // Punctuation more keys for phone form factor.
public static final ExpectedKey[] PHONE_PUNCTUATION_MORE_KEYS = joinKeys( public static final ExpectedKey[] PHONE_PUNCTUATION_MORE_KEYS = joinKeys(
@ -273,7 +289,7 @@ public abstract class LayoutBase extends AbstractLayoutBase {
final LayoutCustomizer customizer = getCustomizer(); final LayoutCustomizer customizer = getCustomizer();
final ExpectedKey[] spacebar = joinKeys( final ExpectedKey[] spacebar = joinKeys(
customizer.getKeysLeftToSpacebar(isPhone), customizer.getKeysLeftToSpacebar(isPhone),
SPACEBAR, customizer.getSpaceKeys(isPhone),
customizer.getKeysRightToSpacebar(isPhone)); customizer.getKeysRightToSpacebar(isPhone));
builder.setKeysOfRow(4, spacebar); builder.setKeysOfRow(4, spacebar);
if (isPhone) { if (isPhone) {

View file

@ -32,13 +32,28 @@ public class Symbols extends AbstractLayoutBase {
} }
public ExpectedKey[][] getLayout(final boolean isPhone) { public ExpectedKey[][] getLayout(final boolean isPhone) {
final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(isPhone final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(SYMBOLS_COMMON);
? toPhoneSymbol(SYMBOLS_COMMON) : toTabletSymbols(SYMBOLS_COMMON)); final LayoutCustomizer customizer = mCustomizer;
builder.replaceKeyOfLabel(CURRENCY, mCustomizer.getCurrencyKey()); builder.replaceKeyOfLabel(CURRENCY, customizer.getCurrencyKey());
builder.replaceKeyOfLabel(DOUBLE_QUOTE, key("\"", joinKeys( builder.replaceKeyOfLabel(DOUBLE_QUOTE, key("\"", joinMoreKeys(
mCustomizer.getDoubleQuoteMoreKeys(), mCustomizer.getDoubleAngleQuoteKeys()))); customizer.getDoubleQuoteMoreKeys(), customizer.getDoubleAngleQuoteKeys())));
builder.replaceKeyOfLabel(SINGLE_QUOTE, key("'", joinKeys( builder.replaceKeyOfLabel(SINGLE_QUOTE, key("'", joinMoreKeys(
mCustomizer.getSingleQuoteMoreKeys(), mCustomizer.getSingleAngleQuoteKeys()))); customizer.getSingleQuoteMoreKeys(), customizer.getSingleAngleQuoteKeys())));
if (isPhone) {
builder.addKeysOnTheLeftOfRow(3, customizer.getSymbolsShiftKey(isPhone))
.addKeysOnTheRightOfRow(3, DELETE_KEY)
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
.addKeysOnTheRightOfRow(4, key(ENTER_KEY, EMOJI_KEY));
} else {
// Tablet symbols keyboard has extra two keys at the left edge of the 3rd row.
builder.addKeysOnTheLeftOfRow(3, joinKeys("\\", "="));
builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
.addKeysOnTheRightOfRow(2, ENTER_KEY)
.addKeysOnTheLeftOfRow(3, customizer.getSymbolsShiftKey(isPhone))
.addKeysOnTheRightOfRow(3, customizer.getSymbolsShiftKey(isPhone))
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
.addKeysOnTheRightOfRow(4, EMOJI_KEY);
}
return builder.build(); return builder.build();
} }
@ -100,76 +115,61 @@ public class Symbols extends AbstractLayoutBase {
// Common symbols keyboard layout. // Common symbols keyboard layout.
private static final ExpectedKey[][] SYMBOLS_COMMON = new ExpectedKeyboardBuilder(10, 9, 7, 5) private static final ExpectedKey[][] SYMBOLS_COMMON = new ExpectedKeyboardBuilder(10, 9, 7, 5)
.setLabelsOfRow(1, "1", "2", "3", "4", "5", "6", "7", "8", "9", "0") .setKeysOfRow(1,
// U+00B9: "¹" SUPERSCRIPT ONE // U+00B9: "¹" SUPERSCRIPT ONE
// U+00BD: "½" VULGAR FRACTION ONE HALF // U+00BD: "½" VULGAR FRACTION ONE HALF
// U+2153: "" VULGAR FRACTION ONE THIRD // U+2153: "" VULGAR FRACTION ONE THIRD
// U+00BC: "¼" VULGAR FRACTION ONE QUARTER // U+00BC: "¼" VULGAR FRACTION ONE QUARTER
// U+215B: "" VULGAR FRACTION ONE EIGHTH // U+215B: "" VULGAR FRACTION ONE EIGHTH
.setMoreKeysOf("1", "\u00B9", "\u00BD", "\u2153", "\u00BC", "\u215B") key("1", joinMoreKeys("\u00B9", "\u00BD", "\u2153", "\u00BC", "\u215B")),
// U+00B2: "²" SUPERSCRIPT TWO // U+00B2: "²" SUPERSCRIPT TWO
// U+2154: "" VULGAR FRACTION TWO THIRDS // U+2154: "" VULGAR FRACTION TWO THIRDS
.setMoreKeysOf("2", "\u00B2", "\u2154") key("2", joinMoreKeys("\u00B2", "\u2154")),
// U+00B3: "³" SUPERSCRIPT THREE // U+00B3: "³" SUPERSCRIPT THREE
// U+00BE: "¾" VULGAR FRACTION THREE QUARTERS // U+00BE: "¾" VULGAR FRACTION THREE QUARTERS
// U+215C: "" VULGAR FRACTION THREE EIGHTHS // U+215C: "" VULGAR FRACTION THREE EIGHTHS
.setMoreKeysOf("3", "\u00B3", "\u00BE", "\u215C") key("3", joinMoreKeys("\u00B3", "\u00BE", "\u215C")),
// U+2074: "" SUPERSCRIPT FOUR // U+2074: "" SUPERSCRIPT FOUR
.setMoreKeysOf("4", "\u2074") key("4", moreKey("\u2074")),
// U+215D: "" VULGAR FRACTION FIVE EIGHTHS // U+215D: "" VULGAR FRACTION FIVE EIGHTHS
.setMoreKeysOf("5", "\u215D") key("5", moreKey("\u215D")),
// U+215E: "" VULGAR FRACTION SEVEN EIGHTHS key("6"),
.setMoreKeysOf("7", "\u215E") // U+215E: "" VULGAR FRACTION SEVEN EIGHTHS
// U+207F: "" SUPERSCRIPT LATIN SMALL LETTER N key("7", moreKey("\u215E")),
// U+2205: "" EMPTY SET key("8"),
.setMoreKeysOf("0", "\u207F", "\u2205") key("9"),
.setLabelsOfRow(2, "@", "#", CURRENCY, "%", "&", "-", "+", "(", ")") // U+207F: "" SUPERSCRIPT LATIN SMALL LETTER N
// U+2030: "" PER MILLE SIGN // U+2205: "" EMPTY SET
.setMoreKeysOf("%", "\u2030") key("0", joinMoreKeys("\u207F", "\u2205")))
// U+2013: "" EN DASH .setKeysOfRow(2,
// U+2014: "" EM DASH key("@"), key("#"), key(CURRENCY),
// U+00B7: "·" MIDDLE DOT // U+2030: "" PER MILLE SIGN
.setMoreKeysOf("-", "_", "\u2013", "\u2014", "\u00B7") key("%", moreKey("\u2030")),
// U+00B1: "±" PLUS-MINUS SIGN key("&"),
.setMoreKeysOf("+", "\u00B1") // U+2013: "" EN DASH
.setMoreKeysOf("(", "<", "{", "[") // U+2014: "" EM DASH
.setMoreKeysOf(")", ">", "}", "]") // U+00B7: "·" MIDDLE DOT
.setLabelsOfRow(3, "*", DOUBLE_QUOTE, SINGLE_QUOTE, ":", ";", "!", "?") key("-", joinMoreKeys("_", "\u2013", "\u2014", "\u00B7")),
// U+2020: "" DAGGER // U+00B1: "±" PLUS-MINUS SIGN
// U+2021: "" DOUBLE DAGGER key("+", moreKey("\u00B1")),
// U+2605: "" BLACK STAR key("(", joinMoreKeys("<", "{", "[")),
.setMoreKeysOf("*", "\u2020", "\u2021", "\u2605") key(")", joinMoreKeys(">", "}", "]")))
// U+00A1: "¡" INVERTED EXCLAMATION MARK .setKeysOfRow(3,
.setMoreKeysOf("!", "\u00A1") // U+2020: "" DAGGER
// U+00BF: "¿" INVERTED QUESTION MARK // U+2021: "" DOUBLE DAGGER
.setMoreKeysOf("?", "\u00BF") // U+2605: "" BLACK STAR
.setLabelsOfRow(4, "_", "/", " ", ",", ".") key("*", joinMoreKeys("\u2020", "\u2021", "\u2605")),
// U+2026: "" HORIZONTAL ELLIPSIS key(DOUBLE_QUOTE), key(SINGLE_QUOTE), key(":"), key(";"),
.setMoreKeysOf(".", "\u2026") // U+00A1: "¡" INVERTED EXCLAMATION MARK
key("!", moreKey("\u00A1")),
// U+00BF: "¿" INVERTED QUESTION MARK
key("?", moreKey("\u00BF")))
.setKeysOfRow(4,
key("_"), key("/"), SPACE_KEY, key(","),
// U+2026: "" HORIZONTAL ELLIPSIS
key(".", moreKey("\u2026")))
.build(); .build();
private ExpectedKey[][] toPhoneSymbol(final ExpectedKey[][] common) {
return new ExpectedKeyboardBuilder(common)
.addKeysOnTheLeftOfRow(3, mCustomizer.getSymbolsShiftKey(true /* isPhone */))
.addKeysOnTheRightOfRow(3, DELETE_KEY)
.addKeysOnTheLeftOfRow(4, mCustomizer.getAlphabetKey())
.addKeysOnTheRightOfRow(4, key(ENTER_KEY, EMOJI_KEY))
.build();
}
private ExpectedKey[][] toTabletSymbols(final ExpectedKey[][] common) {
return new ExpectedKeyboardBuilder(common)
.addKeysOnTheLeftOfRow(3,
key("\\"), key("="))
.addKeysOnTheRightOfRow(1, DELETE_KEY)
.addKeysOnTheRightOfRow(2, ENTER_KEY)
.addKeysOnTheLeftOfRow(3, mCustomizer.getSymbolsShiftKey(false /* isPhone */))
.addKeysOnTheRightOfRow(3, mCustomizer.getSymbolsShiftKey(false /* isPhone */))
.addKeysOnTheLeftOfRow(4, mCustomizer.getAlphabetKey())
.addKeysOnTheRightOfRow(4, EMOJI_KEY)
.build();
}
public static class RtlSymbols extends Symbols { public static class RtlSymbols extends Symbols {
public RtlSymbols(final LayoutCustomizer customizer) { public RtlSymbols(final LayoutCustomizer customizer) {
super(customizer); super(customizer);

View file

@ -32,10 +32,26 @@ public class SymbolsShifted extends AbstractLayoutBase {
} }
public ExpectedKey[][] getLayout(final boolean isPhone) { public ExpectedKey[][] getLayout(final boolean isPhone) {
final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(isPhone final ExpectedKeyboardBuilder builder = new ExpectedKeyboardBuilder(SYMBOLS_SHIFTED_COMMON);
? toPhoneSymbolsShifted(SYMBOLS_SHIFTED_COMMON) final LayoutCustomizer customizer = mCustomizer;
: toTabletSymbolsShifted(SYMBOLS_SHIFTED_COMMON)); builder.replaceKeyOfLabel(OTHER_CURRENCIES, customizer.getOtherCurrencyKeys());
builder.replaceKeyOfLabel(OTHER_CURRENCIES, mCustomizer.getOtherCurrencyKeys()); if (isPhone) {
builder.addKeysOnTheLeftOfRow(3, customizer.getBackToSymbolsKey())
.addKeysOnTheRightOfRow(3, DELETE_KEY)
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
.addKeysOnTheRightOfRow(4, key(ENTER_KEY, EMOJI_KEY));
} else {
// Tablet symbols shifted keyboard has extra two keys at the right edge of the 3rd row.
// U+00BF: "¿" INVERTED QUESTION MARK
// U+00A1: "¡" INVERTED EXCLAMATION MARK
builder.addKeysOnTheRightOfRow(3, joinKeys("\u00A1", "\u00BF"));
builder.addKeysOnTheRightOfRow(1, DELETE_KEY)
.addKeysOnTheRightOfRow(2, ENTER_KEY)
.addKeysOnTheLeftOfRow(3, customizer.getBackToSymbolsKey())
.addKeysOnTheRightOfRow(3, customizer.getBackToSymbolsKey())
.addKeysOnTheLeftOfRow(4, customizer.getAlphabetKey())
.addKeysOnTheRightOfRow(4, EMOJI_KEY);
}
return builder.build(); return builder.build();
} }
@ -54,92 +70,71 @@ public class SymbolsShifted extends AbstractLayoutBase {
}; };
// Common symbols shifted keyboard layout. // Common symbols shifted keyboard layout.
private static final ExpectedKey[][] SYMBOLS_SHIFTED_COMMON = private static final ExpectedKey[][] SYMBOLS_SHIFTED_COMMON = new ExpectedKeyboardBuilder(
new ExpectedKeyboardBuilder(10, 1 /* other_currencies */ + 5, 7, 5) 10, 1 /* other_currencies */+ 5, 7, 5)
// U+0060: "`" GRAVE ACCENT .setKeysOfRow(1,
// U+2022: "" BULLET key("~"),
// U+221A: "" SQUARE ROOT // U+0060: "`" GRAVE ACCENT
// U+03C0: "π" GREEK SMALL LETTER PI key("\u0060"),
// U+00F7: "÷" DIVISION SIGN key("|"),
// U+00D7: "×" MULTIPLICATION SIGN // U+2022: "" BULLET
// U+00B6: "" PILCROW SIGN // U+266A: "" EIGHTH NOTE
// U+2206: "" INCREMENT // U+2665: "" BLACK HEART SUIT
.setLabelsOfRow(1, // U+2660: "" BLACK SPADE SUIT
"~", "\u0060", "|", "\u2022", "\u221A", // U+2666: "" BLACK DIAMOND SUIT
"\u03C0", "\u00F7", "\u00D7", "\u00B6", "\u2206") // U+2663: "" BLACK CLUB SUIT
// U+2022: "" BULLET key("\u2022", joinMoreKeys("\u266A", "\u2665", "\u2660", "\u2666", "\u2663")),
// U+266A: "" EIGHTH NOTE // U+221A: "" SQUARE ROOT
// U+2665: "" BLACK HEART SUIT key("\u221A"),
// U+2660: "" BLACK SPADE SUIT // U+03C0: "π" GREEK SMALL LETTER PI
// U+2666: "" BLACK DIAMOND SUIT // U+03A0: "Π" GREEK CAPITAL LETTER PI
// U+2663: "" BLACK CLUB SUIT key("\u03C0", moreKey("\u03A0")),
.setMoreKeysOf("\u2022", "\u266A", "\u2665", "\u2660", "\u2666", "\u2663") // U+00F7: "÷" DIVISION SIGN
// U+03C0: "π" GREEK SMALL LETTER PI key("\u00F7"),
// U+03A0: "Π" GREEK CAPITAL LETTER PI // U+00D7: "×" MULTIPLICATION SIGN
.setMoreKeysOf("\u03C0", "\u03A0") key("\u00D7"),
// U+00B6: "" PILCROW SIGN // U+00B6: "" PILCROW SIGN
// U+00A7: "§" SECTION SIGN // U+00A7: "§" SECTION SIGN
.setMoreKeysOf("\u00B6", "\u00A7") key("\u00B6", moreKey("\u00A7")),
// U+00B0: "°" DEGREE SIGN // U+2206: "" INCREMENT
.setLabelsOfRow(2, OTHER_CURRENCIES, "^", "\u00B0", "=", "{", "}") key("\u2206"))
// U+2191: "" UPWARDS ARROW .setKeysOfRow(2,
// U+2193: "" DOWNWARDS ARROW key(OTHER_CURRENCIES),
// U+2190: "" LEFTWARDS ARROW // U+2191: "" UPWARDS ARROW
// U+2192: "" RIGHTWARDS ARROW // U+2193: "" DOWNWARDS ARROW
.setMoreKeysOf("^", "\u2191", "\u2193", "\u2190", "\u2192") // U+2190: "" LEFTWARDS ARROW
// U+00B0: "°" DEGREE SIGN // U+2192: "" RIGHTWARDS ARROW
// U+2032: "" PRIME key("^", joinMoreKeys("\u2191", "\u2193", "\u2190", "\u2192")),
// U+2033: "" DOUBLE PRIME // U+00B0: "°" DEGREE SIGN
.setMoreKeysOf("\u00B0", "\u2032", "\u2033") // U+2032: "" PRIME
// U+2260: "" NOT EQUAL TO // U+2033: "" DOUBLE PRIME
// U+2248: "" ALMOST EQUAL TO key("\u00B0", joinMoreKeys("\u2032", "\u2033")),
// U+221E: "" INFINITY // U+2260: "" NOT EQUAL TO
.setMoreKeysOf("=", "\u2260", "\u2248", "\u221E") // U+2248: "" ALMOST EQUAL TO
// U+00A9: "©" COPYRIGHT SIGN // U+221E: "" INFINITY
// U+00AE: "®" REGISTERED SIGN key("=", joinMoreKeys("\u2260", "\u2248", "\u221E")),
// U+2122: "" TRADE MARK SIGN key("{"),
// U+2105: "" CARE OF key("}"))
.setLabelsOfRow(3, .setLabelsOfRow(3,
"\\", "\u00A9", "\u00AE", "\u2122", "\u2105", // U+00A9: "©" COPYRIGHT SIGN
"[", "]") // U+00AE: "®" REGISTERED SIGN
.setLabelsOfRow(4, // U+2122: "" TRADE MARK SIGN
"<", ">", " ", ",", ".") // U+2105: "" CARE OF
// U+2039: "" SINGLE LEFT-POINTING ANGLE QUOTATION MARK "\\", "\u00A9", "\u00AE", "\u2122", "\u2105", "[", "]")
// U+2264: "" LESS-THAN OR EQUAL TO .setKeysOfRow(4,
// U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK // U+2039: "" SINGLE LEFT-POINTING ANGLE QUOTATION MARK
.setMoreKeysOf("<", "\u2039", "\u2264", "\u00AB") // U+2264: "" LESS-THAN OR EQUAL TO
// U+203A: "" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK // U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
// U+2265: "" GREATER-THAN EQUAL TO key("<", joinMoreKeys("\u2039", "\u2264", "\u00AB")),
// U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK // U+203A: "" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
.setMoreKeysOf(">", "\u203A", "\u2265", "\u00BB") // U+2265: "" GREATER-THAN EQUAL TO
// U+2026: "" HORIZONTAL ELLIPSIS // U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
.setMoreKeysOf(".", "\u2026") key(">", joinMoreKeys("\u203A", "\u2265", "\u00BB")),
SPACE_KEY, key(","),
// U+2026: "" HORIZONTAL ELLIPSIS
key(".", moreKey("\u2026")))
.build(); .build();
private ExpectedKey[][] toPhoneSymbolsShifted(final ExpectedKey[][] common) {
return new ExpectedKeyboardBuilder(common)
.addKeysOnTheLeftOfRow(3, mCustomizer.getBackToSymbolsKey())
.addKeysOnTheRightOfRow(3, DELETE_KEY)
.addKeysOnTheLeftOfRow(4, mCustomizer.getAlphabetKey())
.addKeysOnTheRightOfRow(4, key(ENTER_KEY, EMOJI_KEY))
.build();
}
private ExpectedKey[][] toTabletSymbolsShifted(final ExpectedKey[][] common) {
return new ExpectedKeyboardBuilder(common)
// U+00BF: "¿" INVERTED QUESTION MARK
// U+00A1: "¡" INVERTED EXCLAMATION MARK
.addKeysOnTheRightOfRow(3,
key("\u00A1"), key("\u00BF"))
.addKeysOnTheRightOfRow(1, DELETE_KEY)
.addKeysOnTheRightOfRow(2, ENTER_KEY)
.addKeysOnTheLeftOfRow(3, mCustomizer.getBackToSymbolsKey())
.addKeysOnTheRightOfRow(3, mCustomizer.getBackToSymbolsKey())
.addKeysOnTheLeftOfRow(4, mCustomizer.getAlphabetKey())
.addKeysOnTheRightOfRow(4, EMOJI_KEY)
.build();
}
public static class RtlSymbolsShifted extends SymbolsShifted { public static class RtlSymbolsShifted extends SymbolsShifted {
public RtlSymbolsShifted(final LayoutCustomizer customizer) { public RtlSymbolsShifted(final LayoutCustomizer customizer) {
super(customizer); super(customizer);

View file

@ -31,54 +31,66 @@ public abstract class AbstractLayoutBase {
// Those helper methods have a lower case name to be readable when defining expected keyboard // Those helper methods have a lower case name to be readable when defining expected keyboard
// layouts. // layouts.
// Helper method to create {@link ExpectedKey} object that has the label. // Helper method to create an {@link ExpectedKey} object that has the label.
public static ExpectedKey key(final String label, final ExpectedKey ... moreKeys) { public static ExpectedKey key(final String label, final ExpectedKey ... moreKeys) {
return ExpectedKey.newInstance(label, moreKeys); return ExpectedKey.newInstance(label, moreKeys);
} }
// Helper method to create {@link ExpectedKey} object that has the label and the output text. // Helper method to create an {@link ExpectedKey} object that has the label and the output text.
public static ExpectedKey key(final String label, final String outputText, public static ExpectedKey key(final String label, final String outputText,
final ExpectedKey ... moreKeys) { final ExpectedKey ... moreKeys) {
return ExpectedKey.newInstance(label, outputText, moreKeys); return ExpectedKey.newInstance(label, outputText, moreKeys);
} }
// Helper method to create {@link ExpectedKey} object that has the label and the output code. // Helper method to create an {@link ExpectedKey} object that has the label and the output code.
public static ExpectedKey key(final String label, final int code, public static ExpectedKey key(final String label, final int code,
final ExpectedKey ... moreKeys) { final ExpectedKey ... moreKeys) {
return ExpectedKey.newInstance(label, code, moreKeys); return ExpectedKey.newInstance(label, code, moreKeys);
} }
// Helper method to create {@link ExpectedKey} object that has the icon and the output code. // Helper method to create an {@link ExpectedKey} object that has the icon and the output text.
public static ExpectedKey key(final int iconId, final String outputText,
final ExpectedKey ... moreKeys) {
return ExpectedKey.newInstance(iconId, outputText, moreKeys);
}
// Helper method to create an {@link ExpectedKey} object that has the icon and the output code.
public static ExpectedKey key(final int iconId, final int code, public static ExpectedKey key(final int iconId, final int code,
final ExpectedKey ... moreKeys) { final ExpectedKey ... moreKeys) {
return ExpectedKey.newInstance(iconId, code, moreKeys); return ExpectedKey.newInstance(iconId, code, moreKeys);
} }
// Helper method to create {@link ExpectedKey} object that has new "more keys". // Helper method to create an {@link ExpectedKey} object that has new "more keys".
public static ExpectedKey key(final ExpectedKey key, final ExpectedKey ... moreKeys) { public static ExpectedKey key(final ExpectedKey key, final ExpectedKey ... moreKeys) {
return ExpectedKey.newInstance(key.getVisual(), key.getOutput(), moreKeys); return ExpectedKey.newInstance(key.getVisual(), key.getOutput(), moreKeys);
} }
// Helper method to create {@link ExpectedKey} object for "more key" that has the label. // Helper method to create an {@link ExpectedKey} object for a "more key" that has the label.
public static ExpectedKey moreKey(final String label) { public static ExpectedKey moreKey(final String label) {
return ExpectedKey.newInstance(label); return ExpectedKey.newInstance(label);
} }
// Helper method to create {@link ExpectedKey} object for "more key" that has the label and the // Helper method to create an {@link ExpectedKey} object for a "more key" that has the label
// output text. // and the output text.
public static ExpectedKey moreKey(final String label, final String outputText) { public static ExpectedKey moreKey(final String label, final String outputText) {
return ExpectedKey.newInstance(label, outputText); return ExpectedKey.newInstance(label, outputText);
} }
// Helper method to create {@link ExpectedKey} object for "more key" that has the label and the // Helper method to create an {@link ExpectedKey} object for a "more key" that has the label
// output code. // and the output code.
public static ExpectedKey moreKey(final String label, final int code) { public static ExpectedKey moreKey(final String label, final int code) {
return ExpectedKey.newInstance(label, code); return ExpectedKey.newInstance(label, code);
} }
// Helper method to create an {@link ExpectedKey} object for a "more key" that has the icon
// and the output text.
public static ExpectedKey moreKey(final int iconId, final String outputText) {
return ExpectedKey.newInstance(iconId, outputText);
}
// Helper method to create {@link ExpectedKey} array by joining {@link ExpectedKey}, // Helper method to create {@link ExpectedKey} array by joining {@link ExpectedKey},
// {@link ExpectedKey} array, and {@link String}. // {@link ExpectedKey} array, and {@link String}.
public static ExpectedKey[] moreKeys(final Object ... moreKeys) { public static ExpectedKey[] joinMoreKeys(final Object ... moreKeys) {
return joinKeys(moreKeys); return joinKeys(moreKeys);
} }
@ -115,6 +127,6 @@ public abstract class AbstractLayoutBase {
public static final ExpectedKey SETTINGS_KEY = key(ICON_SETTINGS, Constants.CODE_SETTINGS); public static final ExpectedKey SETTINGS_KEY = key(ICON_SETTINGS, Constants.CODE_SETTINGS);
public static final ExpectedKey ENTER_KEY = key(ICON_ENTER, Constants.CODE_ENTER); public static final ExpectedKey ENTER_KEY = key(ICON_ENTER, Constants.CODE_ENTER);
public static final ExpectedKey EMOJI_KEY = key(ICON_EMOJI, Constants.CODE_EMOJI); public static final ExpectedKey EMOJI_KEY = key(ICON_EMOJI, Constants.CODE_EMOJI);
public static final ExpectedKey SPACEBAR = key( public static final ExpectedKey SPACE_KEY = key(
StringUtils.newSingleCodePointString(Constants.CODE_SPACE)); StringUtils.newSingleCodePointString(Constants.CODE_SPACE));
} }

View file

@ -47,6 +47,13 @@ public class ExpectedKey {
ExpectedKeyOutput.newInstance(code), moreKeys); ExpectedKeyOutput.newInstance(code), moreKeys);
} }
// A key that has an icon and an output text and may have "more keys".
static ExpectedKey newInstance(final int iconId, final String outputText,
final ExpectedKey ... moreKeys) {
return newInstance(ExpectedKeyVisual.newInstance(iconId),
ExpectedKeyOutput.newInstance(outputText), moreKeys);
}
// A key that has an icon and a code point output and may have "more keys". // A key that has an icon and a code point output and may have "more keys".
static ExpectedKey newInstance(final int iconId, final int code, static ExpectedKey newInstance(final int iconId, final int code,
final ExpectedKey ... moreKeys) { final ExpectedKey ... moreKeys) {

View file

@ -56,36 +56,36 @@ abstract class LayoutTestsBase extends KeyboardLayoutSetTestsBase {
// Those helper methods have a lower case name to be readable when defining expected keyboard // Those helper methods have a lower case name to be readable when defining expected keyboard
// layouts. // layouts.
// Helper method to create {@link ExpectedKey} object that has the label. // Helper method to create an {@link ExpectedKey} object that has the label.
static ExpectedKey key(final String label, final ExpectedKey ... moreKeys) { static ExpectedKey key(final String label, final ExpectedKey ... moreKeys) {
return AbstractLayoutBase.key(label, moreKeys); return AbstractLayoutBase.key(label, moreKeys);
} }
// Helper method to create {@link ExpectedKey} object that has the label and the output text. // Helper method to create an {@link ExpectedKey} object that has the label and the output text.
static ExpectedKey key(final String label, final String outputText, static ExpectedKey key(final String label, final String outputText,
final ExpectedKey ... moreKeys) { final ExpectedKey ... moreKeys) {
return AbstractLayoutBase.key(label, outputText, moreKeys); return AbstractLayoutBase.key(label, outputText, moreKeys);
} }
// Helper method to create {@link ExpectedKey} object that has new "more keys". // Helper method to create an {@link ExpectedKey} object that has new "more keys".
static ExpectedKey key(final ExpectedKey key, final ExpectedKey ... moreKeys) { static ExpectedKey key(final ExpectedKey key, final ExpectedKey ... moreKeys) {
return AbstractLayoutBase.key(key, moreKeys); return AbstractLayoutBase.key(key, moreKeys);
} }
// Helper method to create {@link ExpectedKey} object for "more key" that has the label. // Helper method to create an {@link ExpectedKey} object for a "more key" that has the label.
static ExpectedKey moreKey(final String label) { static ExpectedKey moreKey(final String label) {
return AbstractLayoutBase.moreKey(label); return AbstractLayoutBase.moreKey(label);
} }
// Helper method to create {@link ExpectedKey} object for "more key" that has the label and the // Helper method to create an {@link ExpectedKey} object for a "more key" that has the label
// output text. // and the output text.
static ExpectedKey moreKey(final String label, final String outputText) { static ExpectedKey moreKey(final String label, final String outputText) {
return AbstractLayoutBase.moreKey(label, outputText); return AbstractLayoutBase.moreKey(label, outputText);
} }
// Helper method to create {@link ExpectedKey} array by joining {@link ExpectedKey}, // Helper method to create {@link ExpectedKey} array by joining {@link ExpectedKey},
// {@link ExpectedKey} array, and {@link String}. // {@link ExpectedKey} array, and {@link String}.
static ExpectedKey[] moreKeys(final Object ... moreKeys) { static ExpectedKey[] joinMoreKeys(final Object ... moreKeys) {
return AbstractLayoutBase.joinKeys(moreKeys); return AbstractLayoutBase.joinKeys(moreKeys);
} }