Home | History | Annotate | Download | only in keyboard
      1 /*
      2  * Copyright (C) 2011 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
      5  * use this file except in compliance with the License. You may obtain a copy of
      6  * the License at
      7  *
      8  * http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
     13  * License for the specific language governing permissions and limitations under
     14  * the License.
     15  */
     16 
     17 package com.android.inputmethod.keyboard;
     18 
     19 import com.android.inputmethod.keyboard.MiniKeyboard.Builder.MiniKeyboardParams;
     20 
     21 import android.test.AndroidTestCase;
     22 
     23 public class MiniKeyboardBuilderTests extends AndroidTestCase {
     24     private static final int MAX_COLUMNS = 5;
     25     private static final int WIDTH = 10;
     26     private static final int HEIGHT = 10;
     27 
     28     private static final int KEYBOARD_WIDTH = WIDTH * 10;
     29     private static final int XPOS_L0 = WIDTH * 0;
     30     private static final int XPOS_L1 = WIDTH * 1;
     31     private static final int XPOS_L2 = WIDTH * 2;
     32     private static final int XPOS_M0 = WIDTH * 5;
     33     private static final int XPOS_R3 = WIDTH * 6;
     34     private static final int XPOS_R2 = WIDTH * 7;
     35     private static final int XPOS_R1 = WIDTH * 8;
     36     private static final int XPOS_R0 = WIDTH * 9;
     37 
     38     @Override
     39     protected void setUp() throws Exception {
     40         super.setUp();
     41     }
     42 
     43     public void testLayoutError() {
     44         MiniKeyboardParams params = null;
     45         try {
     46             params = new MiniKeyboardParams(10, MAX_COLUMNS + 1, WIDTH, HEIGHT, WIDTH * 2,
     47                     WIDTH * MAX_COLUMNS);
     48             fail("Should throw IllegalArgumentException");
     49         } catch (IllegalArgumentException e) {
     50             // Too small keyboard to hold mini keyboard.
     51         }
     52         assertNull("Too small keyboard to hold mini keyboard", params);
     53     }
     54 
     55     // Mini keyboard layout test.
     56     // "[n]" represents n-th key position in mini keyboard.
     57     // "[1]" is the default key.
     58 
     59     // [1]
     60     public void testLayout1KeyM0() {
     61         MiniKeyboardParams params = new MiniKeyboardParams(1, MAX_COLUMNS, WIDTH,
     62                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
     63         assertEquals("1 key M0 columns", 1, params.mNumColumns);
     64         assertEquals("1 key M0 rows", 1, params.mNumRows);
     65         assertEquals("1 key M0 left", 0, params.mLeftKeys);
     66         assertEquals("1 key M0 right", 1, params.mRightKeys);
     67         assertEquals("1 key M0 [1]", 0, params.getColumnPos(0));
     68         assertEquals("1 key M0 adjust", 0, params.mTopRowAdjustment);
     69         assertEquals("1 key M0 default", WIDTH * 0, params.getDefaultKeyCoordX());
     70     }
     71 
     72     // |[1]
     73     public void testLayout1KeyL0() {
     74         MiniKeyboardParams params = new MiniKeyboardParams(1, MAX_COLUMNS, WIDTH,
     75                 HEIGHT, XPOS_L0, KEYBOARD_WIDTH);
     76         assertEquals("1 key L0 columns", 1, params.mNumColumns);
     77         assertEquals("1 key L0 rows", 1, params.mNumRows);
     78         assertEquals("1 key L0 left", 0, params.mLeftKeys);
     79         assertEquals("1 key L0 right", 1, params.mRightKeys);
     80         assertEquals("1 key L0 [1]", 0, params.getColumnPos(0));
     81         assertEquals("1 key L0 adjust", 0, params.mTopRowAdjustment);
     82         assertEquals("1 key L0 default", WIDTH * 0, params.getDefaultKeyCoordX());
     83     }
     84 
     85     // |___ [1]
     86     public void testLayout1KeyL1() {
     87         MiniKeyboardParams params = new MiniKeyboardParams(1, MAX_COLUMNS, WIDTH,
     88                 HEIGHT, XPOS_L1, KEYBOARD_WIDTH);
     89         assertEquals("1 key L1 columns", 1, params.mNumColumns);
     90         assertEquals("1 key L1 rows", 1, params.mNumRows);
     91         assertEquals("1 key L1 left", 0, params.mLeftKeys);
     92         assertEquals("1 key L1 right", 1, params.mRightKeys);
     93         assertEquals("1 key L1 [1]", 0, params.getColumnPos(0));
     94         assertEquals("1 key L1 adjust", 0, params.mTopRowAdjustment);
     95         assertEquals("1 key L1 default", WIDTH * 0, params.getDefaultKeyCoordX());
     96     }
     97 
     98     // |___ ___ [1]
     99     public void testLayout1KeyL2() {
    100         MiniKeyboardParams params = new MiniKeyboardParams(1, MAX_COLUMNS, WIDTH,
    101                 HEIGHT, XPOS_L2, KEYBOARD_WIDTH);
    102         assertEquals("1 key L2 columns", 1, params.mNumColumns);
    103         assertEquals("1 key L2 rows", 1, params.mNumRows);
    104         assertEquals("1 key L2 left", 0, params.mLeftKeys);
    105         assertEquals("1 key L2 right", 1, params.mRightKeys);
    106         assertEquals("1 key L2 [1]", 0, params.getColumnPos(0));
    107         assertEquals("1 key L2 adjust", 0, params.mTopRowAdjustment);
    108         assertEquals("1 key L2 default", WIDTH * 0, params.getDefaultKeyCoordX());
    109     }
    110 
    111     // [1]|
    112     public void testLayout1KeyR0() {
    113         MiniKeyboardParams params = new MiniKeyboardParams(1, MAX_COLUMNS, WIDTH,
    114                 HEIGHT, XPOS_R0, KEYBOARD_WIDTH);
    115         assertEquals("1 key R0 columns", 1, params.mNumColumns);
    116         assertEquals("1 key R0 rows", 1, params.mNumRows);
    117         assertEquals("1 key R0 left", 0, params.mLeftKeys);
    118         assertEquals("1 key R0 right", 1, params.mRightKeys);
    119         assertEquals("1 key R0 [1]", 0, params.getColumnPos(0));
    120         assertEquals("1 key R0 adjust", 0, params.mTopRowAdjustment);
    121         assertEquals("1 key R0 default", WIDTH * 0, params.getDefaultKeyCoordX());
    122     }
    123 
    124     // [1] ___|
    125     public void testLayout1KeyR1() {
    126         MiniKeyboardParams params = new MiniKeyboardParams(1, MAX_COLUMNS, WIDTH,
    127                 HEIGHT, XPOS_R1, KEYBOARD_WIDTH);
    128         assertEquals("1 key R1 columns", 1, params.mNumColumns);
    129         assertEquals("1 key R1 rows", 1, params.mNumRows);
    130         assertEquals("1 key R1 left", 0, params.mLeftKeys);
    131         assertEquals("1 key R1 right", 1, params.mRightKeys);
    132         assertEquals("1 key R1 [1]", 0, params.getColumnPos(0));
    133         assertEquals("1 key R1 adjust", 0, params.mTopRowAdjustment);
    134         assertEquals("1 key R1 default", WIDTH * 0, params.getDefaultKeyCoordX());
    135     }
    136 
    137     // [1] ___ ___|
    138     public void testLayout1KeyR2() {
    139         MiniKeyboardParams params = new MiniKeyboardParams(1, MAX_COLUMNS, WIDTH,
    140                 HEIGHT, XPOS_R2, KEYBOARD_WIDTH);
    141         assertEquals("1 key R2 columns", 1, params.mNumColumns);
    142         assertEquals("1 key R2 rows", 1, params.mNumRows);
    143         assertEquals("1 key R2 left", 0, params.mLeftKeys);
    144         assertEquals("1 key R2 right", 1, params.mRightKeys);
    145         assertEquals("1 key R2 [1]", 0, params.getColumnPos(0));
    146         assertEquals("1 key R2 adjust", 0, params.mTopRowAdjustment);
    147         assertEquals("1 key R2 default", WIDTH * 0, params.getDefaultKeyCoordX());
    148     }
    149 
    150     // [1] [2]
    151     public void testLayout2KeyM0() {
    152         MiniKeyboardParams params = new MiniKeyboardParams(2, MAX_COLUMNS, WIDTH,
    153                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
    154         assertEquals("2 key M0 columns", 2, params.mNumColumns);
    155         assertEquals("2 key M0 rows", 1, params.mNumRows);
    156         assertEquals("2 key M0 left", 0, params.mLeftKeys);
    157         assertEquals("2 key M0 right", 2, params.mRightKeys);
    158         assertEquals("2 key M0 [1]", 0, params.getColumnPos(0));
    159         assertEquals("2 key M0 [2]", 1, params.getColumnPos(1));
    160         assertEquals("2 key M0 adjust", 0, params.mTopRowAdjustment);
    161         assertEquals("2 key M0 default", WIDTH * 0, params.getDefaultKeyCoordX());
    162     }
    163 
    164     // |[1] [2]
    165     public void testLayout2KeyL0() {
    166         MiniKeyboardParams params = new MiniKeyboardParams(2, MAX_COLUMNS, WIDTH,
    167                 HEIGHT, XPOS_L0, KEYBOARD_WIDTH);
    168         assertEquals("2 key L0 columns", 2, params.mNumColumns);
    169         assertEquals("2 key L0 rows", 1, params.mNumRows);
    170         assertEquals("2 key L0 left", 0, params.mLeftKeys);
    171         assertEquals("2 key L0 right", 2, params.mRightKeys);
    172         assertEquals("2 key L0 [1]", 0, params.getColumnPos(0));
    173         assertEquals("2 key L0 [2]", 1, params.getColumnPos(1));
    174         assertEquals("2 key L0 adjust", 0, params.mTopRowAdjustment);
    175         assertEquals("2 key L0 default", WIDTH * 0, params.getDefaultKeyCoordX());
    176     }
    177 
    178     // |___ [1] [2]
    179     public void testLayout2KeyL1() {
    180         MiniKeyboardParams params = new MiniKeyboardParams(2, MAX_COLUMNS, WIDTH,
    181                 HEIGHT, XPOS_L1, KEYBOARD_WIDTH);
    182         assertEquals("2 key L1 columns", 2, params.mNumColumns);
    183         assertEquals("2 key L1 rows", 1, params.mNumRows);
    184         assertEquals("2 key L1 left", 0, params.mLeftKeys);
    185         assertEquals("2 key L1 right", 2, params.mRightKeys);
    186         assertEquals("2 key L1 [1]", 0, params.getColumnPos(0));
    187         assertEquals("2 key L1 [2]", 1, params.getColumnPos(1));
    188         assertEquals("2 key L1 adjust", 0, params.mTopRowAdjustment);
    189         assertEquals("2 key L1 default", WIDTH * 0, params.getDefaultKeyCoordX());
    190     }
    191 
    192     // |___ ___ [1] [2]
    193     public void testLayout2KeyL2() {
    194         MiniKeyboardParams params = new MiniKeyboardParams(2, MAX_COLUMNS, WIDTH,
    195                 HEIGHT, XPOS_L2, KEYBOARD_WIDTH);
    196         assertEquals("2 key L2 columns", 2, params.mNumColumns);
    197         assertEquals("2 key L2 rows", 1, params.mNumRows);
    198         assertEquals("2 key L2 left", 0, params.mLeftKeys);
    199         assertEquals("2 key L2 right", 2, params.mRightKeys);
    200         assertEquals("2 key L2 [1]", 0, params.getColumnPos(0));
    201         assertEquals("2 key L2 [2]", 1, params.getColumnPos(1));
    202         assertEquals("2 key L2 adjust", 0, params.mTopRowAdjustment);
    203         assertEquals("2 key L2 default", WIDTH * 0, params.getDefaultKeyCoordX());
    204     }
    205 
    206     // [2] [1]|
    207     public void testLayout2KeyR0() {
    208         MiniKeyboardParams params = new MiniKeyboardParams(2, MAX_COLUMNS, WIDTH,
    209                 HEIGHT, XPOS_R0, KEYBOARD_WIDTH);
    210         assertEquals("2 key R0 columns", 2, params.mNumColumns);
    211         assertEquals("2 key R0 rows", 1, params.mNumRows);
    212         assertEquals("2 key R0 left", 1, params.mLeftKeys);
    213         assertEquals("2 key R0 right", 1, params.mRightKeys);
    214         assertEquals("2 key R0 [1]", 0, params.getColumnPos(0));
    215         assertEquals("2 key R0 [2]", -1, params.getColumnPos(1));
    216         assertEquals("2 key R0 adjust", 0, params.mTopRowAdjustment);
    217         assertEquals("2 key R0 default", WIDTH * 1, params.getDefaultKeyCoordX());
    218     }
    219 
    220     // [2] [1] ___|
    221     public void testLayout2KeyR1() {
    222         MiniKeyboardParams params = new MiniKeyboardParams(2, MAX_COLUMNS, WIDTH,
    223                 HEIGHT, XPOS_R1, KEYBOARD_WIDTH);
    224         assertEquals("2 key R1 columns", 2, params.mNumColumns);
    225         assertEquals("2 key R1 rows", 1, params.mNumRows);
    226         assertEquals("2 key R1 left", 1, params.mLeftKeys);
    227         assertEquals("2 key R1 right", 1, params.mRightKeys);
    228         assertEquals("2 key R1 [1]", 0, params.getColumnPos(0));
    229         assertEquals("2 key R1 [2]", -1, params.getColumnPos(1));
    230         assertEquals("2 key R1 adjust", 0, params.mTopRowAdjustment);
    231         assertEquals("2 key R1 default", WIDTH * 1, params.getDefaultKeyCoordX());
    232     }
    233 
    234     // [1] [2] ___ ___|
    235     public void testLayout2KeyR2() {
    236         MiniKeyboardParams params = new MiniKeyboardParams(2, MAX_COLUMNS, WIDTH,
    237                 HEIGHT, XPOS_R2, KEYBOARD_WIDTH);
    238         assertEquals("2 key R2 columns", 2, params.mNumColumns);
    239         assertEquals("2 key R2 rows", 1, params.mNumRows);
    240         assertEquals("2 key R2 left", 0, params.mLeftKeys);
    241         assertEquals("2 key R2 right", 2, params.mRightKeys);
    242         assertEquals("2 key R2 [1]", 0, params.getColumnPos(0));
    243         assertEquals("2 key R2 [2]", 1, params.getColumnPos(1));
    244         assertEquals("2 key R2 adjust", 0, params.mTopRowAdjustment);
    245         assertEquals("2 key R2 default", WIDTH * 0, params.getDefaultKeyCoordX());
    246     }
    247 
    248     // [3] [1] [2]
    249     public void testLayout3KeyM0() {
    250         MiniKeyboardParams params = new MiniKeyboardParams(3, MAX_COLUMNS, WIDTH,
    251                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
    252         assertEquals("3 key columns", 3, params.mNumColumns);
    253         assertEquals("3 key rows", 1, params.mNumRows);
    254         assertEquals("3 key left", 1, params.mLeftKeys);
    255         assertEquals("3 key right", 2, params.mRightKeys);
    256         assertEquals("3 key [1]", 0, params.getColumnPos(0));
    257         assertEquals("3 key [2]", 1, params.getColumnPos(1));
    258         assertEquals("3 key [3]", -1, params.getColumnPos(2));
    259         assertEquals("3 key adjust", 0, params.mTopRowAdjustment);
    260         assertEquals("3 key default", WIDTH * 1, params.getDefaultKeyCoordX());
    261     }
    262 
    263     // |[1] [2] [3]
    264     public void testLayout3KeyL0() {
    265         MiniKeyboardParams params = new MiniKeyboardParams(3, MAX_COLUMNS, WIDTH,
    266                 HEIGHT, XPOS_L0, KEYBOARD_WIDTH);
    267         assertEquals("3 key L0 columns", 3, params.mNumColumns);
    268         assertEquals("3 key L0 rows", 1, params.mNumRows);
    269         assertEquals("3 key L0 left", 0, params.mLeftKeys);
    270         assertEquals("3 key L0 right", 3, params.mRightKeys);
    271         assertEquals("3 key L0 [1]", 0, params.getColumnPos(0));
    272         assertEquals("3 key L0 [2]", 1, params.getColumnPos(1));
    273         assertEquals("3 key L0 [3]", 2, params.getColumnPos(2));
    274         assertEquals("3 key L0 adjust", 0, params.mTopRowAdjustment);
    275         assertEquals("3 key L0 default", WIDTH * 0, params.getDefaultKeyCoordX());
    276     }
    277 
    278     // |___ [1] [2] [3]
    279     public void testLayout3KeyL1() {
    280         MiniKeyboardParams params = new MiniKeyboardParams(3, MAX_COLUMNS, WIDTH,
    281                 HEIGHT, XPOS_L1, KEYBOARD_WIDTH);
    282         assertEquals("3 key L1 columns", 3, params.mNumColumns);
    283         assertEquals("3 key L1 rows", 1, params.mNumRows);
    284         assertEquals("3 key L1 left", 0, params.mLeftKeys);
    285         assertEquals("3 key L1 right", 3, params.mRightKeys);
    286         assertEquals("3 key L1 [1]", 0, params.getColumnPos(0));
    287         assertEquals("3 key L1 [2]", 1, params.getColumnPos(1));
    288         assertEquals("3 key L1 [3]", 2, params.getColumnPos(2));
    289         assertEquals("3 key L1 adjust", 0, params.mTopRowAdjustment);
    290         assertEquals("3 key L1 default", WIDTH * 0, params.getDefaultKeyCoordX());
    291     }
    292 
    293     // |___ ___ [3] [1] [2]
    294     public void testLayout3KeyL2() {
    295         MiniKeyboardParams params = new MiniKeyboardParams(3, MAX_COLUMNS, WIDTH,
    296                 HEIGHT, XPOS_L2, KEYBOARD_WIDTH);
    297         assertEquals("3 key L2 columns", 3, params.mNumColumns);
    298         assertEquals("3 key L2 rows", 1, params.mNumRows);
    299         assertEquals("3 key L2 left", 1, params.mLeftKeys);
    300         assertEquals("3 key L2 right", 2, params.mRightKeys);
    301         assertEquals("3 key L2 [1]", 0, params.getColumnPos(0));
    302         assertEquals("3 key L2 [2]", 1, params.getColumnPos(1));
    303         assertEquals("3 key L2 [3]", -1, params.getColumnPos(2));
    304         assertEquals("3 key L2 adjust", 0, params.mTopRowAdjustment);
    305         assertEquals("3 key L2 default", WIDTH * 1, params.getDefaultKeyCoordX());
    306     }
    307 
    308     // [3] [2] [1]|
    309     public void testLayout3KeyR0() {
    310         MiniKeyboardParams params = new MiniKeyboardParams(3, MAX_COLUMNS, WIDTH,
    311                 HEIGHT, XPOS_R0, KEYBOARD_WIDTH);
    312         assertEquals("3 key R0 columns", 3, params.mNumColumns);
    313         assertEquals("3 key R0 rows", 1, params.mNumRows);
    314         assertEquals("3 key R0 left", 2, params.mLeftKeys);
    315         assertEquals("3 key R0 right", 1, params.mRightKeys);
    316         assertEquals("3 key R0 [1]", 0, params.getColumnPos(0));
    317         assertEquals("3 key R0 [2]", -1, params.getColumnPos(1));
    318         assertEquals("3 key R0 [3]", -2, params.getColumnPos(2));
    319         assertEquals("3 key R0 adjust", 0, params.mTopRowAdjustment);
    320         assertEquals("3 key R0 default", WIDTH * 2, params.getDefaultKeyCoordX());
    321     }
    322 
    323     // [3] [2] [1] ___|
    324     public void testLayout3KeyR1() {
    325         MiniKeyboardParams params = new MiniKeyboardParams(3, MAX_COLUMNS, WIDTH,
    326                 HEIGHT, XPOS_R1, KEYBOARD_WIDTH);
    327         assertEquals("3 key R1 columns", 3, params.mNumColumns);
    328         assertEquals("3 key R1 rows", 1, params.mNumRows);
    329         assertEquals("3 key R1 left", 2, params.mLeftKeys);
    330         assertEquals("3 key R1 right", 1, params.mRightKeys);
    331         assertEquals("3 key R1 [1]", 0, params.getColumnPos(0));
    332         assertEquals("3 key R1 [2]", -1, params.getColumnPos(1));
    333         assertEquals("3 key R1 [3]", -2, params.getColumnPos(2));
    334         assertEquals("3 key R1 adjust", 0, params.mTopRowAdjustment);
    335         assertEquals("3 key R1 default", WIDTH * 2, params.getDefaultKeyCoordX());
    336     }
    337 
    338     // [3] [1] [2] ___ ___|
    339     public void testLayout3KeyR2() {
    340         MiniKeyboardParams params = new MiniKeyboardParams(3, MAX_COLUMNS, WIDTH,
    341                 HEIGHT, XPOS_R2, KEYBOARD_WIDTH);
    342         assertEquals("3 key R2 columns", 3, params.mNumColumns);
    343         assertEquals("3 key R2 rows", 1, params.mNumRows);
    344         assertEquals("3 key R2 left", 1, params.mLeftKeys);
    345         assertEquals("3 key R2 right", 2, params.mRightKeys);
    346         assertEquals("3 key R2 [1]", 0, params.getColumnPos(0));
    347         assertEquals("3 key R2 [2]", 1, params.getColumnPos(1));
    348         assertEquals("3 key R2 [3]", -1, params.getColumnPos(2));
    349         assertEquals("3 key R2 adjust", 0, params.mTopRowAdjustment);
    350         assertEquals("3 key R2 default", WIDTH * 1, params.getDefaultKeyCoordX());
    351     }
    352 
    353     // [3] [1] [2] [4]
    354     public void testLayout4KeyM0() {
    355         MiniKeyboardParams params = new MiniKeyboardParams(4, MAX_COLUMNS, WIDTH,
    356                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
    357         assertEquals("4 key columns", 4, params.mNumColumns);
    358         assertEquals("4 key rows", 1, params.mNumRows);
    359         assertEquals("4 key left", 1, params.mLeftKeys);
    360         assertEquals("4 key right", 3, params.mRightKeys);
    361         assertEquals("4 key [1]", 0, params.getColumnPos(0));
    362         assertEquals("4 key [2]", 1, params.getColumnPos(1));
    363         assertEquals("4 key [3]", -1, params.getColumnPos(2));
    364         assertEquals("4 key [4]", 2, params.getColumnPos(3));
    365         assertEquals("4 key adjust", 0, params.mTopRowAdjustment);
    366         assertEquals("4 key default", WIDTH * 1, params.getDefaultKeyCoordX());
    367     }
    368 
    369     // |[1] [2] [3] [4]
    370     public void testLayout4KeyL0() {
    371         MiniKeyboardParams params = new MiniKeyboardParams(4, MAX_COLUMNS, WIDTH,
    372                 HEIGHT, XPOS_L0, KEYBOARD_WIDTH);
    373         assertEquals("4 key L0 columns", 4, params.mNumColumns);
    374         assertEquals("4 key L0 rows", 1, params.mNumRows);
    375         assertEquals("4 key L0 left", 0, params.mLeftKeys);
    376         assertEquals("4 key L0 right", 4, params.mRightKeys);
    377         assertEquals("4 key L0 [1]", 0, params.getColumnPos(0));
    378         assertEquals("4 key L0 [2]", 1, params.getColumnPos(1));
    379         assertEquals("4 key L0 [3]", 2, params.getColumnPos(2));
    380         assertEquals("4 key L0 [4]", 3, params.getColumnPos(3));
    381         assertEquals("4 key L0 adjust", 0, params.mTopRowAdjustment);
    382         assertEquals("4 key L0 default", WIDTH * 0, params.getDefaultKeyCoordX());
    383     }
    384 
    385     // |___ [1] [2] [3] [4]
    386     public void testLayout4KeyL1() {
    387         MiniKeyboardParams params = new MiniKeyboardParams(4, MAX_COLUMNS, WIDTH,
    388                 HEIGHT, XPOS_L1, KEYBOARD_WIDTH);
    389         assertEquals("4 key L1 columns", 4, params.mNumColumns);
    390         assertEquals("4 key L1 rows", 1, params.mNumRows);
    391         assertEquals("4 key L1 left", 0, params.mLeftKeys);
    392         assertEquals("4 key L1 right", 4, params.mRightKeys);
    393         assertEquals("4 key L1 [1]", 0, params.getColumnPos(0));
    394         assertEquals("4 key L1 [2]", 1, params.getColumnPos(1));
    395         assertEquals("4 key L1 [3]", 2, params.getColumnPos(2));
    396         assertEquals("4 key L1 [4]", 3, params.getColumnPos(3));
    397         assertEquals("4 key L1 adjust", 0, params.mTopRowAdjustment);
    398         assertEquals("4 key L1 default", WIDTH * 0, params.getDefaultKeyCoordX());
    399     }
    400 
    401     // |___ ___ [3] [1] [2] [4]
    402     public void testLayout4KeyL2() {
    403         MiniKeyboardParams params = new MiniKeyboardParams(4, MAX_COLUMNS, WIDTH,
    404                 HEIGHT, XPOS_L2, KEYBOARD_WIDTH);
    405         assertEquals("4 key L2 columns", 4, params.mNumColumns);
    406         assertEquals("4 key L2 rows", 1, params.mNumRows);
    407         assertEquals("4 key L2 left", 1, params.mLeftKeys);
    408         assertEquals("4 key L2 right", 3, params.mRightKeys);
    409         assertEquals("4 key L2 [1]", 0, params.getColumnPos(0));
    410         assertEquals("4 key L2 [2]", 1, params.getColumnPos(1));
    411         assertEquals("4 key L2 [3]", -1, params.getColumnPos(2));
    412         assertEquals("4 key L2 [4]", 2, params.getColumnPos(3));
    413         assertEquals("4 key L2 adjust", 0, params.mTopRowAdjustment);
    414         assertEquals("4 key L2 default", WIDTH * 1, params.getDefaultKeyCoordX());
    415     }
    416 
    417     // [4] [3] [2] [1]|
    418     public void testLayout4KeyR0() {
    419         MiniKeyboardParams params = new MiniKeyboardParams(4, MAX_COLUMNS, WIDTH,
    420                 HEIGHT, XPOS_R0, KEYBOARD_WIDTH);
    421         assertEquals("4 key R0 columns", 4, params.mNumColumns);
    422         assertEquals("4 key R0 rows", 1, params.mNumRows);
    423         assertEquals("4 key R0 left", 3, params.mLeftKeys);
    424         assertEquals("4 key R0 right", 1, params.mRightKeys);
    425         assertEquals("4 key R0 [1]", 0, params.getColumnPos(0));
    426         assertEquals("4 key R0 [2]", -1, params.getColumnPos(1));
    427         assertEquals("4 key R0 [3]", -2, params.getColumnPos(2));
    428         assertEquals("4 key R0 [4]", -3, params.getColumnPos(3));
    429         assertEquals("4 key R0 adjust", 0, params.mTopRowAdjustment);
    430         assertEquals("4 key R0 default", WIDTH * 3, params.getDefaultKeyCoordX());
    431     }
    432 
    433     // [4] [3] [2] [1] ___|
    434     public void testLayout4KeyR1() {
    435         MiniKeyboardParams params = new MiniKeyboardParams(4, MAX_COLUMNS, WIDTH,
    436                 HEIGHT, XPOS_R1, KEYBOARD_WIDTH);
    437         assertEquals("4 key R1 columns", 4, params.mNumColumns);
    438         assertEquals("4 key R1 rows", 1, params.mNumRows);
    439         assertEquals("4 key R1 left", 3, params.mLeftKeys);
    440         assertEquals("4 key R1 right", 1, params.mRightKeys);
    441         assertEquals("4 key R1 [1]", 0, params.getColumnPos(0));
    442         assertEquals("4 key R1 [2]", -1, params.getColumnPos(1));
    443         assertEquals("4 key R1 [3]", -2, params.getColumnPos(2));
    444         assertEquals("4 key R1 [4]", -3, params.getColumnPos(3));
    445         assertEquals("4 key R1 adjust", 0, params.mTopRowAdjustment);
    446         assertEquals("4 key R1 default", WIDTH * 3, params.getDefaultKeyCoordX());
    447     }
    448 
    449     // [4] [3] [1] [2] ___ ___|
    450     public void testLayout4KeyR2() {
    451         MiniKeyboardParams params = new MiniKeyboardParams(4, MAX_COLUMNS, WIDTH,
    452                 HEIGHT, XPOS_R2, KEYBOARD_WIDTH);
    453         assertEquals("4 key R2 columns", 4, params.mNumColumns);
    454         assertEquals("4 key R2 rows", 1, params.mNumRows);
    455         assertEquals("4 key R2 left", 2, params.mLeftKeys);
    456         assertEquals("4 key R2 right", 2, params.mRightKeys);
    457         assertEquals("4 key R2 [1]", 0, params.getColumnPos(0));
    458         assertEquals("4 key R2 [2]", 1, params.getColumnPos(1));
    459         assertEquals("4 key R2 [3]", -1, params.getColumnPos(2));
    460         assertEquals("4 key R2 [4]", -2, params.getColumnPos(3));
    461         assertEquals("4 key R2 adjust", 0, params.mTopRowAdjustment);
    462         assertEquals("4 key R2 default", WIDTH * 2, params.getDefaultKeyCoordX());
    463     }
    464 
    465     // [5] [3] [1] [2] [4]
    466     public void testLayout5KeyM0() {
    467         MiniKeyboardParams params = new MiniKeyboardParams(5, MAX_COLUMNS, WIDTH,
    468                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
    469         assertEquals("5 key columns", 5, params.mNumColumns);
    470         assertEquals("5 key rows", 1, params.mNumRows);
    471         assertEquals("5 key left", 2, params.mLeftKeys);
    472         assertEquals("5 key right", 3, params.mRightKeys);
    473         assertEquals("5 key [1]", 0, params.getColumnPos(0));
    474         assertEquals("5 key [2]", 1, params.getColumnPos(1));
    475         assertEquals("5 key [3]", -1, params.getColumnPos(2));
    476         assertEquals("5 key [4]", 2, params.getColumnPos(3));
    477         assertEquals("5 key [5]", -2, params.getColumnPos(4));
    478         assertEquals("5 key adjust", 0, params.mTopRowAdjustment);
    479         assertEquals("5 key default", WIDTH * 2, params.getDefaultKeyCoordX());
    480     }
    481 
    482     // |[1] [2] [3] [4] [5]
    483     public void testLayout5KeyL0() {
    484         MiniKeyboardParams params = new MiniKeyboardParams(5, MAX_COLUMNS, WIDTH,
    485                 HEIGHT, XPOS_L0, KEYBOARD_WIDTH);
    486         assertEquals("5 key L0 columns", 5, params.mNumColumns);
    487         assertEquals("5 key L0 rows", 1, params.mNumRows);
    488         assertEquals("5 key L0 left", 0, params.mLeftKeys);
    489         assertEquals("5 key L0 right", 5, params.mRightKeys);
    490         assertEquals("5 key L0 [1]", 0, params.getColumnPos(0));
    491         assertEquals("5 key L0 [2]", 1, params.getColumnPos(1));
    492         assertEquals("5 key L0 [3]", 2, params.getColumnPos(2));
    493         assertEquals("5 key L0 [4]", 3, params.getColumnPos(3));
    494         assertEquals("5 key L0 [5]", 4, params.getColumnPos(4));
    495         assertEquals("5 key L0 adjust", 0, params.mTopRowAdjustment);
    496         assertEquals("5 key L0 default", WIDTH * 0, params.getDefaultKeyCoordX());
    497     }
    498 
    499     // |___ [1] [2] [3] [4] [5]
    500     public void testLayout5KeyL1() {
    501         MiniKeyboardParams params = new MiniKeyboardParams(5, MAX_COLUMNS, WIDTH,
    502                 HEIGHT, XPOS_L1, KEYBOARD_WIDTH);
    503         assertEquals("5 key L1 columns", 5, params.mNumColumns);
    504         assertEquals("5 key L1 rows", 1, params.mNumRows);
    505         assertEquals("5 key L1 left", 0, params.mLeftKeys);
    506         assertEquals("5 key L1 right", 5, params.mRightKeys);
    507         assertEquals("5 key L1 [1]", 0, params.getColumnPos(0));
    508         assertEquals("5 key L1 [2]", 1, params.getColumnPos(1));
    509         assertEquals("5 key L1 [3]", 2, params.getColumnPos(2));
    510         assertEquals("5 key L1 [4]", 3, params.getColumnPos(3));
    511         assertEquals("5 key L1 [5]", 4, params.getColumnPos(4));
    512         assertEquals("5 key L1 adjust", 0, params.mTopRowAdjustment);
    513         assertEquals("5 key L1 default", WIDTH * 0, params.getDefaultKeyCoordX());
    514     }
    515 
    516     // |___ ___ [3] [1] [2] [4] [5]
    517     public void testLayout5KeyL2() {
    518         MiniKeyboardParams params = new MiniKeyboardParams(5, MAX_COLUMNS, WIDTH,
    519                 HEIGHT, XPOS_L2, KEYBOARD_WIDTH);
    520         assertEquals("5 key L2 columns", 5, params.mNumColumns);
    521         assertEquals("5 key L2 rows", 1, params.mNumRows);
    522         assertEquals("5 key L2 left", 1, params.mLeftKeys);
    523         assertEquals("5 key L2 right", 4, params.mRightKeys);
    524         assertEquals("5 key L2 [1]", 0, params.getColumnPos(0));
    525         assertEquals("5 key L2 [2]", 1, params.getColumnPos(1));
    526         assertEquals("5 key L2 [3]", -1, params.getColumnPos(2));
    527         assertEquals("5 key L2 [4]", 2, params.getColumnPos(3));
    528         assertEquals("5 key L2 [5]", 3, params.getColumnPos(4));
    529         assertEquals("5 key L2 adjust", 0, params.mTopRowAdjustment);
    530         assertEquals("5 key L2 default", WIDTH * 1, params.getDefaultKeyCoordX());
    531     }
    532 
    533     // [5] [4] [3] [2] [1]|
    534     public void testLayout5KeyR0() {
    535         MiniKeyboardParams params = new MiniKeyboardParams(5, MAX_COLUMNS, WIDTH,
    536                 HEIGHT, XPOS_R0, KEYBOARD_WIDTH);
    537         assertEquals("5 key R0 columns", 5, params.mNumColumns);
    538         assertEquals("5 key R0 rows", 1, params.mNumRows);
    539         assertEquals("5 key R0 left", 4, params.mLeftKeys);
    540         assertEquals("5 key R0 right", 1, params.mRightKeys);
    541         assertEquals("5 key R0 [1]", 0, params.getColumnPos(0));
    542         assertEquals("5 key R0 [2]", -1, params.getColumnPos(1));
    543         assertEquals("5 key R0 [3]", -2, params.getColumnPos(2));
    544         assertEquals("5 key R0 [4]", -3, params.getColumnPos(3));
    545         assertEquals("5 key R0 [5]", -4, params.getColumnPos(4));
    546         assertEquals("5 key R0 adjust", 0, params.mTopRowAdjustment);
    547         assertEquals("5 key R0 default", WIDTH * 4, params.getDefaultKeyCoordX());
    548     }
    549 
    550     // [5] [4] [3] [2] [1] ___|
    551     public void testLayout5KeyR1() {
    552         MiniKeyboardParams params = new MiniKeyboardParams(5, MAX_COLUMNS, WIDTH,
    553                 HEIGHT, XPOS_R1, KEYBOARD_WIDTH);
    554         assertEquals("5 key R1 columns", 5, params.mNumColumns);
    555         assertEquals("5 key R1 rows", 1, params.mNumRows);
    556         assertEquals("5 key R1 left", 4, params.mLeftKeys);
    557         assertEquals("5 key R1 right", 1, params.mRightKeys);
    558         assertEquals("5 key R1 [1]", 0, params.getColumnPos(0));
    559         assertEquals("5 key R1 [2]", -1, params.getColumnPos(1));
    560         assertEquals("5 key R1 [3]", -2, params.getColumnPos(2));
    561         assertEquals("5 key R1 [4]", -3, params.getColumnPos(3));
    562         assertEquals("5 key R1 [5]", -4, params.getColumnPos(4));
    563         assertEquals("5 key R1 adjust", 0, params.mTopRowAdjustment);
    564         assertEquals("5 key R1 default", WIDTH * 4, params.getDefaultKeyCoordX());
    565     }
    566 
    567     // [5] [4] [3] [1] [2] ___ ___|
    568     public void testLayout5KeyR2() {
    569         MiniKeyboardParams params = new MiniKeyboardParams(5, MAX_COLUMNS, WIDTH,
    570                 HEIGHT, XPOS_R2, KEYBOARD_WIDTH);
    571         assertEquals("5 key R2 columns", 5, params.mNumColumns);
    572         assertEquals("5 key R2 rows", 1, params.mNumRows);
    573         assertEquals("5 key R2 left", 3, params.mLeftKeys);
    574         assertEquals("5 key R2 right", 2, params.mRightKeys);
    575         assertEquals("5 key R2 [1]", 0, params.getColumnPos(0));
    576         assertEquals("5 key R2 [2]", 1, params.getColumnPos(1));
    577         assertEquals("5 key R2 [3]", -1, params.getColumnPos(2));
    578         assertEquals("5 key R2 [4]", -2, params.getColumnPos(3));
    579         assertEquals("5 key R2 [5]", -3, params.getColumnPos(4));
    580         assertEquals("5 key R2 adjust", 0, params.mTopRowAdjustment);
    581         assertEquals("5 key R2 default", WIDTH * 3, params.getDefaultKeyCoordX());
    582     }
    583 
    584     // [6] [4] [5]
    585     // [3] [1] [2]
    586     public void testLayout6KeyM0() {
    587         MiniKeyboardParams params = new MiniKeyboardParams(6, MAX_COLUMNS, WIDTH,
    588                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
    589         assertEquals("6 key columns", 3, params.mNumColumns);
    590         assertEquals("6 key rows", 2, params.mNumRows);
    591         assertEquals("6 key left", 1, params.mLeftKeys);
    592         assertEquals("6 key right", 2, params.mRightKeys);
    593         assertEquals("6 key [1]", 0, params.getColumnPos(0));
    594         assertEquals("6 key [2]", 1, params.getColumnPos(1));
    595         assertEquals("6 key [3]", -1, params.getColumnPos(2));
    596         assertEquals("6 key [4]", 0, params.getColumnPos(3));
    597         assertEquals("6 key [5]", 1, params.getColumnPos(4));
    598         assertEquals("6 key [6]", -1, params.getColumnPos(5));
    599         assertEquals("6 key adjust", 0, params.mTopRowAdjustment);
    600         assertEquals("6 key default", WIDTH * 1, params.getDefaultKeyCoordX());
    601     }
    602 
    603     // |[4] [5] [6]
    604     // |[1] [2] [3]
    605     public void testLayout6KeyL0() {
    606         MiniKeyboardParams params = new MiniKeyboardParams(6, MAX_COLUMNS, WIDTH,
    607                 HEIGHT, XPOS_L0, KEYBOARD_WIDTH);
    608         assertEquals("6 key L0 columns", 3, params.mNumColumns);
    609         assertEquals("6 key L0 rows", 2, params.mNumRows);
    610         assertEquals("6 key L0 left", 0, params.mLeftKeys);
    611         assertEquals("6 key L0 right", 3, params.mRightKeys);
    612         assertEquals("6 key L0 [1]", 0, params.getColumnPos(0));
    613         assertEquals("6 key L0 [2]", 1, params.getColumnPos(1));
    614         assertEquals("6 key L0 [3]", 2, params.getColumnPos(2));
    615         assertEquals("6 key L0 [4]", 0, params.getColumnPos(3));
    616         assertEquals("6 key L0 [5]", 1, params.getColumnPos(4));
    617         assertEquals("6 key L0 [6]", 2, params.getColumnPos(5));
    618         assertEquals("6 key L0 adjust", 0, params.mTopRowAdjustment);
    619         assertEquals("6 key L0 default", WIDTH * 0, params.getDefaultKeyCoordX());
    620     }
    621 
    622     // |___ [4] [5] [6]
    623     // |___ [1] [2] [3]
    624     public void testLayout6KeyL1() {
    625         MiniKeyboardParams params = new MiniKeyboardParams(6, MAX_COLUMNS, WIDTH,
    626                 HEIGHT, XPOS_L1, KEYBOARD_WIDTH);
    627         assertEquals("6 key L1 columns", 3, params.mNumColumns);
    628         assertEquals("6 key L1 rows", 2, params.mNumRows);
    629         assertEquals("6 key L1 left", 0, params.mLeftKeys);
    630         assertEquals("6 key L1 right", 3, params.mRightKeys);
    631         assertEquals("6 key L1 [1]", 0, params.getColumnPos(0));
    632         assertEquals("6 key L1 [2]", 1, params.getColumnPos(1));
    633         assertEquals("6 key L1 [3]", 2, params.getColumnPos(2));
    634         assertEquals("6 key L1 [4]", 0, params.getColumnPos(3));
    635         assertEquals("6 key L1 [5]", 1, params.getColumnPos(4));
    636         assertEquals("6 key L1 [6]", 2, params.getColumnPos(5));
    637         assertEquals("6 key L1 adjust", 0, params.mTopRowAdjustment);
    638         assertEquals("6 key L1 default", WIDTH * 0, params.getDefaultKeyCoordX());
    639     }
    640 
    641     // |___ ___ [6] [4] [5]
    642     // |___ ___ [3] [1] [2]
    643     public void testLayout6KeyL2() {
    644         MiniKeyboardParams params = new MiniKeyboardParams(6, MAX_COLUMNS, WIDTH,
    645                 HEIGHT, XPOS_L2, KEYBOARD_WIDTH);
    646         assertEquals("6 key L2 columns", 3, params.mNumColumns);
    647         assertEquals("6 key L2 rows", 2, params.mNumRows);
    648         assertEquals("6 key L2 left", 1, params.mLeftKeys);
    649         assertEquals("6 key L2 right", 2, params.mRightKeys);
    650         assertEquals("6 key L2 [1]", 0, params.getColumnPos(0));
    651         assertEquals("6 key L2 [2]", 1, params.getColumnPos(1));
    652         assertEquals("6 key L2 [3]", -1, params.getColumnPos(2));
    653         assertEquals("6 key L2 [4]", 0, params.getColumnPos(3));
    654         assertEquals("6 key L2 [5]", 1, params.getColumnPos(4));
    655         assertEquals("6 key L2 [6]", -1, params.getColumnPos(5));
    656         assertEquals("6 key L2 adjust", 0, params.mTopRowAdjustment);
    657         assertEquals("6 key L2 default", WIDTH * 1, params.getDefaultKeyCoordX());
    658     }
    659 
    660     // [6] [5] [4]|
    661     // [3] [2] [1]|
    662     public void testLayout6KeyR0() {
    663         MiniKeyboardParams params = new MiniKeyboardParams(6, MAX_COLUMNS, WIDTH,
    664                 HEIGHT, XPOS_R0, KEYBOARD_WIDTH);
    665         assertEquals("6 key R0 columns", 3, params.mNumColumns);
    666         assertEquals("6 key R0 rows", 2, params.mNumRows);
    667         assertEquals("6 key R0 left", 2, params.mLeftKeys);
    668         assertEquals("6 key R0 right", 1, params.mRightKeys);
    669         assertEquals("6 key R0 [1]", 0, params.getColumnPos(0));
    670         assertEquals("6 key R0 [2]", -1, params.getColumnPos(1));
    671         assertEquals("6 key R0 [3]", -2, params.getColumnPos(2));
    672         assertEquals("6 key R0 [4]", 0, params.getColumnPos(3));
    673         assertEquals("6 key R0 [5]", -1, params.getColumnPos(4));
    674         assertEquals("6 key R0 [6]", -2, params.getColumnPos(5));
    675         assertEquals("6 key R0 adjust", 0, params.mTopRowAdjustment);
    676         assertEquals("6 key R0 default", WIDTH * 2, params.getDefaultKeyCoordX());
    677     }
    678 
    679     // [6] [5] [4] ___|
    680     // [3] [2] [1] ___|
    681     public void testLayout6KeyR1() {
    682         MiniKeyboardParams params = new MiniKeyboardParams(6, MAX_COLUMNS, WIDTH,
    683                 HEIGHT, XPOS_R1, KEYBOARD_WIDTH);
    684         assertEquals("6 key R1 columns", 3, params.mNumColumns);
    685         assertEquals("6 key R1 rows", 2, params.mNumRows);
    686         assertEquals("6 key R1 left", 2, params.mLeftKeys);
    687         assertEquals("6 key R1 right", 1, params.mRightKeys);
    688         assertEquals("6 key R1 [1]", 0, params.getColumnPos(0));
    689         assertEquals("6 key R1 [2]", -1, params.getColumnPos(1));
    690         assertEquals("6 key R1 [3]", -2, params.getColumnPos(2));
    691         assertEquals("6 key R1 [4]", 0, params.getColumnPos(3));
    692         assertEquals("6 key R1 [5]", -1, params.getColumnPos(4));
    693         assertEquals("6 key R1 [6]", -2, params.getColumnPos(5));
    694         assertEquals("6 key R1 adjust", 0, params.mTopRowAdjustment);
    695         assertEquals("6 key R1 default", WIDTH * 2, params.getDefaultKeyCoordX());
    696     }
    697 
    698     // [6] [4] [5] ___ ___|
    699     // [3] [1] [2] ___ ___|
    700     public void testLayout6KeyR2() {
    701         MiniKeyboardParams params = new MiniKeyboardParams(6, MAX_COLUMNS, WIDTH,
    702                 HEIGHT, XPOS_R2, KEYBOARD_WIDTH);
    703         assertEquals("6 key R2 columns", 3, params.mNumColumns);
    704         assertEquals("6 key R2 rows", 2, params.mNumRows);
    705         assertEquals("6 key R2 left", 1, params.mLeftKeys);
    706         assertEquals("6 key R2 right", 2, params.mRightKeys);
    707         assertEquals("6 key R2 [1]", 0, params.getColumnPos(0));
    708         assertEquals("6 key R2 [2]", 1, params.getColumnPos(1));
    709         assertEquals("6 key R2 [3]", -1, params.getColumnPos(2));
    710         assertEquals("6 key R2 [4]", 0, params.getColumnPos(3));
    711         assertEquals("6 key R2 [5]", 1, params.getColumnPos(4));
    712         assertEquals("6 key R2 [6]", -1, params.getColumnPos(5));
    713         assertEquals("6 key R2 adjust", 0, params.mTopRowAdjustment);
    714         assertEquals("6 key R2 default", WIDTH * 1, params.getDefaultKeyCoordX());
    715     }
    716 
    717     //   [7] [5] [6]
    718     // [3] [1] [2] [4]
    719     public void testLayout7KeyM0() {
    720         MiniKeyboardParams params = new MiniKeyboardParams(7, MAX_COLUMNS, WIDTH,
    721                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
    722         assertEquals("7 key columns", 4, params.mNumColumns);
    723         assertEquals("7 key rows", 2, params.mNumRows);
    724         assertEquals("7 key left", 1, params.mLeftKeys);
    725         assertEquals("7 key right", 3, params.mRightKeys);
    726         assertEquals("7 key [1]", 0, params.getColumnPos(0));
    727         assertEquals("7 key [2]", 1, params.getColumnPos(1));
    728         assertEquals("7 key [3]", -1, params.getColumnPos(2));
    729         assertEquals("7 key [4]", 2, params.getColumnPos(3));
    730         assertEquals("7 key [5]", 0, params.getColumnPos(4));
    731         assertEquals("7 key [6]", 1, params.getColumnPos(5));
    732         assertEquals("7 key [7]", -1, params.getColumnPos(6));
    733         assertEquals("7 key adjust", 1, params.mTopRowAdjustment);
    734         assertEquals("7 key default", WIDTH * 1, params.getDefaultKeyCoordX());
    735     }
    736 
    737     // |[5] [6] [7]
    738     // |[1] [2] [3] [4]
    739     public void testLayout7KeyL0() {
    740         MiniKeyboardParams params = new MiniKeyboardParams(7, MAX_COLUMNS, WIDTH,
    741                 HEIGHT, XPOS_L0, KEYBOARD_WIDTH);
    742         assertEquals("7 key L0 columns", 4, params.mNumColumns);
    743         assertEquals("7 key L0 rows", 2, params.mNumRows);
    744         assertEquals("7 key L0 left", 0, params.mLeftKeys);
    745         assertEquals("7 key L0 right", 4, params.mRightKeys);
    746         assertEquals("7 key L0 [1]", 0, params.getColumnPos(0));
    747         assertEquals("7 key L0 [2]", 1, params.getColumnPos(1));
    748         assertEquals("7 key L0 [3]", 2, params.getColumnPos(2));
    749         assertEquals("7 key L0 [4]", 3, params.getColumnPos(3));
    750         assertEquals("7 key L0 [5]", 0, params.getColumnPos(4));
    751         assertEquals("7 key L0 [6]", 1, params.getColumnPos(5));
    752         assertEquals("7 key L0 [7]", 2, params.getColumnPos(6));
    753         assertEquals("7 key L0 adjust", 0, params.mTopRowAdjustment);
    754         assertEquals("7 key L0 default", WIDTH * 0, params.getDefaultKeyCoordX());
    755     }
    756 
    757     // |___ [5] [6] [7]
    758     // |___ [1] [2] [3] [4]
    759     public void testLayout7KeyL1() {
    760         MiniKeyboardParams params = new MiniKeyboardParams(7, MAX_COLUMNS, WIDTH,
    761                 HEIGHT, XPOS_L1, KEYBOARD_WIDTH);
    762         assertEquals("7 key L1 columns", 4, params.mNumColumns);
    763         assertEquals("7 key L1 rows", 2, params.mNumRows);
    764         assertEquals("7 key L1 left", 0, params.mLeftKeys);
    765         assertEquals("7 key L1 right", 4, params.mRightKeys);
    766         assertEquals("7 key L1 [1]", 0, params.getColumnPos(0));
    767         assertEquals("7 key L1 [2]", 1, params.getColumnPos(1));
    768         assertEquals("7 key L1 [3]", 2, params.getColumnPos(2));
    769         assertEquals("7 key L1 [4]", 3, params.getColumnPos(3));
    770         assertEquals("7 key L1 [5]", 0, params.getColumnPos(4));
    771         assertEquals("7 key L1 [6]", 1, params.getColumnPos(5));
    772         assertEquals("7 key L1 [7]", 2, params.getColumnPos(6));
    773         assertEquals("7 key L1 adjust", 0, params.mTopRowAdjustment);
    774         assertEquals("7 key L1 default", WIDTH * 0, params.getDefaultKeyCoordX());
    775     }
    776 
    777     // |___ ___   [7] [5] [6]
    778     // |___ ___ [3] [1] [2] [4]
    779     public void testLayout7KeyL2() {
    780         MiniKeyboardParams params = new MiniKeyboardParams(7, MAX_COLUMNS, WIDTH,
    781                 HEIGHT, XPOS_L2, KEYBOARD_WIDTH);
    782         assertEquals("7 key L2 columns", 4, params.mNumColumns);
    783         assertEquals("7 key L2 rows", 2, params.mNumRows);
    784         assertEquals("7 key L2 left", 1, params.mLeftKeys);
    785         assertEquals("7 key L2 right", 3, params.mRightKeys);
    786         assertEquals("7 key L2 [1]", 0, params.getColumnPos(0));
    787         assertEquals("7 key L2 [2]", 1, params.getColumnPos(1));
    788         assertEquals("7 key L2 [3]", -1, params.getColumnPos(2));
    789         assertEquals("7 key L2 [4]", 2, params.getColumnPos(3));
    790         assertEquals("7 key L2 [5]", 0, params.getColumnPos(4));
    791         assertEquals("7 key L2 [6]", 1, params.getColumnPos(5));
    792         assertEquals("7 key L2 [7]", -1, params.getColumnPos(6));
    793         assertEquals("7 key L2 adjust", 1, params.mTopRowAdjustment);
    794         assertEquals("7 key L2 default", WIDTH * 1, params.getDefaultKeyCoordX());
    795     }
    796 
    797     //     [7] [6] [5]|
    798     // [4] [3] [2] [1]|
    799     public void testLayout7KeyR0() {
    800         MiniKeyboardParams params = new MiniKeyboardParams(7, MAX_COLUMNS, WIDTH,
    801                 HEIGHT, XPOS_R0, KEYBOARD_WIDTH);
    802         assertEquals("7 key R0 columns", 4, params.mNumColumns);
    803         assertEquals("7 key R0 rows", 2, params.mNumRows);
    804         assertEquals("7 key R0 left", 3, params.mLeftKeys);
    805         assertEquals("7 key R0 right", 1, params.mRightKeys);
    806         assertEquals("7 key R0 [1]", 0, params.getColumnPos(0));
    807         assertEquals("7 key R0 [2]", -1, params.getColumnPos(1));
    808         assertEquals("7 key R0 [3]", -2, params.getColumnPos(2));
    809         assertEquals("7 key R0 [4]", -3, params.getColumnPos(3));
    810         assertEquals("7 key R0 [5]", 0, params.getColumnPos(4));
    811         assertEquals("7 key R0 [6]", -1, params.getColumnPos(5));
    812         assertEquals("7 key R0 [7]", -2, params.getColumnPos(6));
    813         assertEquals("7 key R0 adjust", 0, params.mTopRowAdjustment);
    814         assertEquals("7 key R0 default", WIDTH * 3, params.getDefaultKeyCoordX());
    815     }
    816 
    817     //     [7] [6] [5] ___|
    818     // [4] [3] [2] [1] ___|
    819     public void testLayout7KeyR1() {
    820         MiniKeyboardParams params = new MiniKeyboardParams(7, MAX_COLUMNS, WIDTH,
    821                 HEIGHT, XPOS_R1, KEYBOARD_WIDTH);
    822         assertEquals("7 key R1 columns", 4, params.mNumColumns);
    823         assertEquals("7 key R1 rows", 2, params.mNumRows);
    824         assertEquals("7 key R1 left", 3, params.mLeftKeys);
    825         assertEquals("7 key R1 right", 1, params.mRightKeys);
    826         assertEquals("7 key R1 [1]", 0, params.getColumnPos(0));
    827         assertEquals("7 key R1 [2]", -1, params.getColumnPos(1));
    828         assertEquals("7 key R1 [3]", -2, params.getColumnPos(2));
    829         assertEquals("7 key R1 [4]", -3, params.getColumnPos(3));
    830         assertEquals("7 key R1 [5]", 0, params.getColumnPos(4));
    831         assertEquals("7 key R1 [6]", -1, params.getColumnPos(5));
    832         assertEquals("7 key R1 [7]", -2, params.getColumnPos(6));
    833         assertEquals("7 key R1 adjust", 0, params.mTopRowAdjustment);
    834         assertEquals("7 key R1 default", WIDTH * 3, params.getDefaultKeyCoordX());
    835     }
    836 
    837     //   [7] [5] [6]   ___ ___|
    838     // [4] [3] [1] [2] ___ ___|
    839     public void testLayout7KeyR2() {
    840         MiniKeyboardParams params = new MiniKeyboardParams(7, MAX_COLUMNS, WIDTH,
    841                 HEIGHT, XPOS_R2, KEYBOARD_WIDTH);
    842         assertEquals("7 key R2 columns", 4, params.mNumColumns);
    843         assertEquals("7 key R2 rows", 2, params.mNumRows);
    844         assertEquals("7 key R2 left", 2, params.mLeftKeys);
    845         assertEquals("7 key R2 right", 2, params.mRightKeys);
    846         assertEquals("7 key R2 [1]", 0, params.getColumnPos(0));
    847         assertEquals("7 key R2 [2]", 1, params.getColumnPos(1));
    848         assertEquals("7 key R2 [3]", -1, params.getColumnPos(2));
    849         assertEquals("7 key R2 [4]", -2, params.getColumnPos(3));
    850         assertEquals("7 key R2 [5]", 0, params.getColumnPos(4));
    851         assertEquals("7 key R2 [6]", 1, params.getColumnPos(5));
    852         assertEquals("7 key R2 [7]", -1, params.getColumnPos(6));
    853         assertEquals("7 key R2 adjust", -1, params.mTopRowAdjustment);
    854         assertEquals("7 key R2 default", WIDTH * 2, params.getDefaultKeyCoordX());
    855     }
    856 
    857     // [7] [6] [5] [3] [1] [2] [4] ___|
    858     public void testLayout7KeyR3Max7() {
    859         MiniKeyboardParams params = new MiniKeyboardParams(7, 7, WIDTH,
    860                 HEIGHT, XPOS_R3, KEYBOARD_WIDTH);
    861         assertEquals("7 key R2 columns", 7, params.mNumColumns);
    862         assertEquals("7 key R2 rows", 1, params.mNumRows);
    863         assertEquals("7 key R2 left", 4, params.mLeftKeys);
    864         assertEquals("7 key R2 right", 3, params.mRightKeys);
    865         assertEquals("7 key R2 [1]", 0, params.getColumnPos(0));
    866         assertEquals("7 key R2 [2]", 1, params.getColumnPos(1));
    867         assertEquals("7 key R2 [3]", -1, params.getColumnPos(2));
    868         assertEquals("7 key R2 [4]", 2, params.getColumnPos(3));
    869         assertEquals("7 key R2 [5]", -2, params.getColumnPos(4));
    870         assertEquals("7 key R2 [6]", -3, params.getColumnPos(5));
    871         assertEquals("7 key R2 [7]", -4, params.getColumnPos(6));
    872         assertEquals("7 key R2 adjust", 0, params.mTopRowAdjustment);
    873         assertEquals("7 key R2 default", WIDTH * 4, params.getDefaultKeyCoordX());
    874     }
    875 
    876     // [7] [5] [6] [8]
    877     // [3] [1] [2] [4]
    878     public void testLayout8KeyM0() {
    879         MiniKeyboardParams params = new MiniKeyboardParams(8, MAX_COLUMNS, WIDTH,
    880                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
    881         assertEquals("8 key M0 columns", 4, params.mNumColumns);
    882         assertEquals("8 key M0 rows", 2, params.mNumRows);
    883         assertEquals("8 key M0 left", 1, params.mLeftKeys);
    884         assertEquals("8 key M0 right", 3, params.mRightKeys);
    885         assertEquals("8 key M0 [1]", 0, params.getColumnPos(0));
    886         assertEquals("8 key M0 [2]", 1, params.getColumnPos(1));
    887         assertEquals("8 key M0 [3]", -1, params.getColumnPos(2));
    888         assertEquals("8 key M0 [4]", 2, params.getColumnPos(3));
    889         assertEquals("8 key M0 [5]", 0, params.getColumnPos(4));
    890         assertEquals("8 key M0 [6]", 1, params.getColumnPos(5));
    891         assertEquals("8 key M0 [7]", -1, params.getColumnPos(6));
    892         assertEquals("8 key M0 [8]", 2, params.getColumnPos(7));
    893         assertEquals("8 key M0 adjust", 0, params.mTopRowAdjustment);
    894         assertEquals("8 key M0 default", WIDTH * 1, params.getDefaultKeyCoordX());
    895     }
    896 
    897     // |[5] [6] [7] [8]
    898     // |[1] [2] [3] [4]
    899     public void testLayout8KeyL0() {
    900         MiniKeyboardParams params = new MiniKeyboardParams(8, MAX_COLUMNS, WIDTH,
    901                 HEIGHT, XPOS_L0, KEYBOARD_WIDTH);
    902         assertEquals("8 key L0 columns", 4, params.mNumColumns);
    903         assertEquals("8 key L0 rows", 2, params.mNumRows);
    904         assertEquals("8 key L0 left", 0, params.mLeftKeys);
    905         assertEquals("8 key L0 right", 4, params.mRightKeys);
    906         assertEquals("8 key L0 [1]", 0, params.getColumnPos(0));
    907         assertEquals("8 key L0 [2]", 1, params.getColumnPos(1));
    908         assertEquals("8 key L0 [3]", 2, params.getColumnPos(2));
    909         assertEquals("8 key L0 [4]", 3, params.getColumnPos(3));
    910         assertEquals("8 key L0 [5]", 0, params.getColumnPos(4));
    911         assertEquals("8 key L0 [6]", 1, params.getColumnPos(5));
    912         assertEquals("8 key L0 [7]", 2, params.getColumnPos(6));
    913         assertEquals("8 key L0 [8]", 3, params.getColumnPos(7));
    914         assertEquals("8 key L0 adjust", 0, params.mTopRowAdjustment);
    915         assertEquals("8 key L0 default", WIDTH * 0, params.getDefaultKeyCoordX());
    916     }
    917 
    918     // |___ [5] [6] [7] [8]
    919     // |___ [1] [2] [3] [4]
    920     public void testLayout8KeyL1() {
    921         MiniKeyboardParams params = new MiniKeyboardParams(8, MAX_COLUMNS, WIDTH,
    922                 HEIGHT, XPOS_L1, KEYBOARD_WIDTH);
    923         assertEquals("8 key L1 columns", 4, params.mNumColumns);
    924         assertEquals("8 key L1 rows", 2, params.mNumRows);
    925         assertEquals("8 key L1 left", 0, params.mLeftKeys);
    926         assertEquals("8 key L1 right", 4, params.mRightKeys);
    927         assertEquals("8 key L1 [1]", 0, params.getColumnPos(0));
    928         assertEquals("8 key L1 [2]", 1, params.getColumnPos(1));
    929         assertEquals("8 key L1 [3]", 2, params.getColumnPos(2));
    930         assertEquals("8 key L1 [4]", 3, params.getColumnPos(3));
    931         assertEquals("8 key L1 [5]", 0, params.getColumnPos(4));
    932         assertEquals("8 key L1 [6]", 1, params.getColumnPos(5));
    933         assertEquals("8 key L1 [7]", 2, params.getColumnPos(6));
    934         assertEquals("8 key L1 [8]", 3, params.getColumnPos(7));
    935         assertEquals("8 key L1 adjust", 0, params.mTopRowAdjustment);
    936         assertEquals("8 key L1 default", WIDTH * 0, params.getDefaultKeyCoordX());
    937     }
    938 
    939     // |___ ___ [7] [5] [6] [8]
    940     // |___ ___ [3] [1] [2] [4]
    941     public void testLayout8KeyL2() {
    942         MiniKeyboardParams params = new MiniKeyboardParams(8, MAX_COLUMNS, WIDTH,
    943                 HEIGHT, XPOS_L2, KEYBOARD_WIDTH);
    944         assertEquals("8 key L2 columns", 4, params.mNumColumns);
    945         assertEquals("8 key L2 rows", 2, params.mNumRows);
    946         assertEquals("8 key L2 left", 1, params.mLeftKeys);
    947         assertEquals("8 key L2 right", 3, params.mRightKeys);
    948         assertEquals("8 key L2 [1]", 0, params.getColumnPos(0));
    949         assertEquals("8 key L2 [2]", 1, params.getColumnPos(1));
    950         assertEquals("8 key L2 [3]", -1, params.getColumnPos(2));
    951         assertEquals("8 key L2 [4]", 2, params.getColumnPos(3));
    952         assertEquals("8 key L2 [5]", 0, params.getColumnPos(4));
    953         assertEquals("8 key L2 [6]", 1, params.getColumnPos(5));
    954         assertEquals("8 key L2 [7]", -1, params.getColumnPos(6));
    955         assertEquals("8 key L2 [8]", 2, params.getColumnPos(7));
    956         assertEquals("8 key L2 adjust", 0, params.mTopRowAdjustment);
    957         assertEquals("8 key L2 default", WIDTH * 1, params.getDefaultKeyCoordX());
    958     }
    959 
    960     // [8] [7] [6] [5]|
    961     // [4] [3] [2] [1]|
    962     public void testLayout8KeyR0() {
    963         MiniKeyboardParams params = new MiniKeyboardParams(8, MAX_COLUMNS, WIDTH,
    964                 HEIGHT, XPOS_R0, KEYBOARD_WIDTH);
    965         assertEquals("8 key R0 columns", 4, params.mNumColumns);
    966         assertEquals("8 key R0 rows", 2, params.mNumRows);
    967         assertEquals("8 key R0 left", 3, params.mLeftKeys);
    968         assertEquals("8 key R0 right", 1, params.mRightKeys);
    969         assertEquals("8 key R0 [1]", 0, params.getColumnPos(0));
    970         assertEquals("8 key R0 [2]", -1, params.getColumnPos(1));
    971         assertEquals("8 key R0 [3]", -2, params.getColumnPos(2));
    972         assertEquals("8 key R0 [4]", -3, params.getColumnPos(3));
    973         assertEquals("8 key R0 [5]", 0, params.getColumnPos(4));
    974         assertEquals("8 key R0 [6]", -1, params.getColumnPos(5));
    975         assertEquals("8 key R0 [7]", -2, params.getColumnPos(6));
    976         assertEquals("8 key R0 [8]", -3, params.getColumnPos(7));
    977         assertEquals("8 key R0 adjust", 0, params.mTopRowAdjustment);
    978         assertEquals("8 key R0 default", WIDTH * 3, params.getDefaultKeyCoordX());
    979     }
    980 
    981     // [8] [7] [6] [5] ___|
    982     // [4] [3] [2] [1] ___|
    983     public void testLayout8KeyR1() {
    984         MiniKeyboardParams params = new MiniKeyboardParams(8, MAX_COLUMNS, WIDTH,
    985                 HEIGHT, XPOS_R1, KEYBOARD_WIDTH);
    986         assertEquals("8 key R1 columns", 4, params.mNumColumns);
    987         assertEquals("8 key R1 rows", 2, params.mNumRows);
    988         assertEquals("8 key R1 left", 3, params.mLeftKeys);
    989         assertEquals("8 key R1 right", 1, params.mRightKeys);
    990         assertEquals("8 key R1 [1]", 0, params.getColumnPos(0));
    991         assertEquals("8 key R1 [2]", -1, params.getColumnPos(1));
    992         assertEquals("8 key R1 [3]", -2, params.getColumnPos(2));
    993         assertEquals("8 key R1 [4]", -3, params.getColumnPos(3));
    994         assertEquals("8 key R1 [5]", 0, params.getColumnPos(4));
    995         assertEquals("8 key R1 [6]", -1, params.getColumnPos(5));
    996         assertEquals("8 key R1 [7]", -2, params.getColumnPos(6));
    997         assertEquals("8 key R1 [8]", -3, params.getColumnPos(7));
    998         assertEquals("8 key R1 adjust", 0, params.mTopRowAdjustment);
    999         assertEquals("8 key R1 default", WIDTH * 3, params.getDefaultKeyCoordX());
   1000     }
   1001 
   1002     // [8] [7] [5] [6] ___ ___|
   1003     // [4] [3] [1] [2] ___ ___|
   1004     public void testLayout8KeyR2() {
   1005         MiniKeyboardParams params = new MiniKeyboardParams(8, MAX_COLUMNS, WIDTH,
   1006                 HEIGHT, XPOS_R2, KEYBOARD_WIDTH);
   1007         assertEquals("8 key R2 columns", 4, params.mNumColumns);
   1008         assertEquals("8 key R2 rows", 2, params.mNumRows);
   1009         assertEquals("8 key R2 left", 2, params.mLeftKeys);
   1010         assertEquals("8 key R2 right", 2, params.mRightKeys);
   1011         assertEquals("8 key R2 [1]", 0, params.getColumnPos(0));
   1012         assertEquals("8 key R2 [2]", 1, params.getColumnPos(1));
   1013         assertEquals("8 key R2 [3]", -1, params.getColumnPos(2));
   1014         assertEquals("8 key R2 [4]", -2, params.getColumnPos(3));
   1015         assertEquals("8 key R2 [5]", 0, params.getColumnPos(4));
   1016         assertEquals("8 key R2 [6]", 1, params.getColumnPos(5));
   1017         assertEquals("8 key R2 [7]", -1, params.getColumnPos(6));
   1018         assertEquals("8 key R2 [8]", -2, params.getColumnPos(7));
   1019         assertEquals("8 key R2 adjust", 0, params.mTopRowAdjustment);
   1020         assertEquals("8 key R2 default", WIDTH * 2, params.getDefaultKeyCoordX());
   1021     }
   1022 
   1023     //   [8] [6] [7] [9]
   1024     // [5] [3] [1] [2] [4]
   1025     public void testLayout9KeyM0() {
   1026         MiniKeyboardParams params = new MiniKeyboardParams(9, MAX_COLUMNS, WIDTH,
   1027                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
   1028         assertEquals("9 key M0 columns", 5, params.mNumColumns);
   1029         assertEquals("9 key M0 rows", 2, params.mNumRows);
   1030         assertEquals("9 key M0 left", 2, params.mLeftKeys);
   1031         assertEquals("9 key M0 right", 3, params.mRightKeys);
   1032         assertEquals("9 key M0 [1]", 0, params.getColumnPos(0));
   1033         assertEquals("9 key M0 [2]", 1, params.getColumnPos(1));
   1034         assertEquals("9 key M0 [3]", -1, params.getColumnPos(2));
   1035         assertEquals("9 key M0 [4]", 2, params.getColumnPos(3));
   1036         assertEquals("9 key M0 [5]", -2, params.getColumnPos(4));
   1037         assertEquals("9 key M0 [6]", 0, params.getColumnPos(5));
   1038         assertEquals("9 key M0 [7]", 1, params.getColumnPos(6));
   1039         assertEquals("9 key M0 [8]", -1, params.getColumnPos(7));
   1040         assertEquals("9 key M0 [9]", 2, params.getColumnPos(8));
   1041         assertEquals("9 key M0 adjust", -1, params.mTopRowAdjustment);
   1042         assertEquals("9 key M0 default", WIDTH * 2, params.getDefaultKeyCoordX());
   1043     }
   1044 
   1045     // |[6] [7] [8] [9]
   1046     // |[1] [2] [3] [4] [5]
   1047     public void testLayout9KeyL0() {
   1048         MiniKeyboardParams params = new MiniKeyboardParams(9, MAX_COLUMNS, WIDTH,
   1049                 HEIGHT, XPOS_L0, KEYBOARD_WIDTH);
   1050         assertEquals("9 key L0 columns", 5, params.mNumColumns);
   1051         assertEquals("9 key L0 rows", 2, params.mNumRows);
   1052         assertEquals("9 key L0 left", 0, params.mLeftKeys);
   1053         assertEquals("9 key L0 right", 5, params.mRightKeys);
   1054         assertEquals("9 key L0 [1]", 0, params.getColumnPos(0));
   1055         assertEquals("9 key L0 [2]", 1, params.getColumnPos(1));
   1056         assertEquals("9 key L0 [3]", 2, params.getColumnPos(2));
   1057         assertEquals("9 key L0 [4]", 3, params.getColumnPos(3));
   1058         assertEquals("9 key L0 [5]", 4, params.getColumnPos(4));
   1059         assertEquals("9 key L0 [6]", 0, params.getColumnPos(5));
   1060         assertEquals("9 key L0 [7]", 1, params.getColumnPos(6));
   1061         assertEquals("9 key L0 [8]", 2, params.getColumnPos(7));
   1062         assertEquals("9 key L0 [9]", 3, params.getColumnPos(8));
   1063         assertEquals("9 key L0 adjust", 0, params.mTopRowAdjustment);
   1064         assertEquals("9 key L0 default", WIDTH * 0, params.getDefaultKeyCoordX());
   1065     }
   1066 
   1067     // |___ [6] [7] [8] [9]
   1068     // |___ [1] [2] [3] [4] [5]
   1069     public void testLayout9KeyL1() {
   1070         MiniKeyboardParams params = new MiniKeyboardParams(9, MAX_COLUMNS, WIDTH,
   1071                 HEIGHT, XPOS_L1, KEYBOARD_WIDTH);
   1072         assertEquals("9 key L1 columns", 5, params.mNumColumns);
   1073         assertEquals("9 key L1 rows", 2, params.mNumRows);
   1074         assertEquals("9 key L1 left", 0, params.mLeftKeys);
   1075         assertEquals("9 key L1 right", 5, params.mRightKeys);
   1076         assertEquals("9 key L1 [1]", 0, params.getColumnPos(0));
   1077         assertEquals("9 key L1 [2]", 1, params.getColumnPos(1));
   1078         assertEquals("9 key L1 [3]", 2, params.getColumnPos(2));
   1079         assertEquals("9 key L1 [4]", 3, params.getColumnPos(3));
   1080         assertEquals("9 key L1 [5]", 4, params.getColumnPos(4));
   1081         assertEquals("9 key L1 [6]", 0, params.getColumnPos(5));
   1082         assertEquals("9 key L1 [7]", 1, params.getColumnPos(6));
   1083         assertEquals("9 key L1 [8]", 2, params.getColumnPos(7));
   1084         assertEquals("9 key L1 [9]", 3, params.getColumnPos(8));
   1085         assertEquals("9 key L1 adjust", 0, params.mTopRowAdjustment);
   1086         assertEquals("9 key L1 default", WIDTH * 0, params.getDefaultKeyCoordX());
   1087     }
   1088 
   1089     // |___ ___   [8] [6] [7] [9]
   1090     // |___ ___ [3] [1] [2] [4] [5]
   1091     public void testLayout9KeyL2() {
   1092         MiniKeyboardParams params = new MiniKeyboardParams(9, MAX_COLUMNS, WIDTH,
   1093                 HEIGHT, XPOS_L2, KEYBOARD_WIDTH);
   1094         assertEquals("9 key L2 columns", 5, params.mNumColumns);
   1095         assertEquals("9 key L2 rows", 2, params.mNumRows);
   1096         assertEquals("9 key L2 left", 1, params.mLeftKeys);
   1097         assertEquals("9 key L2 right", 4, params.mRightKeys);
   1098         assertEquals("9 key L2 [1]", 0, params.getColumnPos(0));
   1099         assertEquals("9 key L2 [2]", 1, params.getColumnPos(1));
   1100         assertEquals("9 key L2 [3]", -1, params.getColumnPos(2));
   1101         assertEquals("9 key L2 [4]", 2, params.getColumnPos(3));
   1102         assertEquals("9 key L2 [5]", 3, params.getColumnPos(4));
   1103         assertEquals("9 key L2 [6]", 0, params.getColumnPos(5));
   1104         assertEquals("9 key L2 [7]", 1, params.getColumnPos(6));
   1105         assertEquals("9 key L2 [8]", -1, params.getColumnPos(7));
   1106         assertEquals("9 key L2 [9]", 2, params.getColumnPos(8));
   1107         assertEquals("9 key L2 adjust", 1, params.mTopRowAdjustment);
   1108         assertEquals("9 key L2 default", WIDTH * 1, params.getDefaultKeyCoordX());
   1109     }
   1110 
   1111     //     [9] [8] [7] [6]|
   1112     // [5] [4] [3] [2] [1]|
   1113     public void testLayout9KeyR0() {
   1114         MiniKeyboardParams params = new MiniKeyboardParams(9, MAX_COLUMNS, WIDTH,
   1115                 HEIGHT, XPOS_R0, KEYBOARD_WIDTH);
   1116         assertEquals("9 key R0 columns", 5, params.mNumColumns);
   1117         assertEquals("9 key R0 rows", 2, params.mNumRows);
   1118         assertEquals("9 key R0 left", 4, params.mLeftKeys);
   1119         assertEquals("9 key R0 right", 1, params.mRightKeys);
   1120         assertEquals("9 key R0 [1]", 0, params.getColumnPos(0));
   1121         assertEquals("9 key R0 [2]", -1, params.getColumnPos(1));
   1122         assertEquals("9 key R0 [3]", -2, params.getColumnPos(2));
   1123         assertEquals("9 key R0 [4]", -3, params.getColumnPos(3));
   1124         assertEquals("9 key R0 [5]", -4, params.getColumnPos(4));
   1125         assertEquals("9 key R0 [6]", 0, params.getColumnPos(5));
   1126         assertEquals("9 key R0 [7]", -1, params.getColumnPos(6));
   1127         assertEquals("9 key R0 [8]", -2, params.getColumnPos(7));
   1128         assertEquals("9 key R0 [9]", -3, params.getColumnPos(8));
   1129         assertEquals("9 key R0 adjust", 0, params.mTopRowAdjustment);
   1130         assertEquals("9 key R0 default", WIDTH * 4, params.getDefaultKeyCoordX());
   1131     }
   1132 
   1133     //     [9] [8] [7] [6] ___|
   1134     // [5] [4] [3] [2] [1] ___|
   1135     public void testLayout9KeyR1() {
   1136         MiniKeyboardParams params = new MiniKeyboardParams(9, MAX_COLUMNS, WIDTH,
   1137                 HEIGHT, XPOS_R1, KEYBOARD_WIDTH);
   1138         assertEquals("9 key R1 columns", 5, params.mNumColumns);
   1139         assertEquals("9 key R1 rows", 2, params.mNumRows);
   1140         assertEquals("9 key R1 left", 4, params.mLeftKeys);
   1141         assertEquals("9 key R1 right", 1, params.mRightKeys);
   1142         assertEquals("9 key R1 [1]", 0, params.getColumnPos(0));
   1143         assertEquals("9 key R1 [2]", -1, params.getColumnPos(1));
   1144         assertEquals("9 key R1 [3]", -2, params.getColumnPos(2));
   1145         assertEquals("9 key R1 [4]", -3, params.getColumnPos(3));
   1146         assertEquals("9 key R1 [5]", -4, params.getColumnPos(4));
   1147         assertEquals("9 key R1 [6]", 0, params.getColumnPos(5));
   1148         assertEquals("9 key R1 [7]", -1, params.getColumnPos(6));
   1149         assertEquals("9 key R1 [8]", -2, params.getColumnPos(7));
   1150         assertEquals("9 key R1 [9]", -3, params.getColumnPos(8));
   1151         assertEquals("9 key R1 adjust", 0, params.mTopRowAdjustment);
   1152         assertEquals("9 key R1 default", WIDTH * 4, params.getDefaultKeyCoordX());
   1153     }
   1154 
   1155     //   [9] [8] [6] [7]   ___ ___|
   1156     // [5] [4] [3] [1] [2] ___ ___|
   1157     public void testLayout9KeyR2() {
   1158         MiniKeyboardParams params = new MiniKeyboardParams(9, MAX_COLUMNS, WIDTH,
   1159                 HEIGHT, XPOS_R2, KEYBOARD_WIDTH);
   1160         assertEquals("9 key R2 columns", 5, params.mNumColumns);
   1161         assertEquals("9 key R2 rows", 2, params.mNumRows);
   1162         assertEquals("9 key R2 left", 3, params.mLeftKeys);
   1163         assertEquals("9 key R2 right", 2, params.mRightKeys);
   1164         assertEquals("9 key R2 [1]", 0, params.getColumnPos(0));
   1165         assertEquals("9 key R2 [2]", 1, params.getColumnPos(1));
   1166         assertEquals("9 key R2 [3]", -1, params.getColumnPos(2));
   1167         assertEquals("9 key R2 [4]", -2, params.getColumnPos(3));
   1168         assertEquals("9 key R2 [5]", -3, params.getColumnPos(4));
   1169         assertEquals("9 key R2 [6]", 0, params.getColumnPos(5));
   1170         assertEquals("9 key R2 [7]", 1, params.getColumnPos(6));
   1171         assertEquals("9 key R2 [8]", -1, params.getColumnPos(7));
   1172         assertEquals("9 key R2 [9]", -2, params.getColumnPos(8));
   1173         assertEquals("9 key R2 adjust", -1, params.mTopRowAdjustment);
   1174         assertEquals("9 key R2 default", WIDTH * 3, params.getDefaultKeyCoordX());
   1175     }
   1176 
   1177     // [A] [8] [6] [7] [9]
   1178     // [5] [3] [1] [2] [4]
   1179     public void testLayout10KeyM0() {
   1180         MiniKeyboardParams params = new MiniKeyboardParams(10, MAX_COLUMNS, WIDTH,
   1181                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
   1182         assertEquals("10 key M0 columns", 5, params.mNumColumns);
   1183         assertEquals("10 key M0 rows", 2, params.mNumRows);
   1184         assertEquals("10 key M0 left", 2, params.mLeftKeys);
   1185         assertEquals("10 key M0 right", 3, params.mRightKeys);
   1186         assertEquals("10 key M0 [1]", 0, params.getColumnPos(0));
   1187         assertEquals("10 key M0 [2]", 1, params.getColumnPos(1));
   1188         assertEquals("10 key M0 [3]", -1, params.getColumnPos(2));
   1189         assertEquals("10 key M0 [4]", 2, params.getColumnPos(3));
   1190         assertEquals("10 key M0 [5]", -2, params.getColumnPos(4));
   1191         assertEquals("10 key M0 [6]", 0, params.getColumnPos(5));
   1192         assertEquals("10 key M0 [7]", 1, params.getColumnPos(6));
   1193         assertEquals("10 key M0 [8]", -1, params.getColumnPos(7));
   1194         assertEquals("10 key M0 [9]", 2, params.getColumnPos(8));
   1195         assertEquals("10 key M0 [A]", -2, params.getColumnPos(9));
   1196         assertEquals("10 key M0 adjust", 0, params.mTopRowAdjustment);
   1197         assertEquals("10 key M0 default", WIDTH * 2, params.getDefaultKeyCoordX());
   1198     }
   1199 
   1200     // |[6] [7] [8] [9] [A]
   1201     // |[1] [2] [3] [4] [5]
   1202     public void testLayout10KeyL0() {
   1203         MiniKeyboardParams params = new MiniKeyboardParams(10, MAX_COLUMNS, WIDTH,
   1204                 HEIGHT, XPOS_L0, KEYBOARD_WIDTH);
   1205         assertEquals("10 key L0 columns", 5, params.mNumColumns);
   1206         assertEquals("10 key L0 rows", 2, params.mNumRows);
   1207         assertEquals("10 key L0 left", 0, params.mLeftKeys);
   1208         assertEquals("10 key L0 right", 5, params.mRightKeys);
   1209         assertEquals("10 key L0 [1]", 0, params.getColumnPos(0));
   1210         assertEquals("10 key L0 [2]", 1, params.getColumnPos(1));
   1211         assertEquals("10 key L0 [3]", 2, params.getColumnPos(2));
   1212         assertEquals("10 key L0 [4]", 3, params.getColumnPos(3));
   1213         assertEquals("10 key L0 [5]", 4, params.getColumnPos(4));
   1214         assertEquals("10 key L0 [6]", 0, params.getColumnPos(5));
   1215         assertEquals("10 key L0 [7]", 1, params.getColumnPos(6));
   1216         assertEquals("10 key L0 [8]", 2, params.getColumnPos(7));
   1217         assertEquals("10 key L0 [9]", 3, params.getColumnPos(8));
   1218         assertEquals("10 key L0 [A]", 4, params.getColumnPos(9));
   1219         assertEquals("10 key L0 adjust", 0, params.mTopRowAdjustment);
   1220         assertEquals("10 key L0 default", WIDTH * 0, params.getDefaultKeyCoordX());
   1221     }
   1222 
   1223     // |___ [6] [7] [8] [9] [A]
   1224     // |___ [1] [2] [3] [4] [5]
   1225     public void testLayout10KeyL1() {
   1226         MiniKeyboardParams params = new MiniKeyboardParams(10, MAX_COLUMNS, WIDTH,
   1227                 HEIGHT, XPOS_L1, KEYBOARD_WIDTH);
   1228         assertEquals("10 key L1 columns", 5, params.mNumColumns);
   1229         assertEquals("10 key L1 rows", 2, params.mNumRows);
   1230         assertEquals("10 key L1 left", 0, params.mLeftKeys);
   1231         assertEquals("10 key L1 right", 5, params.mRightKeys);
   1232         assertEquals("10 key L1 [1]", 0, params.getColumnPos(0));
   1233         assertEquals("10 key L1 [2]", 1, params.getColumnPos(1));
   1234         assertEquals("10 key L1 [3]", 2, params.getColumnPos(2));
   1235         assertEquals("10 key L1 [4]", 3, params.getColumnPos(3));
   1236         assertEquals("10 key L1 [5]", 4, params.getColumnPos(4));
   1237         assertEquals("10 key L1 [6]", 0, params.getColumnPos(5));
   1238         assertEquals("10 key L1 [7]", 1, params.getColumnPos(6));
   1239         assertEquals("10 key L1 [8]", 2, params.getColumnPos(7));
   1240         assertEquals("10 key L1 [9]", 3, params.getColumnPos(8));
   1241         assertEquals("10 key L1 [A]", 4, params.getColumnPos(9));
   1242         assertEquals("10 key L1 adjust", 0, params.mTopRowAdjustment);
   1243         assertEquals("10 key L1 default", WIDTH * 0, params.getDefaultKeyCoordX());
   1244     }
   1245 
   1246     // |___ ___ [8] [6] [7] [9] [A]
   1247     // |___ ___ [3] [1] [2] [4] [5]
   1248     public void testLayout10KeyL2() {
   1249         MiniKeyboardParams params = new MiniKeyboardParams(10, MAX_COLUMNS, WIDTH,
   1250                 HEIGHT, XPOS_L2, KEYBOARD_WIDTH);
   1251         assertEquals("10 key L2 columns", 5, params.mNumColumns);
   1252         assertEquals("10 key L2 rows", 2, params.mNumRows);
   1253         assertEquals("10 key L2 left", 1, params.mLeftKeys);
   1254         assertEquals("10 key L2 right", 4, params.mRightKeys);
   1255         assertEquals("10 key L2 [1]", 0, params.getColumnPos(0));
   1256         assertEquals("10 key L2 [2]", 1, params.getColumnPos(1));
   1257         assertEquals("10 key L2 [3]", -1, params.getColumnPos(2));
   1258         assertEquals("10 key L2 [4]", 2, params.getColumnPos(3));
   1259         assertEquals("10 key L2 [5]", 3, params.getColumnPos(4));
   1260         assertEquals("10 key L2 [6]", 0, params.getColumnPos(5));
   1261         assertEquals("10 key L2 [7]", 1, params.getColumnPos(6));
   1262         assertEquals("10 key L2 [8]", -1, params.getColumnPos(7));
   1263         assertEquals("10 key L2 [9]", 2, params.getColumnPos(8));
   1264         assertEquals("10 key L2 [A]", 3, params.getColumnPos(9));
   1265         assertEquals("10 key L2 adjust", 0, params.mTopRowAdjustment);
   1266         assertEquals("10 key L2 default", WIDTH * 1, params.getDefaultKeyCoordX());
   1267     }
   1268 
   1269     // [A] [9] [8] [7] [6]|
   1270     // [5] [4] [3] [2] [1]|
   1271     public void testLayout10KeyR0() {
   1272         MiniKeyboardParams params = new MiniKeyboardParams(10, MAX_COLUMNS, WIDTH,
   1273                 HEIGHT, XPOS_R0, KEYBOARD_WIDTH);
   1274         assertEquals("10 key R0 columns", 5, params.mNumColumns);
   1275         assertEquals("10 key R0 rows", 2, params.mNumRows);
   1276         assertEquals("10 key R0 left", 4, params.mLeftKeys);
   1277         assertEquals("10 key R0 right", 1, params.mRightKeys);
   1278         assertEquals("10 key R0 [1]", 0, params.getColumnPos(0));
   1279         assertEquals("10 key R0 [2]", -1, params.getColumnPos(1));
   1280         assertEquals("10 key R0 [3]", -2, params.getColumnPos(2));
   1281         assertEquals("10 key R0 [4]", -3, params.getColumnPos(3));
   1282         assertEquals("10 key R0 [5]", -4, params.getColumnPos(4));
   1283         assertEquals("10 key R0 [6]", 0, params.getColumnPos(5));
   1284         assertEquals("10 key R0 [7]", -1, params.getColumnPos(6));
   1285         assertEquals("10 key R0 [8]", -2, params.getColumnPos(7));
   1286         assertEquals("10 key R0 [9]", -3, params.getColumnPos(8));
   1287         assertEquals("10 key R0 [A]", -4, params.getColumnPos(9));
   1288         assertEquals("10 key R0 adjust", 0, params.mTopRowAdjustment);
   1289         assertEquals("10 key R0 default", WIDTH * 4, params.getDefaultKeyCoordX());
   1290     }
   1291 
   1292     // [A] [9] [8] [7] [6] ___|
   1293     // [5] [4] [3] [2] [1] ___|
   1294     public void testLayout10KeyR1() {
   1295         MiniKeyboardParams params = new MiniKeyboardParams(10, MAX_COLUMNS, WIDTH,
   1296                 HEIGHT, XPOS_R1, KEYBOARD_WIDTH);
   1297         assertEquals("10 key R1 columns", 5, params.mNumColumns);
   1298         assertEquals("10 key R1 rows", 2, params.mNumRows);
   1299         assertEquals("10 key R1 left", 4, params.mLeftKeys);
   1300         assertEquals("10 key R1 right", 1, params.mRightKeys);
   1301         assertEquals("10 key R1 [1]", 0, params.getColumnPos(0));
   1302         assertEquals("10 key R1 [2]", -1, params.getColumnPos(1));
   1303         assertEquals("10 key R1 [3]", -2, params.getColumnPos(2));
   1304         assertEquals("10 key R1 [4]", -3, params.getColumnPos(3));
   1305         assertEquals("10 key R1 [5]", -4, params.getColumnPos(4));
   1306         assertEquals("10 key R1 [6]", 0, params.getColumnPos(5));
   1307         assertEquals("10 key R1 [7]", -1, params.getColumnPos(6));
   1308         assertEquals("10 key R1 [8]", -2, params.getColumnPos(7));
   1309         assertEquals("10 key R1 [9]", -3, params.getColumnPos(8));
   1310         assertEquals("10 key R1 [A]", -4, params.getColumnPos(9));
   1311         assertEquals("10 key R1 adjust", 0, params.mTopRowAdjustment);
   1312         assertEquals("10 key R1 default", WIDTH * 4, params.getDefaultKeyCoordX());
   1313     }
   1314 
   1315     // [A] [9] [8] [6] [7] ___ ___|
   1316     // [5] [4] [3] [1] [2] ___ ___|
   1317     public void testLayout10KeyR2() {
   1318         MiniKeyboardParams params = new MiniKeyboardParams(10, MAX_COLUMNS, WIDTH,
   1319                 HEIGHT, XPOS_R2, KEYBOARD_WIDTH);
   1320         assertEquals("10 key R2 columns", 5, params.mNumColumns);
   1321         assertEquals("10 key R2 rows", 2, params.mNumRows);
   1322         assertEquals("10 key R2 left", 3, params.mLeftKeys);
   1323         assertEquals("10 key R2 right", 2, params.mRightKeys);
   1324         assertEquals("10 key R2 [1]", 0, params.getColumnPos(0));
   1325         assertEquals("10 key R2 [2]", 1, params.getColumnPos(1));
   1326         assertEquals("10 key R2 [3]", -1, params.getColumnPos(2));
   1327         assertEquals("10 key R2 [4]", -2, params.getColumnPos(3));
   1328         assertEquals("10 key R2 [5]", -3, params.getColumnPos(4));
   1329         assertEquals("10 key R2 [6]", 0, params.getColumnPos(5));
   1330         assertEquals("10 key R2 [7]", 1, params.getColumnPos(6));
   1331         assertEquals("10 key R2 [8]", -1, params.getColumnPos(7));
   1332         assertEquals("10 key R2 [9]", -2, params.getColumnPos(8));
   1333         assertEquals("10 key R2 [A]", -3, params.getColumnPos(9));
   1334         assertEquals("10 key R2 adjust", 0, params.mTopRowAdjustment);
   1335         assertEquals("10 key R2 default", WIDTH * 3, params.getDefaultKeyCoordX());
   1336     }
   1337 
   1338     //   [B] [9] [A]
   1339     // [7] [5] [6] [8]
   1340     // [3] [1] [2] [4]
   1341     public void testLayout11KeyM0() {
   1342         MiniKeyboardParams params = new MiniKeyboardParams(11, MAX_COLUMNS, WIDTH,
   1343                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
   1344         assertEquals("11 key M0 columns", 4, params.mNumColumns);
   1345         assertEquals("11 key M0 rows", 3, params.mNumRows);
   1346         assertEquals("11 key M0 left", 1, params.mLeftKeys);
   1347         assertEquals("11 key M0 right", 3, params.mRightKeys);
   1348         assertEquals("11 key M0 [1]", 0, params.getColumnPos(0));
   1349         assertEquals("11 key M0 [2]", 1, params.getColumnPos(1));
   1350         assertEquals("11 key M0 [3]", -1, params.getColumnPos(2));
   1351         assertEquals("11 key M0 [4]", 2, params.getColumnPos(3));
   1352         assertEquals("11 key M0 [5]", 0, params.getColumnPos(4));
   1353         assertEquals("11 key M0 [6]", 1, params.getColumnPos(5));
   1354         assertEquals("11 key M0 [7]", -1, params.getColumnPos(6));
   1355         assertEquals("11 key M0 [8]", 2, params.getColumnPos(7));
   1356         assertEquals("11 key M0 [9]", 0, params.getColumnPos(8));
   1357         assertEquals("11 key M0 [A]", 1, params.getColumnPos(9));
   1358         assertEquals("11 key M0 [B]", -1, params.getColumnPos(10));
   1359         assertEquals("11 key M0 adjust", 1, params.mTopRowAdjustment);
   1360         assertEquals("11 key M0 default", WIDTH * 1, params.getDefaultKeyCoordX());
   1361     }
   1362 
   1363     // [B] [9] [A] [C]
   1364     // [7] [5] [6] [8]
   1365     // [3] [1] [2] [4]
   1366     public void testLayout12KeyM0() {
   1367         MiniKeyboardParams params = new MiniKeyboardParams(12, MAX_COLUMNS, WIDTH,
   1368                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
   1369         assertEquals("12 key M0 columns", 4, params.mNumColumns);
   1370         assertEquals("12 key M0 rows", 3, params.mNumRows);
   1371         assertEquals("12 key M0 left", 1, params.mLeftKeys);
   1372         assertEquals("12 key M0 right", 3, params.mRightKeys);
   1373         assertEquals("12 key M0 [1]", 0, params.getColumnPos(0));
   1374         assertEquals("12 key M0 [2]", 1, params.getColumnPos(1));
   1375         assertEquals("12 key M0 [3]", -1, params.getColumnPos(2));
   1376         assertEquals("12 key M0 [4]", 2, params.getColumnPos(3));
   1377         assertEquals("12 key M0 [5]", 0, params.getColumnPos(4));
   1378         assertEquals("12 key M0 [6]", 1, params.getColumnPos(5));
   1379         assertEquals("12 key M0 [7]", -1, params.getColumnPos(6));
   1380         assertEquals("12 key M0 [8]", 2, params.getColumnPos(7));
   1381         assertEquals("12 key M0 [9]", 0, params.getColumnPos(8));
   1382         assertEquals("12 key M0 [A]", 1, params.getColumnPos(9));
   1383         assertEquals("12 key M0 [B]", -1, params.getColumnPos(10));
   1384         assertEquals("12 key M0 [C]", 2, params.getColumnPos(11));
   1385         assertEquals("12 key M0 adjust", 0, params.mTopRowAdjustment);
   1386         assertEquals("12 key M0 default", WIDTH * 1, params.getDefaultKeyCoordX());
   1387     }
   1388 
   1389 
   1390     //     [D] [B] [C]
   1391     // [A] [8] [6] [7] [9]
   1392     // [5] [3] [1] [2] [4]
   1393     public void testLayout13KeyM0() {
   1394         MiniKeyboardParams params = new MiniKeyboardParams(13, MAX_COLUMNS, WIDTH,
   1395                 HEIGHT, XPOS_M0, KEYBOARD_WIDTH);
   1396         assertEquals("13 key M0 columns", 5, params.mNumColumns);
   1397         assertEquals("13 key M0 rows", 3, params.mNumRows);
   1398         assertEquals("13 key M0 left", 2, params.mLeftKeys);
   1399         assertEquals("13 key M0 right", 3, params.mRightKeys);
   1400         assertEquals("13 key M0 [1]", 0, params.getColumnPos(0));
   1401         assertEquals("13 key M0 [2]", 1, params.getColumnPos(1));
   1402         assertEquals("13 key M0 [3]", -1, params.getColumnPos(2));
   1403         assertEquals("13 key M0 [4]", 2, params.getColumnPos(3));
   1404         assertEquals("13 key M0 [5]", -2, params.getColumnPos(4));
   1405         assertEquals("13 key M0 [6]", 0, params.getColumnPos(5));
   1406         assertEquals("13 key M0 [7]", 1, params.getColumnPos(6));
   1407         assertEquals("13 key M0 [8]", -1, params.getColumnPos(7));
   1408         assertEquals("13 key M0 [9]", 2, params.getColumnPos(8));
   1409         assertEquals("13 key M0 [A]", -2, params.getColumnPos(9));
   1410         assertEquals("13 key M0 [B]", 0, params.getColumnPos(10));
   1411         assertEquals("13 key M0 [C]", 1, params.getColumnPos(11));
   1412         assertEquals("13 key M0 [D]", -1, params.getColumnPos(12));
   1413         assertEquals("13 key M0 adjust", 0, params.mTopRowAdjustment);
   1414         assertEquals("13 key M0 default", WIDTH * 2, params.getDefaultKeyCoordX());
   1415     }
   1416 }
   1417