@Test
public void testColumnMajor() throws Exception {

    FixedTableModel model = new FixedTableModel(300, 500, TableOrder.COLUMN_MAJOR);
    RectF tableRect = new RectF(0, 0, 1000, 2000);
    // test the numElement limit:
    Iterator<RectF> it = model.getIterator(tableRect, 5);
    assertTrue(it.hasNext());
    RectF cellRect = it.next();
    assertEquals(0f, cellRect.left);
    assertEquals(0f, cellRect.top);
    assertEquals(300f, cellRect.right);
    assertEquals(500f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(300f, cellRect.left);
    assertEquals(0f, cellRect.top);
    assertEquals(600f, cellRect.right);
    assertEquals(500f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(600f, cellRect.left);
    assertEquals(0f, cellRect.top);
    assertEquals(900f, cellRect.right);
    assertEquals(500f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(0f, cellRect.left);
    assertEquals(500f, cellRect.top);
    assertEquals(300f, cellRect.right);
    assertEquals(1000f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(300f, cellRect.left);
    assertEquals(500f, cellRect.top);
    assertEquals(600f, cellRect.right);
    assertEquals(1000f, cellRect.bottom);
    assertFalse(it.hasNext());
    // test border limit:
    it = model.getIterator(tableRect, 25);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(0f, cellRect.left);
    assertEquals(0f, cellRect.top);
    assertEquals(300f, cellRect.right);
    assertEquals(500f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(300f, cellRect.left);
    assertEquals(0f, cellRect.top);
    assertEquals(600f, cellRect.right);
    assertEquals(500f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(600f, cellRect.left);
    assertEquals(0f, cellRect.top);
    assertEquals(900f, cellRect.right);
    assertEquals(500f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(0f, cellRect.left);
    assertEquals(500f, cellRect.top);
    assertEquals(300f, cellRect.right);
    assertEquals(1000f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(300f, cellRect.left);
    assertEquals(500f, cellRect.top);
    assertEquals(600f, cellRect.right);
    assertEquals(1000f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(600f, cellRect.left);
    assertEquals(500f, cellRect.top);
    assertEquals(900f, cellRect.right);
    assertEquals(1000f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(0f, cellRect.left);
    assertEquals(1000f, cellRect.top);
    assertEquals(300f, cellRect.right);
    assertEquals(1500f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(300f, cellRect.left);
    assertEquals(1000f, cellRect.top);
    assertEquals(600f, cellRect.right);
    assertEquals(1500f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(600f, cellRect.left);
    assertEquals(1000f, cellRect.top);
    assertEquals(900f, cellRect.right);
    assertEquals(1500f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(0f, cellRect.left);
    assertEquals(1500f, cellRect.top);
    assertEquals(300f, cellRect.right);
    assertEquals(2000f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(300f, cellRect.left);
    assertEquals(1500f, cellRect.top);
    assertEquals(600f, cellRect.right);
    assertEquals(2000f, cellRect.bottom);
    assertTrue(it.hasNext());
    cellRect = it.next();
    assertEquals(600f, cellRect.left);
    assertEquals(1500f, cellRect.top);
    assertEquals(900f, cellRect.right);
    assertEquals(2000f, cellRect.bottom);
    //we've reached the limit
    assertFalse(it.hasNext());
}