Fix KeyboardLayoutTest

This commit is contained in:
Aleksandras Kostarevas 2024-08-31 18:13:27 +03:00
parent 05a5f417ac
commit a19ce6122e
3 changed files with 18 additions and 20 deletions

View File

@ -58,9 +58,9 @@ public class KeyboardLayout {
for (int i = 0; i < layoutKeys.size(); i++) {
Key key = layoutKeys.get(i);
mKeyCodes[i] = Character.toLowerCase(key.getCode());
mKeyXCoordinates[i] = key.getX();
mKeyXCoordinates[i] = key.getDrawX();
mKeyYCoordinates[i] = key.getY();
mKeyWidths[i] = key.getWidth();
mKeyWidths[i] = key.getDrawWidth();
mKeyHeights[i] = key.getHeight();
}
}

View File

@ -35,7 +35,6 @@ import java.util.Locale;
@SmallTest
public class KeyboardLayoutSetNavigateMoreKeysTest extends KeyboardLayoutSetTestsBase {
// !icon/action_clipboard_history|!code/action_clipboard_history,!icon/action_emoji|!code/action_emoji,!icon/previous_key|!code/key_action_previous,!icon/next_key|!code/key_action_next,!icon/action_undo|!code/action_undo,!icon/action_redo|!code/action_redo
private ExpectedMoreKey mSwitchLanguageMoreKey = new ExpectedMoreKey("action_switch_language");
private ExpectedMoreKey mTextEditMoreKey = new ExpectedMoreKey("action_text_edit");
private ExpectedMoreKey mClipboardHistoryMoreKey = new ExpectedMoreKey("action_clipboard_history");
@ -90,7 +89,6 @@ public class KeyboardLayoutSetNavigateMoreKeysTest extends KeyboardLayoutSetTest
} else {
assertTrue(tag + " fixedOrder", actualKey.isMoreKeysFixedOrder());
assertTrue(tag + " fixedColumn", actualKey.isMoreKeysFixedColumn());
// TODO: Can't handle multiple rows of more keys.
assertEquals(tag + " column",
mEnterMoreKeysExpectedColumnCount, actualKey.getMoreKeysColumnNumber());
}

View File

@ -42,39 +42,39 @@ class KeyboardLayoutTest {
Assert.assertEquals(0, keyboardLayout.keyYCoordinates.size.toLong())
val key1 = Key(
code = 101,
code = 102,
label = "label1",
hintLabel = "101hint",
width = 1100,
height = 1101,
horizontalGap = 10,
verticalGap = 10,
actionFlags = 102,
labelFlags = 103,
visualStyle = KeyVisualStyle.Normal,
x = 105,
y = 106
y = 106,
// Note: The old Key constructor subtracted width automatically, the new one
// requires the caller to provide dimensions with gap subtracted
width = 1100 - 10,
height = 1101 - 10,
horizontalGap = 10,
verticalGap = 10,
)
val key2 = Key(
code = 201,
code = 103,
label = "label2",
hintLabel = "201hint",
width = 2100,
height = 2101,
horizontalGap = 10,
verticalGap = 10,
actionFlags = 202,
labelFlags = 203,
visualStyle = KeyVisualStyle.Normal,
x = 205,
y = 206
y = 206,
width = 2100 - 10,
height = 2101 - 10,
horizontalGap = 10,
verticalGap = 10,
)
//Key key1 = new Key("label1", 101, 102, "101", "101hint", 103, 104, 105, 106, 1100, 1101,
// 10, 10);
//Key key2 = new Key("label2", 201, 103, "201", "201hint", 203, 204, 205, 206, 2100, 2101,
// 10, 10);
val sortedKeys = ArrayList<Key>(2)
sortedKeys.add(key1)
sortedKeys.add(key2)