1*eba4d44aSLiu Zhe package fvt.uno.sc.cell;
24f4f7c7bSLiu Zhe 
34f4f7c7bSLiu Zhe import static org.junit.Assert.*;
44f4f7c7bSLiu Zhe 
54f4f7c7bSLiu Zhe import org.junit.After;
64f4f7c7bSLiu Zhe import org.junit.Before;
74f4f7c7bSLiu Zhe import org.junit.Test;
84f4f7c7bSLiu Zhe 
94f4f7c7bSLiu Zhe import org.openoffice.test.uno.UnoApp;
104f4f7c7bSLiu Zhe 
114f4f7c7bSLiu Zhe import com.sun.star.container.XIndexAccess;
124f4f7c7bSLiu Zhe import com.sun.star.lang.XComponent;
134f4f7c7bSLiu Zhe import com.sun.star.sheet.CellDeleteMode;
144f4f7c7bSLiu Zhe import com.sun.star.sheet.CellInsertMode;
154f4f7c7bSLiu Zhe import com.sun.star.sheet.XCellRangeAddressable;
164f4f7c7bSLiu Zhe import com.sun.star.sheet.XSpreadsheet;
174f4f7c7bSLiu Zhe import com.sun.star.sheet.XSpreadsheetDocument;
184f4f7c7bSLiu Zhe import com.sun.star.sheet.XSpreadsheets;
194f4f7c7bSLiu Zhe import com.sun.star.table.XCell;
204f4f7c7bSLiu Zhe import com.sun.star.uno.UnoRuntime;
214f4f7c7bSLiu Zhe import com.sun.star.table.XCellRange;
224f4f7c7bSLiu Zhe import com.sun.star.table.CellRangeAddress;
234f4f7c7bSLiu Zhe import com.sun.star.sheet.XCellRangeMovement;
244f4f7c7bSLiu Zhe 
254f4f7c7bSLiu Zhe /**
264f4f7c7bSLiu Zhe  * Test insert or delete cells
274f4f7c7bSLiu Zhe  * @author BinGuo 8/30/2012
284f4f7c7bSLiu Zhe  *
294f4f7c7bSLiu Zhe  */
304f4f7c7bSLiu Zhe 
314f4f7c7bSLiu Zhe public class InsertDeleteCells {
324f4f7c7bSLiu Zhe 
334f4f7c7bSLiu Zhe 	UnoApp unoApp = new UnoApp();
344f4f7c7bSLiu Zhe 	XSpreadsheetDocument scDocument = null;
354f4f7c7bSLiu Zhe 	XComponent scComponent = null;
364f4f7c7bSLiu Zhe 
374f4f7c7bSLiu Zhe 	@Before
384f4f7c7bSLiu Zhe 	public void setUp() throws Exception {
394f4f7c7bSLiu Zhe 		unoApp.start();
404f4f7c7bSLiu Zhe 	}
414f4f7c7bSLiu Zhe 
424f4f7c7bSLiu Zhe 	@After
434f4f7c7bSLiu Zhe 	public void tearDown() throws Exception {
444f4f7c7bSLiu Zhe 		unoApp.closeDocument(scComponent);
454f4f7c7bSLiu Zhe 		unoApp.close();
464f4f7c7bSLiu Zhe 		}
474f4f7c7bSLiu Zhe 
484f4f7c7bSLiu Zhe 	/**
494f4f7c7bSLiu Zhe 	 * New spreadsheet
504f4f7c7bSLiu Zhe 	 * Create 3x3 cell range A2:C4
514f4f7c7bSLiu Zhe 	 * Execute insert empty A2 & B2 cells shift other existing cells in Column A & B down
524f4f7c7bSLiu Zhe 	 * Execute insert empty A2 & B2 cells shift other existing cells in row 2 move right
534f4f7c7bSLiu Zhe 	 * Execute insert entire empty Row 2 make the whole existing cell range moves down
544f4f7c7bSLiu Zhe 	 * Execute insert entire empty Columns A & B make the whole existing cell range moves right
554f4f7c7bSLiu Zhe 	 * Verify results after insert cells
564f4f7c7bSLiu Zhe 	 */
574f4f7c7bSLiu Zhe 
584f4f7c7bSLiu Zhe 	@Test
594f4f7c7bSLiu Zhe 	public void testInsertCells() throws Exception {
604f4f7c7bSLiu Zhe 
614f4f7c7bSLiu Zhe 		scComponent = unoApp.newDocument("scalc");
624f4f7c7bSLiu Zhe 		scDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, scComponent);
634f4f7c7bSLiu Zhe 		XSpreadsheets xSpreadsheets = scDocument.getSheets();
644f4f7c7bSLiu Zhe 
654f4f7c7bSLiu Zhe 		// Gets the first sheet in the document.
664f4f7c7bSLiu Zhe         XIndexAccess xSheetsIA = (XIndexAccess)UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
674f4f7c7bSLiu Zhe         Object sheetObj = (XSpreadsheet)UnoRuntime.queryInterface(XSpreadsheet.class, xSheetsIA.getByIndex(0));
684f4f7c7bSLiu Zhe 		XSpreadsheet xSheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, sheetObj);
694f4f7c7bSLiu Zhe 
704f4f7c7bSLiu Zhe 	    // Create a 3x3 cell range "A2:C4" with the values 0 ... 8.
714f4f7c7bSLiu Zhe 	    int nCol = 0;
724f4f7c7bSLiu Zhe 	    int nValue = 0;
734f4f7c7bSLiu Zhe 
744f4f7c7bSLiu Zhe 	    for (int n = 1; n < 4; ++n){
754f4f7c7bSLiu Zhe 	    	int nRow = 1;
764f4f7c7bSLiu Zhe 	    	for (int i = 1; i < 4; ++i) {
774f4f7c7bSLiu Zhe 			   xSheet.getCellByPosition( nCol, nRow ).setValue( nValue );
784f4f7c7bSLiu Zhe 		       nRow += 1;
794f4f7c7bSLiu Zhe 		       nValue += 1;
804f4f7c7bSLiu Zhe 		    }
814f4f7c7bSLiu Zhe 	        nCol += 1;
824f4f7c7bSLiu Zhe 	    }
834f4f7c7bSLiu Zhe 
844f4f7c7bSLiu Zhe 	    //Insert 2 cells in A2:B2 and shift other existing cells in Column A & B down
854f4f7c7bSLiu Zhe 
864f4f7c7bSLiu Zhe 		// Get cell range A2:B2 by position - (column, row, column, row)
874f4f7c7bSLiu Zhe         XCellRange xCellRange = xSheet.getCellRangeByPosition( 0, 1, 1, 1 );
884f4f7c7bSLiu Zhe         XCellRangeMovement xCellRangeMovement = (XCellRangeMovement)
894f4f7c7bSLiu Zhe         		UnoRuntime.queryInterface(XCellRangeMovement.class, xSheet);
904f4f7c7bSLiu Zhe 
914f4f7c7bSLiu Zhe         // Gets the selected range's address/location.
924f4f7c7bSLiu Zhe  	    XCellRangeAddressable xCellRangeAddr = (XCellRangeAddressable)
934f4f7c7bSLiu Zhe 	            UnoRuntime.queryInterface( XCellRangeAddressable.class, xCellRange );
944f4f7c7bSLiu Zhe 	    CellRangeAddress address = xCellRangeAddr.getRangeAddress();
954f4f7c7bSLiu Zhe 
964f4f7c7bSLiu Zhe 	    //Execute Insert cells in A2:B2 and shift other existing cells in Column A & B down
974f4f7c7bSLiu Zhe 	    xCellRangeMovement.insertCells(address, CellInsertMode.DOWN);
984f4f7c7bSLiu Zhe 
994f4f7c7bSLiu Zhe 	    //Get value of cell A2, B2 and C2
1004f4f7c7bSLiu Zhe         XCell cellA2 = xSheet.getCellByPosition(0, 1);
1014f4f7c7bSLiu Zhe         XCell cellB2 = xSheet.getCellByPosition(1, 1);
1024f4f7c7bSLiu Zhe         XCell cellC2 = xSheet.getCellByPosition(2, 1);
1034f4f7c7bSLiu Zhe         double expectValueA2 = 0.0;
1044f4f7c7bSLiu Zhe         double expectValueB2 = 0.0;
1054f4f7c7bSLiu Zhe         double expectValueC2 = 6;
1064f4f7c7bSLiu Zhe 
1074f4f7c7bSLiu Zhe         //Verify results after execute Insert cells in A2:B2 and shift other existing cells in Column A & B down
1084f4f7c7bSLiu Zhe         assertEquals("Verify value of A2 after execute Insert cells in A2:B2 and shift cells down.",
1094f4f7c7bSLiu Zhe         		expectValueA2, cellA2.getValue(),0);
1104f4f7c7bSLiu Zhe         assertEquals("Verify value of B2 after execute Insert cells in A2:B2 and shift cells down.",
1114f4f7c7bSLiu Zhe         		expectValueB2, cellB2.getValue(),0);
1124f4f7c7bSLiu Zhe         assertEquals("Verify value of C2 after execute Insert cells in A2:B2 and shift cells down.",
1134f4f7c7bSLiu Zhe         		expectValueC2, cellC2.getValue(),0);
1144f4f7c7bSLiu Zhe 
1154f4f7c7bSLiu Zhe         //Execute Insert cells in A2:B2 and shift other existing cells in row 2 move right
1164f4f7c7bSLiu Zhe 	    xCellRangeMovement.insertCells(address, CellInsertMode.RIGHT);
1174f4f7c7bSLiu Zhe 
1184f4f7c7bSLiu Zhe 	    //Get value of cell C2, D2, E2 and C3
1194f4f7c7bSLiu Zhe 	    cellC2 = xSheet.getCellByPosition(2, 1);
1204f4f7c7bSLiu Zhe         XCell cellD2 = xSheet.getCellByPosition(3, 1);
1214f4f7c7bSLiu Zhe         XCell cellE2 = xSheet.getCellByPosition(4, 1);
1224f4f7c7bSLiu Zhe         XCell cellC3 = xSheet.getCellByPosition(2, 2);
1234f4f7c7bSLiu Zhe         double expectValueC2right = 0.0;
1244f4f7c7bSLiu Zhe         double expectValueD2 = 0.0;
1254f4f7c7bSLiu Zhe         double expectValueE2 = 6;
1264f4f7c7bSLiu Zhe         double expectValueC3 = 7;
1274f4f7c7bSLiu Zhe 
1284f4f7c7bSLiu Zhe         //Verify results after execute Insert cells in A2:B2 and shift other existing cells in row 2 move right
1294f4f7c7bSLiu Zhe         assertEquals("Verify value of C2 after execute Insert cells in A2:B2 and shift cells Right.",
1304f4f7c7bSLiu Zhe         		expectValueC2right, cellC2.getValue(),0);
1314f4f7c7bSLiu Zhe         assertEquals("Verify value of D2 after execute Insert cells in A2:B2 and shift cells Right.",
1324f4f7c7bSLiu Zhe         		expectValueD2, cellD2.getValue(),0);
1334f4f7c7bSLiu Zhe         assertEquals("Verify value of E2 after execute Insert cells in A2:B2 and shift cells Right.",
1344f4f7c7bSLiu Zhe         		expectValueE2, cellE2.getValue(),0);
1354f4f7c7bSLiu Zhe         assertEquals("Verify value of C3 after execute Insert cells in A2:B2 and shift cells Right.",
1364f4f7c7bSLiu Zhe         		expectValueC3, cellC3.getValue(),0);
1374f4f7c7bSLiu Zhe 
1384f4f7c7bSLiu Zhe         //Execute Insert Entire Row 2 make the whole existing cell range moves down
1394f4f7c7bSLiu Zhe 	    xCellRangeMovement.insertCells(address, CellInsertMode.ROWS);
1404f4f7c7bSLiu Zhe 
1414f4f7c7bSLiu Zhe 	    //Get value of cell E2, E3 and C3
1424f4f7c7bSLiu Zhe 	    cellE2 = xSheet.getCellByPosition(4, 1);
1434f4f7c7bSLiu Zhe         XCell cellE3 = xSheet.getCellByPosition(4, 2);
1444f4f7c7bSLiu Zhe         cellC3 = xSheet.getCellByPosition(2, 2);
1454f4f7c7bSLiu Zhe         double expectValueE2rows = 0.0;
1464f4f7c7bSLiu Zhe         double expectValueE3 = 6;
1474f4f7c7bSLiu Zhe         double expectValueC3rows = 0.0;
1484f4f7c7bSLiu Zhe 
1494f4f7c7bSLiu Zhe         //Verify results after execute Insert Entire Row 2 make the whole existing cell range moves down
1504f4f7c7bSLiu Zhe         assertEquals("Verify value of E2 after execute Insert Entire Row 2 make the whole existing cell range moves down.",
1514f4f7c7bSLiu Zhe         		expectValueE2rows, cellE2.getValue(),0);
1524f4f7c7bSLiu Zhe         assertEquals("Verify value of E3 after execute Insert Entire Row 2 make the whole existing cell range moves down.",
1534f4f7c7bSLiu Zhe         		expectValueE3, cellE3.getValue(),0);
1544f4f7c7bSLiu Zhe         assertEquals("Verify value of C3 after execute Insert Entire Row 2 make the whole existing cell range moves down.",
1554f4f7c7bSLiu Zhe         		expectValueC3rows, cellC3.getValue(),0);
1564f4f7c7bSLiu Zhe 
1574f4f7c7bSLiu Zhe 	    //Execute Insert Entire Columns make the whole existing cell range moves right
1584f4f7c7bSLiu Zhe 	    xCellRangeMovement.insertCells(address, CellInsertMode.COLUMNS);
1594f4f7c7bSLiu Zhe 
1604f4f7c7bSLiu Zhe 	    //Get value of cell C4, C5 and C6
1614f4f7c7bSLiu Zhe 	    XCell cellC4 = xSheet.getCellByPosition(2, 3);
1624f4f7c7bSLiu Zhe         XCell cellC5 = xSheet.getCellByPosition(2, 4);
1634f4f7c7bSLiu Zhe         XCell cellC6 = xSheet.getCellByPosition(2, 5);
1644f4f7c7bSLiu Zhe         double expectValueC4 = 0.0;
1654f4f7c7bSLiu Zhe         double expectValueC5 = 1;
1664f4f7c7bSLiu Zhe         double expectValueC6 = 2;
1674f4f7c7bSLiu Zhe 
1684f4f7c7bSLiu Zhe         //Verify results after execute Insert Entire Columns make the whole existing cell range moves right
1694f4f7c7bSLiu Zhe         assertEquals("Verify value of E2 after execute Insert Entire Row 2 make the whole existing cell range moves down.",
1704f4f7c7bSLiu Zhe     		   expectValueC4, cellC4.getValue(),0);
1714f4f7c7bSLiu Zhe         assertEquals("Verify value of E3 after execute Insert Entire Row 2 make the whole existing cell range moves down.",
1724f4f7c7bSLiu Zhe     		   expectValueC5, cellC5.getValue(),0);
1734f4f7c7bSLiu Zhe         assertEquals("Verify value of C3 after execute Insert Entire Row 2 make the whole existing cell range moves down.",
1744f4f7c7bSLiu Zhe     		   expectValueC6, cellC6.getValue(),0);
1754f4f7c7bSLiu Zhe 
1764f4f7c7bSLiu Zhe     }
1774f4f7c7bSLiu Zhe 
1784f4f7c7bSLiu Zhe 	/**
1794f4f7c7bSLiu Zhe 	 * New spreadsheet
1804f4f7c7bSLiu Zhe 	 * Create 3x3 cell range A2:C4
1814f4f7c7bSLiu Zhe 	 * Execute delete cells A2 & B2 shift other existing cells in column A & B move up
1824f4f7c7bSLiu Zhe 	 * Execute delete cells A2 & B2 shift other existing cells in row 2 move left
1834f4f7c7bSLiu Zhe 	 * Execute delete entire Row 2 make the whole existing cell range moves up
1844f4f7c7bSLiu Zhe 	 * Execute delete entire Columns A & B make the whole existing cell range moves left
1854f4f7c7bSLiu Zhe 	 * Verify results after delete cells
1864f4f7c7bSLiu Zhe 	 */
1874f4f7c7bSLiu Zhe 
1884f4f7c7bSLiu Zhe     @Test
1894f4f7c7bSLiu Zhe     public void testDeleteCells() throws Exception {
1904f4f7c7bSLiu Zhe 
1914f4f7c7bSLiu Zhe 	    scComponent = unoApp.newDocument("scalc");
1924f4f7c7bSLiu Zhe 	    scDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, scComponent);
1934f4f7c7bSLiu Zhe 	    XSpreadsheets xSpreadsheets = scDocument.getSheets();
1944f4f7c7bSLiu Zhe 
1954f4f7c7bSLiu Zhe 	    // Gets the first sheet in the document.
1964f4f7c7bSLiu Zhe         XIndexAccess xSheetsIA = (XIndexAccess)UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
1974f4f7c7bSLiu Zhe         Object sheetObj = (XSpreadsheet)UnoRuntime.queryInterface(XSpreadsheet.class, xSheetsIA.getByIndex(0));
1984f4f7c7bSLiu Zhe 	    XSpreadsheet xSheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, sheetObj);
1994f4f7c7bSLiu Zhe 
2004f4f7c7bSLiu Zhe         // Create a 3x3 cell range "A2:C4" with the values 0 ... 8.
2014f4f7c7bSLiu Zhe         int nCol = 0;
2024f4f7c7bSLiu Zhe         int nValue = 0;
2034f4f7c7bSLiu Zhe 
2044f4f7c7bSLiu Zhe         for (int n = 1; n < 4; ++n){
2054f4f7c7bSLiu Zhe     	    int nRow = 1;
2064f4f7c7bSLiu Zhe     	    for (int i = 1; i < 4; ++i) {
2074f4f7c7bSLiu Zhe 		        xSheet.getCellByPosition( nCol, nRow ).setValue( nValue );
2084f4f7c7bSLiu Zhe 	            nRow += 1;
2094f4f7c7bSLiu Zhe 	            nValue += 1;
2104f4f7c7bSLiu Zhe 	        }
2114f4f7c7bSLiu Zhe             nCol += 1;
2124f4f7c7bSLiu Zhe        }
2134f4f7c7bSLiu Zhe 
2144f4f7c7bSLiu Zhe         //Insert 2 cells in A2:B2 and shift cells up
2154f4f7c7bSLiu Zhe 
2164f4f7c7bSLiu Zhe 	    // Get cell range A2:B2 by position - (column, row, column, row)
2174f4f7c7bSLiu Zhe         XCellRange xCellRange = xSheet.getCellRangeByPosition( 0, 1, 1, 1 );
2184f4f7c7bSLiu Zhe         XCellRangeMovement xCellRangeMovement = (XCellRangeMovement)
2194f4f7c7bSLiu Zhe     		UnoRuntime.queryInterface(XCellRangeMovement.class, xSheet);
2204f4f7c7bSLiu Zhe 
2214f4f7c7bSLiu Zhe         // Gets the selected range's address/location.
2224f4f7c7bSLiu Zhe 	    XCellRangeAddressable xCellRangeAddr = (XCellRangeAddressable)
2234f4f7c7bSLiu Zhe             UnoRuntime.queryInterface( XCellRangeAddressable.class, xCellRange );
2244f4f7c7bSLiu Zhe         CellRangeAddress address = xCellRangeAddr.getRangeAddress();
2254f4f7c7bSLiu Zhe 
2264f4f7c7bSLiu Zhe         //Execute delete cells in A2:B2 and shift cells in column A & B move up
2274f4f7c7bSLiu Zhe         xCellRangeMovement.removeRange(address,CellDeleteMode.UP);
2284f4f7c7bSLiu Zhe 
2294f4f7c7bSLiu Zhe         //Get value of cell A2, B2 and C2
2304f4f7c7bSLiu Zhe         XCell cellA2 = xSheet.getCellByPosition(0, 1);
2314f4f7c7bSLiu Zhe         XCell cellB2 = xSheet.getCellByPosition(1, 1);
2324f4f7c7bSLiu Zhe         XCell cellC2 = xSheet.getCellByPosition(2, 1);
2334f4f7c7bSLiu Zhe         double expectValueA2up = 1;
2344f4f7c7bSLiu Zhe         double expectValueB2up = 4;
2354f4f7c7bSLiu Zhe         double expectValueC2up = 6;
2364f4f7c7bSLiu Zhe 
2374f4f7c7bSLiu Zhe         //Verify results after execute delete cells in A2:B2 and shift cells in column A & B move up
2384f4f7c7bSLiu Zhe         assertEquals("Verify value of A2 after execute delete cells in A2:B2 and shift cells up.",
2394f4f7c7bSLiu Zhe     		expectValueA2up, cellA2.getValue(),0);
2404f4f7c7bSLiu Zhe         assertEquals("Verify value of B2 after execute delete cells in A2:B2 and shift cells up.",
2414f4f7c7bSLiu Zhe     		expectValueB2up, cellB2.getValue(),0);
2424f4f7c7bSLiu Zhe         assertEquals("Verify value of C2 after execute delete cells in A2:B2 and shift cells up.",
2434f4f7c7bSLiu Zhe     		expectValueC2up, cellC2.getValue(),0);
2444f4f7c7bSLiu Zhe 
2454f4f7c7bSLiu Zhe         //Execute delete cells in A2:B2 and shift other existing cells in row 2 move left
2464f4f7c7bSLiu Zhe         xCellRangeMovement.removeRange(address,CellDeleteMode.LEFT);
2474f4f7c7bSLiu Zhe 
2484f4f7c7bSLiu Zhe         //Get value of cell A2, B2 and C2
2494f4f7c7bSLiu Zhe         cellA2 = xSheet.getCellByPosition(0, 1);
2504f4f7c7bSLiu Zhe         cellB2 = xSheet.getCellByPosition(1, 1);
2514f4f7c7bSLiu Zhe         cellC2 = xSheet.getCellByPosition(2, 1);
2524f4f7c7bSLiu Zhe         double expectValueA2left = 6;
2534f4f7c7bSLiu Zhe         double expectValueB2left = 0.0;
2544f4f7c7bSLiu Zhe         double expectValueC2left = 0.0;
2554f4f7c7bSLiu Zhe 
2564f4f7c7bSLiu Zhe         //Verify results after execute delete cells in A2:B2 and shift other existing cells in row 2 move left
2574f4f7c7bSLiu Zhe         assertEquals("Verify value of A2 after execute delete cells in A2:B2 and shift cells left.",
2584f4f7c7bSLiu Zhe     		expectValueA2left, cellA2.getValue(),0);
2594f4f7c7bSLiu Zhe         assertEquals("Verify value of B2 after execute delete cells in A2:B2 and shift cells left.",
2604f4f7c7bSLiu Zhe     		expectValueB2left, cellB2.getValue(),0);
2614f4f7c7bSLiu Zhe         assertEquals("Verify value of C2 after execute delete cells in A2:B2 and shift cells left.",
2624f4f7c7bSLiu Zhe     		expectValueC2left, cellC2.getValue(),0);
2634f4f7c7bSLiu Zhe 
2644f4f7c7bSLiu Zhe         //Execute delete Entire Row 2 make the whole existing cell range moves up
2654f4f7c7bSLiu Zhe         xCellRangeMovement.removeRange(address,CellDeleteMode.ROWS);
2664f4f7c7bSLiu Zhe 
2674f4f7c7bSLiu Zhe         //Get value of cell A2, B2 and C2
2684f4f7c7bSLiu Zhe         cellA2 = xSheet.getCellByPosition(0, 1);
2694f4f7c7bSLiu Zhe         cellB2 = xSheet.getCellByPosition(1, 1);
2704f4f7c7bSLiu Zhe         cellC2 = xSheet.getCellByPosition(2, 1);
2714f4f7c7bSLiu Zhe         double expectValueA2rows = 2;
2724f4f7c7bSLiu Zhe         double expectValueB2rows = 5;
2734f4f7c7bSLiu Zhe         double expectValueC2rows = 7;
2744f4f7c7bSLiu Zhe 
2754f4f7c7bSLiu Zhe         //Verify results after delete Entire Row 2 make the whole existing cell range moves up
2764f4f7c7bSLiu Zhe         assertEquals("Verify value of A2 after delete Entire Row 2 make the whole existing cell range moves up.",
2774f4f7c7bSLiu Zhe     		expectValueA2rows, cellA2.getValue(),0);
2784f4f7c7bSLiu Zhe         assertEquals("Verify value of B2 after delete Entire Row 2 make the whole existing cell range moves up.",
2794f4f7c7bSLiu Zhe     		expectValueB2rows, cellB2.getValue(),0);
2804f4f7c7bSLiu Zhe         assertEquals("Verify value of C2 after delete Entire Row 2 make the whole existing cell range moves up.",
2814f4f7c7bSLiu Zhe     		expectValueC2rows, cellC2.getValue(),0);
2824f4f7c7bSLiu Zhe 
2834f4f7c7bSLiu Zhe         //Execute delete Entire Columns make the whole existing cell range moves left
2844f4f7c7bSLiu Zhe         xCellRangeMovement.removeRange(address,CellDeleteMode.COLUMNS);
2854f4f7c7bSLiu Zhe 
2864f4f7c7bSLiu Zhe         //Get value of cell A2, B2 and C2
2874f4f7c7bSLiu Zhe         cellA2 = xSheet.getCellByPosition(0, 1);
2884f4f7c7bSLiu Zhe         cellB2 = xSheet.getCellByPosition(1, 1);
2894f4f7c7bSLiu Zhe         cellC2 = xSheet.getCellByPosition(2, 1);
2904f4f7c7bSLiu Zhe         double expectValueA2columns = 7;
2914f4f7c7bSLiu Zhe         double expectValueB2columns = 0.0;
2924f4f7c7bSLiu Zhe         double expectValueC2columns = 0.0;
2934f4f7c7bSLiu Zhe 
2944f4f7c7bSLiu Zhe         //Verify results after execute delete Entire Columns make the whole existing cell range moves left
2954f4f7c7bSLiu Zhe         assertEquals("Verify value of A2 after delete Entire Columns make the whole existing cell range moves left.",
2964f4f7c7bSLiu Zhe     		expectValueA2columns, cellA2.getValue(),0);
2974f4f7c7bSLiu Zhe         assertEquals("Verify value of B2 after delete Entire Columns make the whole existing cell range moves left.",
2984f4f7c7bSLiu Zhe     		expectValueB2columns, cellB2.getValue(),0);
2994f4f7c7bSLiu Zhe         assertEquals("Verify value of C2 after delete Entire Columns make the whole existing cell range moves left.",
3004f4f7c7bSLiu Zhe     		expectValueC2columns, cellC2.getValue(),0);
3014f4f7c7bSLiu Zhe 
3024f4f7c7bSLiu Zhe     }
3034f4f7c7bSLiu Zhe 
3044f4f7c7bSLiu Zhe }
3054f4f7c7bSLiu Zhe 
3064f4f7c7bSLiu Zhe 
307