xref: /AOO41X/test/testuno/source/fvt/uno/sc/cell/InsertDeleteCells.java (revision eba4d44a33e5be0b2528d5a9a6f0dcbf65adaa0d)
1*eba4d44aSLiu Zhe package fvt.uno.sc.cell;
2*eba4d44aSLiu Zhe 
3*eba4d44aSLiu Zhe import static org.junit.Assert.*;
4*eba4d44aSLiu Zhe 
5*eba4d44aSLiu Zhe import org.junit.After;
6*eba4d44aSLiu Zhe import org.junit.Before;
7*eba4d44aSLiu Zhe import org.junit.Test;
8*eba4d44aSLiu Zhe 
9*eba4d44aSLiu Zhe import org.openoffice.test.uno.UnoApp;
10*eba4d44aSLiu Zhe 
11*eba4d44aSLiu Zhe import com.sun.star.container.XIndexAccess;
12*eba4d44aSLiu Zhe import com.sun.star.lang.XComponent;
13*eba4d44aSLiu Zhe import com.sun.star.sheet.CellDeleteMode;
14*eba4d44aSLiu Zhe import com.sun.star.sheet.CellInsertMode;
15*eba4d44aSLiu Zhe import com.sun.star.sheet.XCellRangeAddressable;
16*eba4d44aSLiu Zhe import com.sun.star.sheet.XSpreadsheet;
17*eba4d44aSLiu Zhe import com.sun.star.sheet.XSpreadsheetDocument;
18*eba4d44aSLiu Zhe import com.sun.star.sheet.XSpreadsheets;
19*eba4d44aSLiu Zhe import com.sun.star.table.XCell;
20*eba4d44aSLiu Zhe import com.sun.star.uno.UnoRuntime;
21*eba4d44aSLiu Zhe import com.sun.star.table.XCellRange;
22*eba4d44aSLiu Zhe import com.sun.star.table.CellRangeAddress;
23*eba4d44aSLiu Zhe import com.sun.star.sheet.XCellRangeMovement;
24*eba4d44aSLiu Zhe 
25*eba4d44aSLiu Zhe /**
26*eba4d44aSLiu Zhe  * Test insert or delete cells
27*eba4d44aSLiu Zhe  * @author BinGuo 8/30/2012
28*eba4d44aSLiu Zhe  *
29*eba4d44aSLiu Zhe  */
30*eba4d44aSLiu Zhe 
31*eba4d44aSLiu Zhe public class InsertDeleteCells {
32*eba4d44aSLiu Zhe 
33*eba4d44aSLiu Zhe 	UnoApp unoApp = new UnoApp();
34*eba4d44aSLiu Zhe 	XSpreadsheetDocument scDocument = null;
35*eba4d44aSLiu Zhe 	XComponent scComponent = null;
36*eba4d44aSLiu Zhe 
37*eba4d44aSLiu Zhe 	@Before
38*eba4d44aSLiu Zhe 	public void setUp() throws Exception {
39*eba4d44aSLiu Zhe 		unoApp.start();
40*eba4d44aSLiu Zhe 	}
41*eba4d44aSLiu Zhe 
42*eba4d44aSLiu Zhe 	@After
43*eba4d44aSLiu Zhe 	public void tearDown() throws Exception {
44*eba4d44aSLiu Zhe 		unoApp.closeDocument(scComponent);
45*eba4d44aSLiu Zhe 		unoApp.close();
46*eba4d44aSLiu Zhe 		}
47*eba4d44aSLiu Zhe 
48*eba4d44aSLiu Zhe 	/**
49*eba4d44aSLiu Zhe 	 * New spreadsheet
50*eba4d44aSLiu Zhe 	 * Create 3x3 cell range A2:C4
51*eba4d44aSLiu Zhe 	 * Execute insert empty A2 & B2 cells shift other existing cells in Column A & B down
52*eba4d44aSLiu Zhe 	 * Execute insert empty A2 & B2 cells shift other existing cells in row 2 move right
53*eba4d44aSLiu Zhe 	 * Execute insert entire empty Row 2 make the whole existing cell range moves down
54*eba4d44aSLiu Zhe 	 * Execute insert entire empty Columns A & B make the whole existing cell range moves right
55*eba4d44aSLiu Zhe 	 * Verify results after insert cells
56*eba4d44aSLiu Zhe 	 */
57*eba4d44aSLiu Zhe 
58*eba4d44aSLiu Zhe 	@Test
59*eba4d44aSLiu Zhe 	public void testInsertCells() throws Exception {
60*eba4d44aSLiu Zhe 
61*eba4d44aSLiu Zhe 		scComponent = unoApp.newDocument("scalc");
62*eba4d44aSLiu Zhe 		scDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, scComponent);
63*eba4d44aSLiu Zhe 		XSpreadsheets xSpreadsheets = scDocument.getSheets();
64*eba4d44aSLiu Zhe 
65*eba4d44aSLiu Zhe 		// Gets the first sheet in the document.
66*eba4d44aSLiu Zhe         XIndexAccess xSheetsIA = (XIndexAccess)UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
67*eba4d44aSLiu Zhe         Object sheetObj = (XSpreadsheet)UnoRuntime.queryInterface(XSpreadsheet.class, xSheetsIA.getByIndex(0));
68*eba4d44aSLiu Zhe 		XSpreadsheet xSheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, sheetObj);
69*eba4d44aSLiu Zhe 
70*eba4d44aSLiu Zhe 	    // Create a 3x3 cell range "A2:C4" with the values 0 ... 8.
71*eba4d44aSLiu Zhe 	    int nCol = 0;
72*eba4d44aSLiu Zhe 	    int nValue = 0;
73*eba4d44aSLiu Zhe 
74*eba4d44aSLiu Zhe 	    for (int n = 1; n < 4; ++n){
75*eba4d44aSLiu Zhe 	    	int nRow = 1;
76*eba4d44aSLiu Zhe 	    	for (int i = 1; i < 4; ++i) {
77*eba4d44aSLiu Zhe 			   xSheet.getCellByPosition( nCol, nRow ).setValue( nValue );
78*eba4d44aSLiu Zhe 		       nRow += 1;
79*eba4d44aSLiu Zhe 		       nValue += 1;
80*eba4d44aSLiu Zhe 		    }
81*eba4d44aSLiu Zhe 	        nCol += 1;
82*eba4d44aSLiu Zhe 	    }
83*eba4d44aSLiu Zhe 
84*eba4d44aSLiu Zhe 	    //Insert 2 cells in A2:B2 and shift other existing cells in Column A & B down
85*eba4d44aSLiu Zhe 
86*eba4d44aSLiu Zhe 		// Get cell range A2:B2 by position - (column, row, column, row)
87*eba4d44aSLiu Zhe         XCellRange xCellRange = xSheet.getCellRangeByPosition( 0, 1, 1, 1 );
88*eba4d44aSLiu Zhe         XCellRangeMovement xCellRangeMovement = (XCellRangeMovement)
89*eba4d44aSLiu Zhe         		UnoRuntime.queryInterface(XCellRangeMovement.class, xSheet);
90*eba4d44aSLiu Zhe 
91*eba4d44aSLiu Zhe         // Gets the selected range's address/location.
92*eba4d44aSLiu Zhe  	    XCellRangeAddressable xCellRangeAddr = (XCellRangeAddressable)
93*eba4d44aSLiu Zhe 	            UnoRuntime.queryInterface( XCellRangeAddressable.class, xCellRange );
94*eba4d44aSLiu Zhe 	    CellRangeAddress address = xCellRangeAddr.getRangeAddress();
95*eba4d44aSLiu Zhe 
96*eba4d44aSLiu Zhe 	    //Execute Insert cells in A2:B2 and shift other existing cells in Column A & B down
97*eba4d44aSLiu Zhe 	    xCellRangeMovement.insertCells(address, CellInsertMode.DOWN);
98*eba4d44aSLiu Zhe 
99*eba4d44aSLiu Zhe 	    //Get value of cell A2, B2 and C2
100*eba4d44aSLiu Zhe         XCell cellA2 = xSheet.getCellByPosition(0, 1);
101*eba4d44aSLiu Zhe         XCell cellB2 = xSheet.getCellByPosition(1, 1);
102*eba4d44aSLiu Zhe         XCell cellC2 = xSheet.getCellByPosition(2, 1);
103*eba4d44aSLiu Zhe         double expectValueA2 = 0.0;
104*eba4d44aSLiu Zhe         double expectValueB2 = 0.0;
105*eba4d44aSLiu Zhe         double expectValueC2 = 6;
106*eba4d44aSLiu Zhe 
107*eba4d44aSLiu Zhe         //Verify results after execute Insert cells in A2:B2 and shift other existing cells in Column A & B down
108*eba4d44aSLiu Zhe         assertEquals("Verify value of A2 after execute Insert cells in A2:B2 and shift cells down.",
109*eba4d44aSLiu Zhe         		expectValueA2, cellA2.getValue(),0);
110*eba4d44aSLiu Zhe         assertEquals("Verify value of B2 after execute Insert cells in A2:B2 and shift cells down.",
111*eba4d44aSLiu Zhe         		expectValueB2, cellB2.getValue(),0);
112*eba4d44aSLiu Zhe         assertEquals("Verify value of C2 after execute Insert cells in A2:B2 and shift cells down.",
113*eba4d44aSLiu Zhe         		expectValueC2, cellC2.getValue(),0);
114*eba4d44aSLiu Zhe 
115*eba4d44aSLiu Zhe         //Execute Insert cells in A2:B2 and shift other existing cells in row 2 move right
116*eba4d44aSLiu Zhe 	    xCellRangeMovement.insertCells(address, CellInsertMode.RIGHT);
117*eba4d44aSLiu Zhe 
118*eba4d44aSLiu Zhe 	    //Get value of cell C2, D2, E2 and C3
119*eba4d44aSLiu Zhe 	    cellC2 = xSheet.getCellByPosition(2, 1);
120*eba4d44aSLiu Zhe         XCell cellD2 = xSheet.getCellByPosition(3, 1);
121*eba4d44aSLiu Zhe         XCell cellE2 = xSheet.getCellByPosition(4, 1);
122*eba4d44aSLiu Zhe         XCell cellC3 = xSheet.getCellByPosition(2, 2);
123*eba4d44aSLiu Zhe         double expectValueC2right = 0.0;
124*eba4d44aSLiu Zhe         double expectValueD2 = 0.0;
125*eba4d44aSLiu Zhe         double expectValueE2 = 6;
126*eba4d44aSLiu Zhe         double expectValueC3 = 7;
127*eba4d44aSLiu Zhe 
128*eba4d44aSLiu Zhe         //Verify results after execute Insert cells in A2:B2 and shift other existing cells in row 2 move right
129*eba4d44aSLiu Zhe         assertEquals("Verify value of C2 after execute Insert cells in A2:B2 and shift cells Right.",
130*eba4d44aSLiu Zhe         		expectValueC2right, cellC2.getValue(),0);
131*eba4d44aSLiu Zhe         assertEquals("Verify value of D2 after execute Insert cells in A2:B2 and shift cells Right.",
132*eba4d44aSLiu Zhe         		expectValueD2, cellD2.getValue(),0);
133*eba4d44aSLiu Zhe         assertEquals("Verify value of E2 after execute Insert cells in A2:B2 and shift cells Right.",
134*eba4d44aSLiu Zhe         		expectValueE2, cellE2.getValue(),0);
135*eba4d44aSLiu Zhe         assertEquals("Verify value of C3 after execute Insert cells in A2:B2 and shift cells Right.",
136*eba4d44aSLiu Zhe         		expectValueC3, cellC3.getValue(),0);
137*eba4d44aSLiu Zhe 
138*eba4d44aSLiu Zhe         //Execute Insert Entire Row 2 make the whole existing cell range moves down
139*eba4d44aSLiu Zhe 	    xCellRangeMovement.insertCells(address, CellInsertMode.ROWS);
140*eba4d44aSLiu Zhe 
141*eba4d44aSLiu Zhe 	    //Get value of cell E2, E3 and C3
142*eba4d44aSLiu Zhe 	    cellE2 = xSheet.getCellByPosition(4, 1);
143*eba4d44aSLiu Zhe         XCell cellE3 = xSheet.getCellByPosition(4, 2);
144*eba4d44aSLiu Zhe         cellC3 = xSheet.getCellByPosition(2, 2);
145*eba4d44aSLiu Zhe         double expectValueE2rows = 0.0;
146*eba4d44aSLiu Zhe         double expectValueE3 = 6;
147*eba4d44aSLiu Zhe         double expectValueC3rows = 0.0;
148*eba4d44aSLiu Zhe 
149*eba4d44aSLiu Zhe         //Verify results after execute Insert Entire Row 2 make the whole existing cell range moves down
150*eba4d44aSLiu Zhe         assertEquals("Verify value of E2 after execute Insert Entire Row 2 make the whole existing cell range moves down.",
151*eba4d44aSLiu Zhe         		expectValueE2rows, cellE2.getValue(),0);
152*eba4d44aSLiu Zhe         assertEquals("Verify value of E3 after execute Insert Entire Row 2 make the whole existing cell range moves down.",
153*eba4d44aSLiu Zhe         		expectValueE3, cellE3.getValue(),0);
154*eba4d44aSLiu Zhe         assertEquals("Verify value of C3 after execute Insert Entire Row 2 make the whole existing cell range moves down.",
155*eba4d44aSLiu Zhe         		expectValueC3rows, cellC3.getValue(),0);
156*eba4d44aSLiu Zhe 
157*eba4d44aSLiu Zhe 	    //Execute Insert Entire Columns make the whole existing cell range moves right
158*eba4d44aSLiu Zhe 	    xCellRangeMovement.insertCells(address, CellInsertMode.COLUMNS);
159*eba4d44aSLiu Zhe 
160*eba4d44aSLiu Zhe 	    //Get value of cell C4, C5 and C6
161*eba4d44aSLiu Zhe 	    XCell cellC4 = xSheet.getCellByPosition(2, 3);
162*eba4d44aSLiu Zhe         XCell cellC5 = xSheet.getCellByPosition(2, 4);
163*eba4d44aSLiu Zhe         XCell cellC6 = xSheet.getCellByPosition(2, 5);
164*eba4d44aSLiu Zhe         double expectValueC4 = 0.0;
165*eba4d44aSLiu Zhe         double expectValueC5 = 1;
166*eba4d44aSLiu Zhe         double expectValueC6 = 2;
167*eba4d44aSLiu Zhe 
168*eba4d44aSLiu Zhe         //Verify results after execute Insert Entire Columns make the whole existing cell range moves right
169*eba4d44aSLiu Zhe         assertEquals("Verify value of E2 after execute Insert Entire Row 2 make the whole existing cell range moves down.",
170*eba4d44aSLiu Zhe     		   expectValueC4, cellC4.getValue(),0);
171*eba4d44aSLiu Zhe         assertEquals("Verify value of E3 after execute Insert Entire Row 2 make the whole existing cell range moves down.",
172*eba4d44aSLiu Zhe     		   expectValueC5, cellC5.getValue(),0);
173*eba4d44aSLiu Zhe         assertEquals("Verify value of C3 after execute Insert Entire Row 2 make the whole existing cell range moves down.",
174*eba4d44aSLiu Zhe     		   expectValueC6, cellC6.getValue(),0);
175*eba4d44aSLiu Zhe 
176*eba4d44aSLiu Zhe     }
177*eba4d44aSLiu Zhe 
178*eba4d44aSLiu Zhe 	/**
179*eba4d44aSLiu Zhe 	 * New spreadsheet
180*eba4d44aSLiu Zhe 	 * Create 3x3 cell range A2:C4
181*eba4d44aSLiu Zhe 	 * Execute delete cells A2 & B2 shift other existing cells in column A & B move up
182*eba4d44aSLiu Zhe 	 * Execute delete cells A2 & B2 shift other existing cells in row 2 move left
183*eba4d44aSLiu Zhe 	 * Execute delete entire Row 2 make the whole existing cell range moves up
184*eba4d44aSLiu Zhe 	 * Execute delete entire Columns A & B make the whole existing cell range moves left
185*eba4d44aSLiu Zhe 	 * Verify results after delete cells
186*eba4d44aSLiu Zhe 	 */
187*eba4d44aSLiu Zhe 
188*eba4d44aSLiu Zhe     @Test
189*eba4d44aSLiu Zhe     public void testDeleteCells() throws Exception {
190*eba4d44aSLiu Zhe 
191*eba4d44aSLiu Zhe 	    scComponent = unoApp.newDocument("scalc");
192*eba4d44aSLiu Zhe 	    scDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, scComponent);
193*eba4d44aSLiu Zhe 	    XSpreadsheets xSpreadsheets = scDocument.getSheets();
194*eba4d44aSLiu Zhe 
195*eba4d44aSLiu Zhe 	    // Gets the first sheet in the document.
196*eba4d44aSLiu Zhe         XIndexAccess xSheetsIA = (XIndexAccess)UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
197*eba4d44aSLiu Zhe         Object sheetObj = (XSpreadsheet)UnoRuntime.queryInterface(XSpreadsheet.class, xSheetsIA.getByIndex(0));
198*eba4d44aSLiu Zhe 	    XSpreadsheet xSheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, sheetObj);
199*eba4d44aSLiu Zhe 
200*eba4d44aSLiu Zhe         // Create a 3x3 cell range "A2:C4" with the values 0 ... 8.
201*eba4d44aSLiu Zhe         int nCol = 0;
202*eba4d44aSLiu Zhe         int nValue = 0;
203*eba4d44aSLiu Zhe 
204*eba4d44aSLiu Zhe         for (int n = 1; n < 4; ++n){
205*eba4d44aSLiu Zhe     	    int nRow = 1;
206*eba4d44aSLiu Zhe     	    for (int i = 1; i < 4; ++i) {
207*eba4d44aSLiu Zhe 		        xSheet.getCellByPosition( nCol, nRow ).setValue( nValue );
208*eba4d44aSLiu Zhe 	            nRow += 1;
209*eba4d44aSLiu Zhe 	            nValue += 1;
210*eba4d44aSLiu Zhe 	        }
211*eba4d44aSLiu Zhe             nCol += 1;
212*eba4d44aSLiu Zhe        }
213*eba4d44aSLiu Zhe 
214*eba4d44aSLiu Zhe         //Insert 2 cells in A2:B2 and shift cells up
215*eba4d44aSLiu Zhe 
216*eba4d44aSLiu Zhe 	    // Get cell range A2:B2 by position - (column, row, column, row)
217*eba4d44aSLiu Zhe         XCellRange xCellRange = xSheet.getCellRangeByPosition( 0, 1, 1, 1 );
218*eba4d44aSLiu Zhe         XCellRangeMovement xCellRangeMovement = (XCellRangeMovement)
219*eba4d44aSLiu Zhe     		UnoRuntime.queryInterface(XCellRangeMovement.class, xSheet);
220*eba4d44aSLiu Zhe 
221*eba4d44aSLiu Zhe         // Gets the selected range's address/location.
222*eba4d44aSLiu Zhe 	    XCellRangeAddressable xCellRangeAddr = (XCellRangeAddressable)
223*eba4d44aSLiu Zhe             UnoRuntime.queryInterface( XCellRangeAddressable.class, xCellRange );
224*eba4d44aSLiu Zhe         CellRangeAddress address = xCellRangeAddr.getRangeAddress();
225*eba4d44aSLiu Zhe 
226*eba4d44aSLiu Zhe         //Execute delete cells in A2:B2 and shift cells in column A & B move up
227*eba4d44aSLiu Zhe         xCellRangeMovement.removeRange(address,CellDeleteMode.UP);
228*eba4d44aSLiu Zhe 
229*eba4d44aSLiu Zhe         //Get value of cell A2, B2 and C2
230*eba4d44aSLiu Zhe         XCell cellA2 = xSheet.getCellByPosition(0, 1);
231*eba4d44aSLiu Zhe         XCell cellB2 = xSheet.getCellByPosition(1, 1);
232*eba4d44aSLiu Zhe         XCell cellC2 = xSheet.getCellByPosition(2, 1);
233*eba4d44aSLiu Zhe         double expectValueA2up = 1;
234*eba4d44aSLiu Zhe         double expectValueB2up = 4;
235*eba4d44aSLiu Zhe         double expectValueC2up = 6;
236*eba4d44aSLiu Zhe 
237*eba4d44aSLiu Zhe         //Verify results after execute delete cells in A2:B2 and shift cells in column A & B move up
238*eba4d44aSLiu Zhe         assertEquals("Verify value of A2 after execute delete cells in A2:B2 and shift cells up.",
239*eba4d44aSLiu Zhe     		expectValueA2up, cellA2.getValue(),0);
240*eba4d44aSLiu Zhe         assertEquals("Verify value of B2 after execute delete cells in A2:B2 and shift cells up.",
241*eba4d44aSLiu Zhe     		expectValueB2up, cellB2.getValue(),0);
242*eba4d44aSLiu Zhe         assertEquals("Verify value of C2 after execute delete cells in A2:B2 and shift cells up.",
243*eba4d44aSLiu Zhe     		expectValueC2up, cellC2.getValue(),0);
244*eba4d44aSLiu Zhe 
245*eba4d44aSLiu Zhe         //Execute delete cells in A2:B2 and shift other existing cells in row 2 move left
246*eba4d44aSLiu Zhe         xCellRangeMovement.removeRange(address,CellDeleteMode.LEFT);
247*eba4d44aSLiu Zhe 
248*eba4d44aSLiu Zhe         //Get value of cell A2, B2 and C2
249*eba4d44aSLiu Zhe         cellA2 = xSheet.getCellByPosition(0, 1);
250*eba4d44aSLiu Zhe         cellB2 = xSheet.getCellByPosition(1, 1);
251*eba4d44aSLiu Zhe         cellC2 = xSheet.getCellByPosition(2, 1);
252*eba4d44aSLiu Zhe         double expectValueA2left = 6;
253*eba4d44aSLiu Zhe         double expectValueB2left = 0.0;
254*eba4d44aSLiu Zhe         double expectValueC2left = 0.0;
255*eba4d44aSLiu Zhe 
256*eba4d44aSLiu Zhe         //Verify results after execute delete cells in A2:B2 and shift other existing cells in row 2 move left
257*eba4d44aSLiu Zhe         assertEquals("Verify value of A2 after execute delete cells in A2:B2 and shift cells left.",
258*eba4d44aSLiu Zhe     		expectValueA2left, cellA2.getValue(),0);
259*eba4d44aSLiu Zhe         assertEquals("Verify value of B2 after execute delete cells in A2:B2 and shift cells left.",
260*eba4d44aSLiu Zhe     		expectValueB2left, cellB2.getValue(),0);
261*eba4d44aSLiu Zhe         assertEquals("Verify value of C2 after execute delete cells in A2:B2 and shift cells left.",
262*eba4d44aSLiu Zhe     		expectValueC2left, cellC2.getValue(),0);
263*eba4d44aSLiu Zhe 
264*eba4d44aSLiu Zhe         //Execute delete Entire Row 2 make the whole existing cell range moves up
265*eba4d44aSLiu Zhe         xCellRangeMovement.removeRange(address,CellDeleteMode.ROWS);
266*eba4d44aSLiu Zhe 
267*eba4d44aSLiu Zhe         //Get value of cell A2, B2 and C2
268*eba4d44aSLiu Zhe         cellA2 = xSheet.getCellByPosition(0, 1);
269*eba4d44aSLiu Zhe         cellB2 = xSheet.getCellByPosition(1, 1);
270*eba4d44aSLiu Zhe         cellC2 = xSheet.getCellByPosition(2, 1);
271*eba4d44aSLiu Zhe         double expectValueA2rows = 2;
272*eba4d44aSLiu Zhe         double expectValueB2rows = 5;
273*eba4d44aSLiu Zhe         double expectValueC2rows = 7;
274*eba4d44aSLiu Zhe 
275*eba4d44aSLiu Zhe         //Verify results after delete Entire Row 2 make the whole existing cell range moves up
276*eba4d44aSLiu Zhe         assertEquals("Verify value of A2 after delete Entire Row 2 make the whole existing cell range moves up.",
277*eba4d44aSLiu Zhe     		expectValueA2rows, cellA2.getValue(),0);
278*eba4d44aSLiu Zhe         assertEquals("Verify value of B2 after delete Entire Row 2 make the whole existing cell range moves up.",
279*eba4d44aSLiu Zhe     		expectValueB2rows, cellB2.getValue(),0);
280*eba4d44aSLiu Zhe         assertEquals("Verify value of C2 after delete Entire Row 2 make the whole existing cell range moves up.",
281*eba4d44aSLiu Zhe     		expectValueC2rows, cellC2.getValue(),0);
282*eba4d44aSLiu Zhe 
283*eba4d44aSLiu Zhe         //Execute delete Entire Columns make the whole existing cell range moves left
284*eba4d44aSLiu Zhe         xCellRangeMovement.removeRange(address,CellDeleteMode.COLUMNS);
285*eba4d44aSLiu Zhe 
286*eba4d44aSLiu Zhe         //Get value of cell A2, B2 and C2
287*eba4d44aSLiu Zhe         cellA2 = xSheet.getCellByPosition(0, 1);
288*eba4d44aSLiu Zhe         cellB2 = xSheet.getCellByPosition(1, 1);
289*eba4d44aSLiu Zhe         cellC2 = xSheet.getCellByPosition(2, 1);
290*eba4d44aSLiu Zhe         double expectValueA2columns = 7;
291*eba4d44aSLiu Zhe         double expectValueB2columns = 0.0;
292*eba4d44aSLiu Zhe         double expectValueC2columns = 0.0;
293*eba4d44aSLiu Zhe 
294*eba4d44aSLiu Zhe         //Verify results after execute delete Entire Columns make the whole existing cell range moves left
295*eba4d44aSLiu Zhe         assertEquals("Verify value of A2 after delete Entire Columns make the whole existing cell range moves left.",
296*eba4d44aSLiu Zhe     		expectValueA2columns, cellA2.getValue(),0);
297*eba4d44aSLiu Zhe         assertEquals("Verify value of B2 after delete Entire Columns make the whole existing cell range moves left.",
298*eba4d44aSLiu Zhe     		expectValueB2columns, cellB2.getValue(),0);
299*eba4d44aSLiu Zhe         assertEquals("Verify value of C2 after delete Entire Columns make the whole existing cell range moves left.",
300*eba4d44aSLiu Zhe     		expectValueC2columns, cellC2.getValue(),0);
301*eba4d44aSLiu Zhe 
302*eba4d44aSLiu Zhe     }
303*eba4d44aSLiu Zhe 
304*eba4d44aSLiu Zhe }
305*eba4d44aSLiu Zhe 
306*eba4d44aSLiu Zhe 
307