Author: wanglf
Date: Tue Dec 4 05:02:19 2012
New Revision: 1416776
URL: http://svn.apache.org/viewvc?rev=1416776&view=rev
Log:
Bug 121386 - [UNO API]script Refactor about some SC script. Provide by Terry
Yang, reviewd by WangLifeng
Modified:
openoffice/trunk/test/testuno/source/fvt/uno/sc/data/DataSort.java
openoffice/trunk/test/testuno/source/fvt/uno/sc/data/StandardFilterOption.java
openoffice/trunk/test/testuno/source/fvt/uno/sc/data/StardarFilterTest.java
openoffice/trunk/test/testuno/source/fvt/uno/sc/data/ValidityTypeTest.java
openoffice/trunk/test/testuno/source/fvt/uno/sc/sheet/SheetBasicTest.java
Modified: openoffice/trunk/test/testuno/source/fvt/uno/sc/data/DataSort.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/test/testuno/source/fvt/uno/sc/data/DataSort.java?rev=1416776&r1=1416775&r2=1416776&view=diff
==============================================================================
--- openoffice/trunk/test/testuno/source/fvt/uno/sc/data/DataSort.java
(original)
+++ openoffice/trunk/test/testuno/source/fvt/uno/sc/data/DataSort.java Tue Dec
4 05:02:19 2012
@@ -19,6 +19,7 @@
*
*************************************************************/
package fvt.uno.sc.data;
+
import static org.junit.Assert.*;
import org.junit.After;
@@ -55,9 +56,8 @@ public class DataSort {
@After
public void tearDownDocument() {
- unoApp.close();
- unoApp.closeDocument(scComponent);
-
+ unoApp.close();
+ unoApp.closeDocument(scComponent);
}
@BeforeClass
@@ -71,8 +71,11 @@ public class DataSort {
}
+ /**
+ * test single field sort
+ */
@Test
- public void singleFiledSort() throws Exception {
+ public void singleFieldSort() throws Exception {
scDocument = SCUtil.getSCDocument(scComponent);
XSpreadsheet currentsheet = SCUtil.getCurrentSheet(scDocument);
XCellRange sourceRange =
currentsheet.getCellRangeByName("A1:E8");
@@ -84,49 +87,55 @@ public class DataSort {
{ "MS", 10, 1, "A", "Joker" }, { "MS", 10, 3,
"B", "Kevin" },
{ "CS", 30, 7, "C", "Tom" } };
sourceData.setDataArray(Source);
-
- // --- sort by second column, ascending ---
-
- // define the fields to sort
- TableSortField[] aSortFields = new TableSortField[1];
- aSortFields[0] = new TableSortField();
- aSortFields[0].Field = 1;
- aSortFields[0].IsAscending = true;
- aSortFields[0].IsCaseSensitive = false;
-
- // define the sort descriptor
- PropertyValue[] aSortDesc = new PropertyValue[2];
- aSortDesc[0] = new PropertyValue();
- aSortDesc[0].Name = "SortFields";
- aSortDesc[0].Value = aSortFields;
- aSortDesc[1] = new PropertyValue();
- aSortDesc[1].Name = "ContainsHeader";
- aSortDesc[1].Value = new Boolean(true);
-
- // perform the sorting
- XSortable xSort = (XSortable)
- UnoRuntime.queryInterface(XSortable.class, sourceRange);
- xSort.sort(aSortDesc);
-
- //Verify the sorting result
- String[][] expectResult = { { "Level", "Code", "No.",
"Team", "Name" },{ "MS", "10", "1", "A", "Joker" }, { "MS", "10", "3", "B",
"Kevin" },
- { "BS", "20", "4", "B", "Elle" }, {
"BS", "20", "6", "C", "Sweet" },
- { "BS", "20", "2", "A", "Chcomic" }, {
"CS", "30", "5", "A", "Ally" },
- { "CS", "30", "7", "C", "Tom" } };
- String[][] actureResult =
SCUtil.getTextFromCellRange(currentsheet, 0, 0, 4, 7);
- assertArrayEquals(expectResult,actureResult);
-
- //Save and reload the document verify the sort result again
- SCUtil.saveFileAs(scComponent, "SortSingleFiled",
"ods");
- XSpreadsheetDocument scDocumentTemp =
SCUtil.reloadFile(unoApp,
- scDocument, "SortSingleFiled.ods");
- scDocument = scDocumentTemp;
- currentsheet = SCUtil.getCurrentSheet(scDocument);
- actureResult =
SCUtil.getTextFromCellRange(currentsheet, 0, 0, 4, 7);
- assertArrayEquals(expectResult,actureResult);
-
+
+ // define the fields to sort
+ TableSortField[] aSortFields = new TableSortField[1];
+ aSortFields[0] = new TableSortField();
+ aSortFields[0].Field = 1;
+ aSortFields[0].IsAscending = true;
+ aSortFields[0].IsCaseSensitive = false;
+
+ // define the sort descriptor
+ PropertyValue[] aSortDesc = new PropertyValue[2];
+ aSortDesc[0] = new PropertyValue();
+ aSortDesc[0].Name = "SortFields";
+ aSortDesc[0].Value = aSortFields;
+ aSortDesc[1] = new PropertyValue();
+ aSortDesc[1].Name = "ContainsHeader";
+ aSortDesc[1].Value = new Boolean(true);
+
+ // perform the sorting
+ XSortable xSort = (XSortable) UnoRuntime.queryInterface(
+ XSortable.class, sourceRange);
+ xSort.sort(aSortDesc);
+
+ // Verify the sorting result
+ String[][] expectResult = { { "Level", "Code", "No.", "Team",
"Name" },
+ { "MS", "10", "1", "A", "Joker" },
+ { "MS", "10", "3", "B", "Kevin" },
+ { "BS", "20", "4", "B", "Elle" },
+ { "BS", "20", "6", "C", "Sweet" },
+ { "BS", "20", "2", "A", "Chcomic" },
+ { "CS", "30", "5", "A", "Ally" },
+ { "CS", "30", "7", "C", "Tom" } };
+ String[][] actureResult =
SCUtil.getTextFromCellRange(currentsheet, 0,
+ 0, 4, 7);
+ assertArrayEquals(expectResult, actureResult);
+
+ // Save and reload the document verify the sort result again
+ SCUtil.saveFileAs(scComponent, "SortSingleFiled", "ods");
+ XSpreadsheetDocument scDocumentTemp = SCUtil.reloadFile(unoApp,
+ scDocument, "SortSingleFiled.ods");
+ scDocument = scDocumentTemp;
+ currentsheet = SCUtil.getCurrentSheet(scDocument);
+ actureResult = SCUtil.getTextFromCellRange(currentsheet, 0, 0,
4, 7);
+ assertArrayEquals(expectResult, actureResult);
+
}
-
+
+ /**
+ * test sort with two fields
+ */
@Test
public void sortByTwoFields() throws Exception {
scDocument = SCUtil.getSCDocument(scComponent);
@@ -140,52 +149,59 @@ public class DataSort {
{ "MS", 10, 1, "A", "Joker" }, { "MS", 10, 3,
"B", "Kevin" },
{ "CS", 30, 7, "C", "Tom" } };
sourceData.setDataArray(Source);
-
- // --- sort by second column, ascending ---
-
- // define the fields to sort
- TableSortField[] aSortFields = new TableSortField[2];
- aSortFields[0] = new TableSortField();
- aSortFields[0].Field = 1;
- aSortFields[0].IsAscending = true;
- aSortFields[0].IsCaseSensitive = false;
- aSortFields[1] = new TableSortField();
- aSortFields[1].Field = 2;
- aSortFields[1].IsAscending = false;
- aSortFields[1].IsCaseSensitive = false;
-
- // define the sort descriptor
- PropertyValue[] aSortDesc = new PropertyValue[2];
- aSortDesc[0] = new PropertyValue();
- aSortDesc[0].Name = "SortFields";
- aSortDesc[0].Value = aSortFields;
- aSortDesc[1] = new PropertyValue();
- aSortDesc[1].Name = "ContainsHeader";
- aSortDesc[1].Value = new Boolean(true);
-
- // perform the sorting
- XSortable xSort = (XSortable)
- UnoRuntime.queryInterface(XSortable.class, sourceRange);
- xSort.sort(aSortDesc);
-
- //Verify the sorting result
- String[][] expectResult = { { "Level", "Code", "No.",
"Team", "Name" },{ "MS", "10", "3", "B", "Kevin" },{ "MS", "10", "1", "A",
"Joker" },
- { "BS", "20", "6", "C", "Sweet" },{
"BS", "20", "4", "B", "Elle" },
- { "BS", "20", "2", "A", "Chcomic" }, {
"CS", "30", "7", "C", "Tom" },{ "CS", "30", "5", "A", "Ally" }
- };
- String[][] actureResult =
SCUtil.getTextFromCellRange(currentsheet, 0, 0, 4, 7);
- assertArrayEquals(expectResult,actureResult);
-
- //Save and reload the document verify the sort result again
- SCUtil.saveFileAs(scComponent, "SortTwoFileds", "xls");
- XSpreadsheetDocument scDocumentTemp =
SCUtil.reloadFile(unoApp,
- scDocument, "SortTwoFileds.xls");
- scDocument = scDocumentTemp;
- currentsheet = SCUtil.getCurrentSheet(scDocument);
- actureResult =
SCUtil.getTextFromCellRange(currentsheet, 0, 0, 4, 7);
- assertArrayEquals(expectResult,actureResult);
+
+ // define the fields to sort
+ TableSortField[] aSortFields = new TableSortField[2];
+ aSortFields[0] = new TableSortField();
+ aSortFields[0].Field = 1;
+ aSortFields[0].IsAscending = true;
+ aSortFields[0].IsCaseSensitive = false;
+ aSortFields[1] = new TableSortField();
+ aSortFields[1].Field = 2;
+ aSortFields[1].IsAscending = false;
+ aSortFields[1].IsCaseSensitive = false;
+
+ // define the sort descriptor
+ PropertyValue[] aSortDesc = new PropertyValue[2];
+ aSortDesc[0] = new PropertyValue();
+ aSortDesc[0].Name = "SortFields";
+ aSortDesc[0].Value = aSortFields;
+ aSortDesc[1] = new PropertyValue();
+ aSortDesc[1].Name = "ContainsHeader";
+ aSortDesc[1].Value = new Boolean(true);
+
+ // perform the sorting
+ XSortable xSort = (XSortable) UnoRuntime.queryInterface(
+ XSortable.class, sourceRange);
+ xSort.sort(aSortDesc);
+
+ // Verify the sorting result
+ String[][] expectResult = { { "Level", "Code", "No.", "Team",
"Name" },
+ { "MS", "10", "3", "B", "Kevin" },
+ { "MS", "10", "1", "A", "Joker" },
+ { "BS", "20", "6", "C", "Sweet" },
+ { "BS", "20", "4", "B", "Elle" },
+ { "BS", "20", "2", "A", "Chcomic" },
+ { "CS", "30", "7", "C", "Tom" },
+ { "CS", "30", "5", "A", "Ally" } };
+ String[][] actureResult =
SCUtil.getTextFromCellRange(currentsheet, 0,
+ 0, 4, 7);
+ assertArrayEquals(expectResult, actureResult);
+
+ // Save and reload the document verify the sort result again
+ SCUtil.saveFileAs(scComponent, "SortTwoFileds", "xls");
+ XSpreadsheetDocument scDocumentTemp = SCUtil.reloadFile(unoApp,
+ scDocument, "SortTwoFileds.xls");
+ scDocument = scDocumentTemp;
+ currentsheet = SCUtil.getCurrentSheet(scDocument);
+ actureResult = SCUtil.getTextFromCellRange(currentsheet, 0, 0,
4, 7);
+ assertArrayEquals(expectResult, actureResult);
}
+
+ /**
+ * test sort with three fields
+ */
@Test
public void sortByThreeField() throws Exception {
scDocument = SCUtil.getSCDocument(scComponent);
@@ -199,54 +215,64 @@ public class DataSort {
{ "MS", 10, 1, "A", "Joker" }, { "MS", 10, 3,
"B", "Kevin" },
{ "CS", 30, 7, "C", "Tom" } };
sourceData.setDataArray(Source);
-
- // --- sort by second column, ascending ---
-
- // define the fields to sort
- TableSortField[] aSortFields = new TableSortField[3];
- aSortFields[0] = new TableSortField();
- aSortFields[0].Field = 0;
- aSortFields[0].IsAscending = true;
- aSortFields[0].IsCaseSensitive = false;
- aSortFields[1] = new TableSortField();
- aSortFields[1].Field = 1;
- aSortFields[1].IsAscending = false;
- aSortFields[1].IsCaseSensitive = false;
- aSortFields[2] = new TableSortField();
- aSortFields[2].Field = 2;
- aSortFields[2].IsAscending = false;
- aSortFields[2].IsCaseSensitive = false;
-
- // define the sort descriptor
- PropertyValue[] aSortDesc = new PropertyValue[2];
- aSortDesc[0] = new PropertyValue();
- aSortDesc[0].Name = "SortFields";
- aSortDesc[0].Value = aSortFields;
- aSortDesc[1] = new PropertyValue();
- aSortDesc[1].Name = "ContainsHeader";
- aSortDesc[1].Value = new Boolean(true);
-
- // perform the sorting
- XSortable xSort = (XSortable)
- UnoRuntime.queryInterface(XSortable.class, sourceRange);
- xSort.sort(aSortDesc);
-
- //Verify the sorting result
- String[][] expectResult = { { "Level", "Code", "No.",
"Team", "Name" },{ "BS", "20", "4", "B", "Elle" },
- { "BS", "20", "2", "A", "Chcomic" }, {
"CS", "30", "7", "C", "Tom" },{ "CS", "30", "5", "A", "Ally" },{ "MS", "20",
"6", "C", "Sweet" },{ "MS", "10", "3", "B", "Kevin" },{ "MS", "10", "1", "A",
"Joker" }};
- String[][] actureResult =
SCUtil.getTextFromCellRange(currentsheet, 0, 0, 4, 7);
- assertArrayEquals(expectResult,actureResult);
-
- //Save and reload the document verify the sort result again
- SCUtil.saveFileAs(scComponent, "SortThreeFileds",
"ods");
- XSpreadsheetDocument scDocumentTemp =
SCUtil.reloadFile(unoApp,
- scDocument, "SortThreeFileds.ods");
- scDocument = scDocumentTemp;
- currentsheet = SCUtil.getCurrentSheet(scDocument);
- actureResult =
SCUtil.getTextFromCellRange(currentsheet, 0, 0, 4, 7);
- assertArrayEquals(expectResult,actureResult);
+
+ // --- sort by second column, ascending ---
+
+ // define the fields to sort
+ TableSortField[] aSortFields = new TableSortField[3];
+ aSortFields[0] = new TableSortField();
+ aSortFields[0].Field = 0;
+ aSortFields[0].IsAscending = true;
+ aSortFields[0].IsCaseSensitive = false;
+ aSortFields[1] = new TableSortField();
+ aSortFields[1].Field = 1;
+ aSortFields[1].IsAscending = false;
+ aSortFields[1].IsCaseSensitive = false;
+ aSortFields[2] = new TableSortField();
+ aSortFields[2].Field = 2;
+ aSortFields[2].IsAscending = false;
+ aSortFields[2].IsCaseSensitive = false;
+
+ // define the sort descriptor
+ PropertyValue[] aSortDesc = new PropertyValue[2];
+ aSortDesc[0] = new PropertyValue();
+ aSortDesc[0].Name = "SortFields";
+ aSortDesc[0].Value = aSortFields;
+ aSortDesc[1] = new PropertyValue();
+ aSortDesc[1].Name = "ContainsHeader";
+ aSortDesc[1].Value = new Boolean(true);
+
+ // perform the sorting
+ XSortable xSort = (XSortable) UnoRuntime.queryInterface(
+ XSortable.class, sourceRange);
+ xSort.sort(aSortDesc);
+
+ // Verify the sorting result
+ String[][] expectResult = { { "Level", "Code", "No.", "Team",
"Name" },
+ { "BS", "20", "4", "B", "Elle" },
+ { "BS", "20", "2", "A", "Chcomic" },
+ { "CS", "30", "7", "C", "Tom" },
+ { "CS", "30", "5", "A", "Ally" },
+ { "MS", "20", "6", "C", "Sweet" },
+ { "MS", "10", "3", "B", "Kevin" },
+ { "MS", "10", "1", "A", "Joker" } };
+ String[][] actureResult =
SCUtil.getTextFromCellRange(currentsheet, 0,
+ 0, 4, 7);
+ assertArrayEquals(expectResult, actureResult);
+
+ // Save and reload the document verify the sort result again
+ SCUtil.saveFileAs(scComponent, "SortThreeFileds", "ods");
+ XSpreadsheetDocument scDocumentTemp = SCUtil.reloadFile(unoApp,
+ scDocument, "SortThreeFileds.ods");
+ scDocument = scDocumentTemp;
+ currentsheet = SCUtil.getCurrentSheet(scDocument);
+ actureResult = SCUtil.getTextFromCellRange(currentsheet, 0, 0,
4, 7);
+ assertArrayEquals(expectResult, actureResult);
}
-
+
+ /**
+ * test sort options
+ */
@Test
public void sortOption() throws Exception {
scDocument = SCUtil.getSCDocument(scComponent);
@@ -254,74 +280,74 @@ public class DataSort {
XCellRange sourceRange =
currentsheet.getCellRangeByName("A1:A8");
XCellRangeData sourceData = (XCellRangeData)
UnoRuntime.queryInterface(
XCellRangeData.class, sourceRange);
- Object[][] source = {{ "Fri" }, { "Mon"},
- { "Sun" }, { "Wed" },
- { "Thu"}, {"Sat"},
- { "Tue"},{ "SUN"} };
+ Object[][] source = { { "Fri" }, { "Mon" }, { "Sun" }, { "Wed"
},
+ { "Thu" }, { "Sat" }, { "Tue" }, { "SUN" } };
sourceData.setDataArray(source);
-
+
XCell cell = currentsheet.getCellByPosition(1, 0);
- XCellAddressable xCellAddr = (XCellAddressable)
UnoRuntime.queryInterface(XCellAddressable.class, cell);
+ XCellAddressable xCellAddr = (XCellAddressable) UnoRuntime
+ .queryInterface(XCellAddressable.class, cell);
CellAddress copytoAddress = xCellAddr.getCellAddress();
-
- // --- sort by second column, ascending ---
-
- // define the fields to sort Sort by column 1and sort
Ascending and not case sensitive
- TableSortField[] aSortFields = new TableSortField[1];
- aSortFields[0] = new TableSortField();
- aSortFields[0].Field = 0;
- aSortFields[0].IsAscending = true;
- aSortFields[0].IsCaseSensitive = false;
-
- // define the sort descriptor
- //Range not contain label,Including formats,copy result to B1,
and sort with custom sort order
- PropertyValue[] aSortDesc = new PropertyValue[7];
- aSortDesc[0] = new PropertyValue();
- aSortDesc[0].Name = "SortFields";
- aSortDesc[0].Value = aSortFields;
- aSortDesc[1] = new PropertyValue();
- aSortDesc[1].Name = "ContainsHeader";
- aSortDesc[1].Value = new Boolean(false);
- aSortDesc[2] = new PropertyValue();
- aSortDesc[2].Name = "BindFormatsToContent";
- aSortDesc[2].Value = new Boolean(true);
- aSortDesc[3] = new PropertyValue();
- aSortDesc[3].Name = "IsUserListEnabled";
- aSortDesc[3].Value = new Boolean(true);
- aSortDesc[4] = new PropertyValue();
- aSortDesc[4].Name = "UserListIndex";
- aSortDesc[4].Value = 0;
- aSortDesc[5] = new PropertyValue();
- aSortDesc[5].Name = "CopyOutputData";
- aSortDesc[5].Value = new Boolean(true);
- aSortDesc[6] = new PropertyValue();
- aSortDesc[6].Name = "OutputPosition";
- aSortDesc[6].Value = copytoAddress;
-
- // perform the sorting
- XSortable xSort = (XSortable)
- UnoRuntime.queryInterface(XSortable.class, sourceRange);
- xSort.sort(aSortDesc);
-
- //Verify the sorting result
- String[][] expectResult = {{ "Sun" }, { "SUN"},
- { "Mon" }, { "Tue" },
- { "Wed"}, {"Thu"},
- { "Fri"},{ "Sat"} };
- String[][] actureSortResult =
SCUtil.getTextFromCellRange(currentsheet, 1, 0, 1, 7 );
- String[][] sourceAfterSort =
SCUtil.getTextFromCellRange(currentsheet, 0, 0, 0, 7 );
- assertArrayEquals(source,sourceAfterSort);
- assertArrayEquals(expectResult,actureSortResult);
-
- //Save and reload the document verify the sort result again
- SCUtil.saveFileAs(scComponent, "SortOption", "xls");
- XSpreadsheetDocument scDocumentTemp =
SCUtil.reloadFile(unoApp,
- scDocument, "SortOption.xls");
- scDocument = scDocumentTemp;
- currentsheet = SCUtil.getCurrentSheet(scDocument);
- actureSortResult =
SCUtil.getTextFromCellRange(currentsheet, 1, 0, 1, 7);
- sourceAfterSort =
SCUtil.getTextFromCellRange(currentsheet, 0, 0, 0, 7 );
- assertArrayEquals(source,sourceAfterSort);
- assertArrayEquals(expectResult,actureSortResult);
+
+ // define the fields to sort Sort by column 1and sort Ascending
and not
+ // case sensitive
+ TableSortField[] aSortFields = new TableSortField[1];
+ aSortFields[0] = new TableSortField();
+ aSortFields[0].Field = 0;
+ aSortFields[0].IsAscending = true;
+ aSortFields[0].IsCaseSensitive = false;
+
+ // define the sort descriptor
+ // Range not contain label,Including formats,copy result to B1,
and sort
+ // with custom sort order
+ PropertyValue[] aSortDesc = new PropertyValue[7];
+ aSortDesc[0] = new PropertyValue();
+ aSortDesc[0].Name = "SortFields";
+ aSortDesc[0].Value = aSortFields;
+ aSortDesc[1] = new PropertyValue();
+ aSortDesc[1].Name = "ContainsHeader";
+ aSortDesc[1].Value = new Boolean(false);
+ aSortDesc[2] = new PropertyValue();
+ aSortDesc[2].Name = "BindFormatsToContent";
+ aSortDesc[2].Value = new Boolean(true);
+ aSortDesc[3] = new PropertyValue();
+ aSortDesc[3].Name = "IsUserListEnabled";
+ aSortDesc[3].Value = new Boolean(true);
+ aSortDesc[4] = new PropertyValue();
+ aSortDesc[4].Name = "UserListIndex";
+ aSortDesc[4].Value = 0;
+ aSortDesc[5] = new PropertyValue();
+ aSortDesc[5].Name = "CopyOutputData";
+ aSortDesc[5].Value = new Boolean(true);
+ aSortDesc[6] = new PropertyValue();
+ aSortDesc[6].Name = "OutputPosition";
+ aSortDesc[6].Value = copytoAddress;
+
+ // perform the sorting
+ XSortable xSort = (XSortable) UnoRuntime.queryInterface(
+ XSortable.class, sourceRange);
+ xSort.sort(aSortDesc);
+
+ // Verify the sorting result
+ String[][] expectResult = { { "Sun" }, { "SUN" }, { "Mon" }, {
"Tue" },
+ { "Wed" }, { "Thu" }, { "Fri" }, { "Sat" } };
+ String[][] actureSortResult =
SCUtil.getTextFromCellRange(currentsheet,
+ 1, 0, 1, 7);
+ String[][] sourceAfterSort =
SCUtil.getTextFromCellRange(currentsheet,
+ 0, 0, 0, 7);
+ assertArrayEquals(source, sourceAfterSort);
+ assertArrayEquals(expectResult, actureSortResult);
+
+ // Save and reload the document verify the sort result again
+ SCUtil.saveFileAs(scComponent, "SortOption", "xls");
+ XSpreadsheetDocument scDocumentTemp = SCUtil.reloadFile(unoApp,
+ scDocument, "SortOption.xls");
+ scDocument = scDocumentTemp;
+ currentsheet = SCUtil.getCurrentSheet(scDocument);
+ actureSortResult = SCUtil
+ .getTextFromCellRange(currentsheet, 1, 0, 1, 7);
+ sourceAfterSort = SCUtil.getTextFromCellRange(currentsheet, 0,
0, 0, 7);
+ assertArrayEquals(source, sourceAfterSort);
+ assertArrayEquals(expectResult, actureSortResult);
}
}
Modified:
openoffice/trunk/test/testuno/source/fvt/uno/sc/data/StandardFilterOption.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/test/testuno/source/fvt/uno/sc/data/StandardFilterOption.java?rev=1416776&r1=1416775&r2=1416776&view=diff
==============================================================================
---
openoffice/trunk/test/testuno/source/fvt/uno/sc/data/StandardFilterOption.java
(original)
+++
openoffice/trunk/test/testuno/source/fvt/uno/sc/data/StandardFilterOption.java
Tue Dec 4 05:02:19 2012
@@ -26,13 +26,10 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.openoffice.test.common.Testspace;
import org.openoffice.test.uno.UnoApp;
-
import testlib.uno.SCUtil;
-
import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.XComponent;
import com.sun.star.sheet.FilterOperator;
@@ -43,18 +40,14 @@ import com.sun.star.sheet.XSheetFilterab
import com.sun.star.sheet.XSpreadsheet;
import com.sun.star.sheet.XSpreadsheetDocument;
import com.sun.star.table.CellAddress;
-import com.sun.star.table.CellRangeAddress;
-import com.sun.star.table.TableOrientation;
import com.sun.star.table.XCell;
import com.sun.star.table.XCellRange;
import com.sun.star.table.XColumnRowRange;
import com.sun.star.table.XTableRows;
-import com.sun.star.text.XTextDocument;
import com.sun.star.uno.UnoRuntime;
-public class StandardFilterOption {
- private static final UnoApp app = new UnoApp();
+public class StandardFilterOption {
UnoApp unoApp = new UnoApp();
XSpreadsheetDocument scDocument = null;
XComponent scComponent = null;
@@ -82,6 +75,9 @@ public class StandardFilterOption {
}
+ /**
+ * test standard filter with string
+ */
@Test
public void testStandardFilterForString() throws Exception {
// Prepare test data
@@ -122,7 +118,7 @@ public class StandardFilterOption {
SCUtil.closeFile(scDocument);
scDocument = SCUtil.openFile(sample, unoApp);
- // Verify the result agains
+ // Verify the result again
xdataRange = (XCellRange)
UnoRuntime.queryInterface(XCellRange.class, SCUtil.getCurrentSheet(scDocument));
ColRowRange = (XColumnRowRange)
UnoRuntime.queryInterface(XColumnRowRange.class,
xdataRange.getCellRangeByName("A1:E6"));
Rows = ColRowRange.getRows();
@@ -137,6 +133,9 @@ public class StandardFilterOption {
}
+ /**
+ * test standard filter with case sensitive options
+ */
@Test
public void testStandardFilterOptionCaseSensitive() throws Exception {
// Prepare test data
@@ -206,6 +205,9 @@ public class StandardFilterOption {
}
}
+ /**
+ * test standard filter with contain header options
+ */
@Test
public void testStandardFilterOptionContainsHeader() throws Exception {
// Prepare test data
@@ -275,8 +277,10 @@ public class StandardFilterOption {
}
+ /**
+ * test standard filter with copy out put after filter in options
+ */
@Test
- @Ignore("Bug #121017")
public void testStandardFilterOptionCopyOutput() throws Exception {
// Prepare test data
String sample = Testspace.prepareData(filename);
@@ -288,7 +292,7 @@ public class StandardFilterOption {
// Get the value before filter
String[][] souce = SCUtil.getTextFromCellRange(currentSheet, 0,
0, 5, 5);
- // Copy to cell postion
+ // Copy to cell position
XCell cell = currentSheet.getCellByPosition(7, 7);
XCellAddressable xCellAddr = (XCellAddressable)
UnoRuntime.queryInterface(XCellAddressable.class, cell);
CellAddress copytoAddress = xCellAddr.getCellAddress();
@@ -375,6 +379,9 @@ public class StandardFilterOption {
assertArrayEquals(SCUtil.getTextFromCellRange(currentSheet, 0,
4, 5, 4), SCUtil.getTextFromCellRange(currentSheet, 7, 9, 12, 9));
}
+ /**
+ * test standard filter with skip duplicates in options
+ */
@Test
public void testStandardFilterOptionSkipDuplicates() throws Exception {
// Prepare test data
@@ -447,6 +454,9 @@ public class StandardFilterOption {
}
+ /**
+ * test standard filter with regular expressions in options
+ */
@Test
public void testStandardFilterOptionUseRegularExpressions() throws
Exception {
// Prepare test data
Modified:
openoffice/trunk/test/testuno/source/fvt/uno/sc/data/StardarFilterTest.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/test/testuno/source/fvt/uno/sc/data/StardarFilterTest.java?rev=1416776&r1=1416775&r2=1416776&view=diff
==============================================================================
--- openoffice/trunk/test/testuno/source/fvt/uno/sc/data/StardarFilterTest.java
(original)
+++ openoffice/trunk/test/testuno/source/fvt/uno/sc/data/StardarFilterTest.java
Tue Dec 4 05:02:19 2012
@@ -24,7 +24,6 @@ import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.Collection;
-
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -35,9 +34,7 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.openoffice.test.common.Testspace;
import org.openoffice.test.uno.UnoApp;
-
import testlib.uno.SCUtil;
-
import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.XComponent;
import com.sun.star.sheet.FilterOperator;
@@ -53,7 +50,6 @@ import com.sun.star.uno.UnoRuntime;
@RunWith(value = Parameterized.class)
public class StardarFilterTest {
- private static final UnoApp app = new UnoApp();
UnoApp unoApp = new UnoApp();
XSpreadsheetDocument scDocument = null;
XComponent scComponent = null;
@@ -114,6 +110,9 @@ public class StardarFilterTest {
this.value = value;
}
+ /**
+ * test standard filter with very criteria
+ */
@Test
public void testStandardFilter() throws Exception {
String sample = Testspace.prepareData(filename);
Modified:
openoffice/trunk/test/testuno/source/fvt/uno/sc/data/ValidityTypeTest.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/test/testuno/source/fvt/uno/sc/data/ValidityTypeTest.java?rev=1416776&r1=1416775&r2=1416776&view=diff
==============================================================================
--- openoffice/trunk/test/testuno/source/fvt/uno/sc/data/ValidityTypeTest.java
(original)
+++ openoffice/trunk/test/testuno/source/fvt/uno/sc/data/ValidityTypeTest.java
Tue Dec 4 05:02:19 2012
@@ -24,7 +24,6 @@ import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.Collection;
-
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -34,14 +33,10 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.openoffice.test.uno.UnoApp;
-
import testlib.uno.SCUtil;
-import testlib.uno.TestUtil;
-
import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.XComponent;
import com.sun.star.sheet.ConditionOperator;
-import com.sun.star.sheet.GeneralFunction;
import com.sun.star.sheet.ValidationAlertStyle;
import com.sun.star.sheet.ValidationType;
import com.sun.star.sheet.XSheetCondition;
@@ -53,8 +48,6 @@ import com.sun.star.uno.UnoRuntime;
@RunWith(value = Parameterized.class)
public class ValidityTypeTest {
- private static final UnoApp app = new UnoApp();
-
UnoApp unoApp = new UnoApp();
XSpreadsheetDocument scDocument = null;
XComponent scComponent = null;
@@ -84,7 +77,7 @@ public class ValidityTypeTest {
{ ValidationType.ANY, false,
ValidationAlertStyle.STOP,
false, false,
ConditionOperator.EQUAL, "0",
"5", "xls" },
- //Custom type
is not exist in GUI so remove this
+ //Custom type is not exist in
GUI so remove this
// { ValidationType.CUSTOM,
true,
// ValidationAlertStyle.INFO,
false, true,
// ConditionOperator.EQUAL,
"0", "5", "ods"},
@@ -159,7 +152,10 @@ public class ValidityTypeTest {
this.formula2 = formula2;
this.extName = extName;
}
-
+
+ /**
+ * test filter with every type
+ */
@Test
public void test() throws Exception {
// New a SC document
Modified:
openoffice/trunk/test/testuno/source/fvt/uno/sc/sheet/SheetBasicTest.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/test/testuno/source/fvt/uno/sc/sheet/SheetBasicTest.java?rev=1416776&r1=1416775&r2=1416776&view=diff
==============================================================================
--- openoffice/trunk/test/testuno/source/fvt/uno/sc/sheet/SheetBasicTest.java
(original)
+++ openoffice/trunk/test/testuno/source/fvt/uno/sc/sheet/SheetBasicTest.java
Tue Dec 4 05:02:19 2012
@@ -25,40 +25,26 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.openoffice.test.common.FileUtil;
import org.openoffice.test.common.Testspace;
import org.openoffice.test.uno.UnoApp;
import testlib.uno.SCUtil;
-import com.sun.star.beans.Property;
-import com.sun.star.beans.PropertyAttribute;
-import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
-import com.sun.star.beans.XPropertySetInfo;
-import com.sun.star.container.XEnumerationAccess;
import com.sun.star.container.XIndexAccess;
-import com.sun.star.container.XNamed;
-import com.sun.star.frame.XModel;
-import com.sun.star.frame.XStorable;
-import com.sun.star.io.IOException;
-import com.sun.star.lang.IndexOutOfBoundsException;
-import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.XComponent;
import com.sun.star.sheet.SheetLinkMode;
-import com.sun.star.sheet.XCalculatable;
-import com.sun.star.sheet.XExternalDocLink;
-import com.sun.star.sheet.XExternalDocLinks;
import com.sun.star.sheet.XSheetLinkable;
import com.sun.star.sheet.XSpreadsheet;
import com.sun.star.sheet.XSpreadsheetDocument;
-import com.sun.star.sheet.XSpreadsheetView;
import com.sun.star.sheet.XSpreadsheets;
-import com.sun.star.table.XCell;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.util.XRefreshable;
+/**
+ * Basic sheet operator testing
+ *
+ */
public class SheetBasicTest {
UnoApp unoApp = new UnoApp();
-
XSpreadsheetDocument scDocument = null;
XComponent scComponent = null;
@@ -84,6 +70,9 @@ public class SheetBasicTest {
unoApp.close();
}
+ /**
+ * test insert a sheet, rename sheet name and delete sheet
+ */
@Test
public void insertRenameDeleteSheet() throws Exception {
// Insert a sheet named aa after first sheet
@@ -125,6 +114,9 @@ public class SheetBasicTest {
SCUtil.save(scDocumentTemp);
}
+ /**
+ * Test copy and past sheet
+ */
@Test
public void copypastesheet() throws Exception {
// Insert some value into cells
@@ -137,7 +129,7 @@ public class SheetBasicTest {
XSpreadsheet sourceSpreadSheet =
SCUtil.getSCSheetByName(scDocument,
souceSheetName);
// input strings into sheet1
- SCUtil.setTextToCellRange(sourceSpreadSheet, 0, 0, 5, 2,
stringValues);
+ SCUtil.setTextToCellRange(sourceSpreadSheet, 0, 0,
stringValues);
// copy the sheet from sourcesheet to copysheet
String newcopysheet = "copysheet";
XSpreadsheets spreadsheets = scDocument.getSheets();
@@ -158,6 +150,9 @@ public class SheetBasicTest {
}
+ /**
+ * Test move sheet
+ */
@Test
public void movesheet() throws Exception {
@@ -173,7 +168,7 @@ public class SheetBasicTest {
{ "Rival in business", "12.2", "12.6", "17.7",
"20.4", "100" }, };
XSpreadsheet movesheet = SCUtil
.getSCSheetByIndex(scDocument, (short) 0);
- SCUtil.setTextToCellRange(movesheet, 0, 0, 5, 2, stringValues);
+ SCUtil.setTextToCellRange(movesheet, 0, 0,stringValues);
// Before move, get the 2nd sheet name
String secondSheetNameBeforeMove = SCUtil.getSCSheetNameByIndex(
@@ -209,9 +204,11 @@ public class SheetBasicTest {
assertArrayEquals("Expect result should be stringValues",
stringValues,
stringValuesaftermove);
-
}
+ /**
+ * Test hide and show sheet
+ */
@Test
public void hideShowSheet() throws Exception {
// Insert a sheet named hide sheet after first sheet
@@ -264,6 +261,9 @@ public class SheetBasicTest {
SCUtil.save(scDocument);
}
+ /**
+ * Test sheet tab color
+ */
@Test
public void sheetColor() throws Exception {
// get first sheet propertyset
@@ -274,7 +274,7 @@ public class SheetBasicTest {
XPropertySet sheet1PropertySet = (XPropertySet) UnoRuntime
.queryInterface(XPropertySet.class,
firstSpreadSheet);
- // Set tabcolor to 111
+ // Set sheet tab color to 111
sheet1PropertySet.setPropertyValue("TabColor", 111);
// copy the color sheet to new sheet
@@ -310,6 +310,9 @@ public class SheetBasicTest {
copySheetcolorid);
}
+ /**
+ * test insert sheet from other file
+ */
@Test
public void insertSheetFromfile() throws Exception {
// New a document source.xls, add value to 3 sheet