mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Fix KeyboardLayoutTest
This commit is contained in:
parent
05a5f417ac
commit
a19ce6122e
@ -58,9 +58,9 @@ public class KeyboardLayout {
|
|||||||
for (int i = 0; i < layoutKeys.size(); i++) {
|
for (int i = 0; i < layoutKeys.size(); i++) {
|
||||||
Key key = layoutKeys.get(i);
|
Key key = layoutKeys.get(i);
|
||||||
mKeyCodes[i] = Character.toLowerCase(key.getCode());
|
mKeyCodes[i] = Character.toLowerCase(key.getCode());
|
||||||
mKeyXCoordinates[i] = key.getX();
|
mKeyXCoordinates[i] = key.getDrawX();
|
||||||
mKeyYCoordinates[i] = key.getY();
|
mKeyYCoordinates[i] = key.getY();
|
||||||
mKeyWidths[i] = key.getWidth();
|
mKeyWidths[i] = key.getDrawWidth();
|
||||||
mKeyHeights[i] = key.getHeight();
|
mKeyHeights[i] = key.getHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ import java.util.Locale;
|
|||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
public class KeyboardLayoutSetNavigateMoreKeysTest extends KeyboardLayoutSetTestsBase {
|
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 mSwitchLanguageMoreKey = new ExpectedMoreKey("action_switch_language");
|
||||||
private ExpectedMoreKey mTextEditMoreKey = new ExpectedMoreKey("action_text_edit");
|
private ExpectedMoreKey mTextEditMoreKey = new ExpectedMoreKey("action_text_edit");
|
||||||
private ExpectedMoreKey mClipboardHistoryMoreKey = new ExpectedMoreKey("action_clipboard_history");
|
private ExpectedMoreKey mClipboardHistoryMoreKey = new ExpectedMoreKey("action_clipboard_history");
|
||||||
@ -90,7 +89,6 @@ public class KeyboardLayoutSetNavigateMoreKeysTest extends KeyboardLayoutSetTest
|
|||||||
} else {
|
} else {
|
||||||
assertTrue(tag + " fixedOrder", actualKey.isMoreKeysFixedOrder());
|
assertTrue(tag + " fixedOrder", actualKey.isMoreKeysFixedOrder());
|
||||||
assertTrue(tag + " fixedColumn", actualKey.isMoreKeysFixedColumn());
|
assertTrue(tag + " fixedColumn", actualKey.isMoreKeysFixedColumn());
|
||||||
// TODO: Can't handle multiple rows of more keys.
|
|
||||||
assertEquals(tag + " column",
|
assertEquals(tag + " column",
|
||||||
mEnterMoreKeysExpectedColumnCount, actualKey.getMoreKeysColumnNumber());
|
mEnterMoreKeysExpectedColumnCount, actualKey.getMoreKeysColumnNumber());
|
||||||
}
|
}
|
||||||
|
@ -42,39 +42,39 @@ class KeyboardLayoutTest {
|
|||||||
Assert.assertEquals(0, keyboardLayout.keyYCoordinates.size.toLong())
|
Assert.assertEquals(0, keyboardLayout.keyYCoordinates.size.toLong())
|
||||||
|
|
||||||
val key1 = Key(
|
val key1 = Key(
|
||||||
code = 101,
|
code = 102,
|
||||||
label = "label1",
|
label = "label1",
|
||||||
hintLabel = "101hint",
|
hintLabel = "101hint",
|
||||||
width = 1100,
|
|
||||||
height = 1101,
|
|
||||||
horizontalGap = 10,
|
|
||||||
verticalGap = 10,
|
|
||||||
actionFlags = 102,
|
actionFlags = 102,
|
||||||
labelFlags = 103,
|
labelFlags = 103,
|
||||||
visualStyle = KeyVisualStyle.Normal,
|
visualStyle = KeyVisualStyle.Normal,
|
||||||
x = 105,
|
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(
|
val key2 = Key(
|
||||||
code = 201,
|
code = 103,
|
||||||
label = "label2",
|
label = "label2",
|
||||||
hintLabel = "201hint",
|
hintLabel = "201hint",
|
||||||
width = 2100,
|
|
||||||
height = 2101,
|
|
||||||
horizontalGap = 10,
|
|
||||||
verticalGap = 10,
|
|
||||||
actionFlags = 202,
|
actionFlags = 202,
|
||||||
labelFlags = 203,
|
labelFlags = 203,
|
||||||
visualStyle = KeyVisualStyle.Normal,
|
visualStyle = KeyVisualStyle.Normal,
|
||||||
x = 205,
|
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)
|
val sortedKeys = ArrayList<Key>(2)
|
||||||
sortedKeys.add(key1)
|
sortedKeys.add(key1)
|
||||||
sortedKeys.add(key2)
|
sortedKeys.add(key2)
|
||||||
|
Loading…
Reference in New Issue
Block a user