From 5df47e4bb0c1217e0b49468aa7c2ca2eecf6dc07 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 22 Mar 2011 13:00:39 +0100 Subject: gridfixes: #i117398# added XGridDataModel::getRowData Change-Id: Ic08c2d54a76f2a2821822ec4b275883e4445c70c Reviewed-on: https://gerrit.libreoffice.org/543 Reviewed-by: Miklos Vajna Tested-by: Miklos Vajna --- toolkit/qa/complex/toolkit/GridControl.java | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'toolkit/qa') diff --git a/toolkit/qa/complex/toolkit/GridControl.java b/toolkit/qa/complex/toolkit/GridControl.java index b26fb704e0db..249ae8c1437e 100644 --- a/toolkit/qa/complex/toolkit/GridControl.java +++ b/toolkit/qa/complex/toolkit/GridControl.java @@ -324,6 +324,33 @@ public class GridControl assertEquals( insertionIndex, newColumn.getIndex() ); } + // ----------------------------------------------------------------------------------------------------------------- + @Test + public void testDataModel() throws Exception + { + impl_recreateGridModel(); + + // ensure that getCellData and getRowData have the same opinion on the data they deliver + final Object[][] data = new Object[][] { + new Object[] { 15, 17, 0 }, + new Object[] { 9, 8, 14 }, + new Object[] { 17, 2, 16 }, + new Object[] { 0, 7, 14 }, + new Object[] { 10, 16, 16 }, + }; + m_dataModel.addRows( new Object[ data.length ], data ); + + for ( int row = 0; row < data.length; ++row ) + { + assertArrayEquals( "getRowData delivers wrong data in row " + row, data[row], m_dataModel.getRowData( row ) ); + for ( int col = 0; col < data[row].length; ++col ) + { + assertEquals( "getCellData delivers wrong data at position (" + col + ", " + row + ")", + data[row][col], m_dataModel.getCellData( col, row ) ); + } + } + } + // ----------------------------------------------------------------------------------------------------------------- @Test public void testSortableDataModel() throws Exception @@ -408,7 +435,7 @@ public class GridControl final List< Object > disposables = new ArrayList< Object >(); try { - // create a siple dialog model/control/peer trinity + // create a simple dialog model/control/peer trinity final XControlModel dialogModel = createInstance( XControlModel.class, "com.sun.star.awt.UnoControlDialogModel" ); disposables.add( dialogModel ); final XPropertySet dialogProps = UnoRuntime.queryInterface( XPropertySet.class, dialogModel ); -- cgit