You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ja...@apache.org on 2013/02/03 14:24:38 UTC
svn commit: r1441909 [45/45] - in /openoffice/branches/l10n: ./
ext_libraries/apr-util/ ext_libraries/apr/ ext_libraries/hunspell/
ext_sources/ extras/l10n/source/ast/ extras/l10n/source/da/
extras/l10n/source/eu/ extras/l10n/source/gd/ extras/l10n/sou...
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/cell/Cells.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/cell/Cells.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/cell/Cells.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/cell/Cells.java Sun Feb 3 13:23:59 2013
@@ -27,7 +27,9 @@ import static testlib.gui.UIMap.*;
import org.junit.After;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.openoffice.test.common.Logger;
import testlib.gui.AppTool;
import testlib.gui.SCTool;
@@ -36,7 +38,9 @@ import testlib.gui.SCTool;
public class Cells {
-
+ @Rule
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
app.start();
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/chart/ChartDialogSetting.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/chart/ChartDialogSetting.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/chart/ChartDialogSetting.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/chart/ChartDialogSetting.java Sun Feb 3 13:23:59 2013
@@ -39,6 +39,8 @@ import testlib.gui.AppTool;
* Test the setting about chart dialog in spreadsheet
*/
public class ChartDialogSetting {
+ @Rule
+ public Logger log = Logger.getLogger(this);
@Before
public void setUp() throws Exception {
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/filter/Fitler.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/filter/Fitler.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/filter/Fitler.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/filter/Fitler.java Sun Feb 3 13:23:59 2013
@@ -42,6 +42,8 @@ import testlib.gui.SCTool;
* Test cases about Data->Filter in spreadsheet
*/
public class Fitler {
+ @Rule
+ public Logger log = Logger.getLogger(this);
@Before
public void setUp() throws Exception {
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/rowcolumn/InsertRowAndColumn.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/rowcolumn/InsertRowAndColumn.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/rowcolumn/InsertRowAndColumn.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/rowcolumn/InsertRowAndColumn.java Sun Feb 3 13:23:59 2013
@@ -34,6 +34,8 @@ import testlib.gui.AppTool;
import testlib.gui.SCTool;
public class InsertRowAndColumn {
+ @Rule
+ public Logger log = Logger.getLogger(this);
@Before
public void setUp() throws Exception {
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/sheet/Sheets.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/sheet/Sheets.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/sheet/Sheets.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/sheet/Sheets.java Sun Feb 3 13:23:59 2013
@@ -39,6 +39,9 @@ import testlib.gui.AppTool;
*/
public class Sheets {
+
+ @Rule
+ public Logger log = Logger.getLogger(this);
@Before
public void setUp() throws Exception {
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/sort/SortDialogSetting.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/sort/SortDialogSetting.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/sort/SortDialogSetting.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/sort/SortDialogSetting.java Sun Feb 3 13:23:59 2013
@@ -46,6 +46,9 @@ import testlib.gui.SCTool;
*/
public class SortDialogSetting {
+ @Rule
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
app.start(true);
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/subtotals/SubtotalsFunctions.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/subtotals/SubtotalsFunctions.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/subtotals/SubtotalsFunctions.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/subtotals/SubtotalsFunctions.java Sun Feb 3 13:23:59 2013
@@ -39,6 +39,9 @@ import testlib.gui.SCTool;
public class SubtotalsFunctions {
+ @Rule
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
app.start(true);
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValidityDateSupport1024Columns.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValidityDateSupport1024Columns.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValidityDateSupport1024Columns.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValidityDateSupport1024Columns.java Sun Feb 3 13:23:59 2013
@@ -36,7 +36,9 @@ import testlib.gui.SCTool;
public class ValidityDateSupport1024Columns {
-
+ @Rule
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
app.start(true);
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValidityDialogDefaultValue.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValidityDialogDefaultValue.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValidityDialogDefaultValue.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValidityDialogDefaultValue.java Sun Feb 3 13:23:59 2013
@@ -34,6 +34,9 @@ import testlib.gui.AppTool;
public class ValidityDialogDefaultValue {
+ @Rule
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
app.start(true);
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValidityDialogSetting.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValidityDialogSetting.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValidityDialogSetting.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValidityDialogSetting.java Sun Feb 3 13:23:59 2013
@@ -37,6 +37,9 @@ import testlib.gui.SCTool;
public class ValidityDialogSetting {
+ @Rule
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
app.start(true);
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValiditySampleFile.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValiditySampleFile.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValiditySampleFile.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sc/validity/ValiditySampleFile.java Sun Feb 3 13:23:59 2013
@@ -36,6 +36,9 @@ import testlib.gui.SCTool;
public class ValiditySampleFile {
+ @Rule
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
app.start(true);
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/headerandfooter/DocumentWithHeaderFooter.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/headerandfooter/DocumentWithHeaderFooter.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/headerandfooter/DocumentWithHeaderFooter.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/headerandfooter/DocumentWithHeaderFooter.java Sun Feb 3 13:23:59 2013
@@ -32,10 +32,15 @@ import static testlib.gui.UIMap.*;
import org.junit.After;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Logger;
public class DocumentWithHeaderFooter {
+ @Rule
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/headerandfooter/HeaderAndFooterSetting.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/headerandfooter/HeaderAndFooterSetting.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/headerandfooter/HeaderAndFooterSetting.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/headerandfooter/HeaderAndFooterSetting.java Sun Feb 3 13:23:59 2013
@@ -32,14 +32,19 @@ import static testlib.gui.UIMap.*;
import org.junit.After;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Logger;
import testlib.gui.AppTool;
import testlib.gui.SDTool;
public class HeaderAndFooterSetting {
+ @Rule
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
app.start(true);
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/shape/ShapeTypes.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/shape/ShapeTypes.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/shape/ShapeTypes.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/shape/ShapeTypes.java Sun Feb 3 13:23:59 2013
@@ -40,6 +40,9 @@ import testlib.gui.AppTool;
public class ShapeTypes {
+ @Rule
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
app.start();
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/table/TableBackgroundProperty.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/table/TableBackgroundProperty.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/table/TableBackgroundProperty.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/table/TableBackgroundProperty.java Sun Feb 3 13:23:59 2013
@@ -33,6 +33,8 @@ import org.openoffice.test.common.Logger
import testlib.gui.AppTool;
public class TableBackgroundProperty {
+ @Rule
+ public Logger log = Logger.getLogger(this);
@Before
public void setUp() throws Exception {
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/table/TableBorderProperty.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/table/TableBorderProperty.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/table/TableBorderProperty.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/table/TableBorderProperty.java Sun Feb 3 13:23:59 2013
@@ -34,6 +34,8 @@ import org.openoffice.test.common.Logger
import testlib.gui.AppTool;
public class TableBorderProperty {
+ @Rule
+ public Logger log = Logger.getLogger(this);
@Before
public void setUp() throws Exception {
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/table/TableFontEffectsProperty.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/table/TableFontEffectsProperty.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/table/TableFontEffectsProperty.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sd/table/TableFontEffectsProperty.java Sun Feb 3 13:23:59 2013
@@ -33,6 +33,9 @@ import org.openoffice.test.common.Logger
import testlib.gui.AppTool;
public class TableFontEffectsProperty {
+
+ @Rule
+ public Logger log = Logger.getLogger(this);
@Before
public void setUp() throws Exception {
Modified: openoffice/branches/l10n/test/testgui/source/fvt/gui/sw/table/TableGeneral.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testgui/source/fvt/gui/sw/table/TableGeneral.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testgui/source/fvt/gui/sw/table/TableGeneral.java (original)
+++ openoffice/branches/l10n/test/testgui/source/fvt/gui/sw/table/TableGeneral.java Sun Feb 3 13:23:59 2013
@@ -29,12 +29,17 @@ import static testlib.gui.UIMap.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
+import org.junit.Rule;
import org.junit.Test;
+import org.openoffice.test.common.Logger;
import org.openoffice.test.common.SystemUtil;
import testlib.gui.AppTool;
public class TableGeneral {
+
+ @Rule
+ public Logger log = Logger.getLogger(this);
@Before
public void setUp() throws Exception {
Modified: openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/DataSort.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/DataSort.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/DataSort.java (original)
+++ openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/DataSort.java Sun Feb 3 13:23:59 2013
@@ -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/branches/l10n/test/testuno/source/fvt/uno/sc/data/StandardFilterOption.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/StandardFilterOption.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/StandardFilterOption.java (original)
+++ openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/StandardFilterOption.java Sun Feb 3 13:23:59 2013
@@ -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/branches/l10n/test/testuno/source/fvt/uno/sc/data/StardarFilterTest.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/StardarFilterTest.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/StardarFilterTest.java (original)
+++ openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/StardarFilterTest.java Sun Feb 3 13:23:59 2013
@@ -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/branches/l10n/test/testuno/source/fvt/uno/sc/data/ValidityTypeTest.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/ValidityTypeTest.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/ValidityTypeTest.java (original)
+++ openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/data/ValidityTypeTest.java Sun Feb 3 13:23:59 2013
@@ -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/branches/l10n/test/testuno/source/fvt/uno/sc/sheet/SheetBasicTest.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/sheet/SheetBasicTest.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/sheet/SheetBasicTest.java (original)
+++ openoffice/branches/l10n/test/testuno/source/fvt/uno/sc/sheet/SheetBasicTest.java Sun Feb 3 13:23:59 2013
@@ -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
Modified: openoffice/branches/l10n/test/testuno/source/fvt/uno/sd/animation/TextAnimation.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testuno/source/fvt/uno/sd/animation/TextAnimation.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testuno/source/fvt/uno/sd/animation/TextAnimation.java (original)
+++ openoffice/branches/l10n/test/testuno/source/fvt/uno/sd/animation/TextAnimation.java Sun Feb 3 13:23:59 2013
@@ -197,7 +197,7 @@ public class TextAnimation {
XStorable.class, presentationDocument);
xStorable.storeToURL(FileUtil.getUrl(filePath), aStoreProperties);
- return UnoRuntime.queryInterface(XComponent.class,
+ return (XComponent)UnoRuntime.queryInterface(XComponent.class,
unoApp.loadDocument(filePath));
}
}
Modified: openoffice/branches/l10n/test/testuno/source/fvt/uno/sw/DocumentTest.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testuno/source/fvt/uno/sw/DocumentTest.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testuno/source/fvt/uno/sw/DocumentTest.java (original)
+++ openoffice/branches/l10n/test/testuno/source/fvt/uno/sw/DocumentTest.java Sun Feb 3 13:23:59 2013
@@ -32,6 +32,8 @@ import org.junit.Assert;
import org.openoffice.test.common.FileUtil;
import org.openoffice.test.uno.UnoApp;
+import testlib.uno.SWUtil;
+
import com.sun.star.text.XTextDocument;
import com.sun.star.text.XTextCursor;
import com.sun.star.text.XText;
@@ -39,10 +41,7 @@ import com.sun.star.beans.XPropertySet;
import com.sun.star.beans.PropertyValue;
import com.sun.star.frame.*;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.XCloseable;
import com.sun.star.lang.XComponent;
-import com.sun.star.container.XEnumerationAccess;
-import com.sun.star.container.XEnumeration;
public class DocumentTest {
@@ -51,10 +50,7 @@ public class DocumentTest {
File temp = null;
String workingFilePath = "";
String workingTemplatePath = "";
-
- /**
- * @throws java.lang.Exception
- */
+
@Before
public void setUp() throws Exception {
unoApp.start();
@@ -72,71 +68,39 @@ public class DocumentTest {
public void tearDown() throws Exception {
unoApp.close();
}
-
- private XComponent newDocumentFromTemplate(String templatePath) throws Exception
- {
- XComponentLoader componentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, unoApp.getDesktop());
- PropertyValue[] pros = new PropertyValue[1];
- pros[0] = new PropertyValue();
- pros[0].Name = "AsTemplate";
- pros[0].Value = new Boolean(true);
-
- XComponent component = componentLoader.loadComponentFromURL(FileUtil.getUrl(workingTemplatePath), "_blank", 0,pros);
- return component;
- }
-
-
/**
- * test close document
+ * test new document and close document
* @throws Exception
*/
@Test
- public void testCloseDocument() throws Exception
+ public void testNewAndCloseDocument() throws Exception
{
XComponent component = unoApp.newDocument("swriter");
- unoApp.closeDocument(component);
- XModel xModel = unoApp.getDesktop().getCurrentFrame().getController().getModel();
- Assert.assertTrue("Document has been closed.",xModel==null);
- }
-
- /**
- * test new document
- * @throws Exception
- */
- @Test
- public void testNewDocument() throws Exception
- {
- XComponentLoader componentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, unoApp.getDesktop());
- XComponent component = componentLoader.loadComponentFromURL("private:factory/" + "swriter", "_blank", 0, new PropertyValue[0]);
textDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, component);
XTitle xTitle = (XTitle)UnoRuntime.queryInterface(XTitle.class, textDocument);
String title = xTitle.getTitle();
Assert.assertEquals("New Document title start with \"Untitled\"",true, title.startsWith("Untitled"));
- unoApp.closeDocument(textDocument);
- }
-
+ unoApp.closeDocument(component);
+ XModel xModel = unoApp.getDesktop().getCurrentFrame().getController().getModel();
+ Assert.assertTrue("Document has been closed.",xModel==null);
+ }
/**
* test new document from template
* @throws Exception
*/
@Test
public void testNewDocumentFromTemplate() throws Exception
- {
- XComponent component = this.newDocumentFromTemplate(workingTemplatePath);
+ {
+ XComponent component = SWUtil.newDocumentFromTemplate(workingTemplatePath,unoApp);
textDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, component);
- XText xText = textDocument.getText();
XTitle xTitle = (XTitle)UnoRuntime.queryInterface(XTitle.class, textDocument);
- xText = textDocument.getText();
+ XText xText = textDocument.getText();
XTextCursor xTextCursor = xText.createTextCursor();
xTextCursor.gotoEnd(true);
XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
- String paraStyle = (String)xPropertySet.getPropertyValue("ParaStyleName");
-
- Assert.assertEquals("new document from template, heading style in template is remained. ", "Heading 1", paraStyle);
-
+ String paraStyle = (String)xPropertySet.getPropertyValue("ParaStyleName");
+ Assert.assertEquals("new document from template, heading style in template is remained. ", "Heading 1", paraStyle);
Assert.assertEquals("new document from template, title start with \"Untitled\".", true, xTitle.getTitle().startsWith("Untitled"));
-
- unoApp.closeDocument(textDocument);
}
/**
@@ -151,23 +115,17 @@ public class DocumentTest {
XText xText = textDocument.getText();
XTextCursor xTextCursor = xText.createTextCursor();
xTextCursor.gotoEnd(true);
- XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
-
- xPropertySet.setPropertyValue("ParaStyleName", "Heading 1");
-
- XStorable xStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, component);
- xStorable.store();
- unoApp.closeDocument(textDocument);
-
+ XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ xPropertySet.setPropertyValue("ParaStyleName", "Heading 1");
+ SWUtil.save(textDocument);
+ unoApp.closeDocument(textDocument);
component = unoApp.loadDocument(workingFilePath);
textDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, component);
xText = textDocument.getText();
xTextCursor = xText.createTextCursor();
xTextCursor.gotoEnd(true);
- xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
-
+ xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
Assert.assertEquals("Modify plain text to heading 1 style. ", "Heading 1", (String)xPropertySet.getPropertyValue("ParaStyleName"));
- unoApp.closeDocument(textDocument);
}
/**
@@ -186,21 +144,8 @@ public class DocumentTest {
xPropertySet.setPropertyValue("ParaStyleName", "Heading 1");
xText.insertString(xTextCursor, "test Save odt as doc.", false);
-
- XStorable xStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, component);
- PropertyValue[] storeProps = new PropertyValue[2];
-
- storeProps[0] = new PropertyValue();
- storeProps[0].Name = "Overwrite";
- storeProps[0].Value = new Boolean(true);
-
- storeProps[1] = new PropertyValue();
- storeProps[1].Name = "FilterName";
- storeProps[1].Value = "MS Word 97";
-
- xStorable.storeAsURL(FileUtil.getUrl(saveAsFile), storeProps);
+ SWUtil.saveAsDoc(textDocument, FileUtil.getUrl(saveAsFile));
Assert.assertTrue("Save odt document as doc the file exist: " + saveAsFile.getAbsolutePath(), saveAsFile.exists());
- unoApp.closeDocument(textDocument);
}
/**
@@ -232,8 +177,6 @@ public class DocumentTest {
xStorable.storeToURL(FileUtil.getUrl(saveAsFile), storeProps);
Assert.assertTrue("Export document as PDF.", saveAsFile.exists());
-
- unoApp.closeDocument(textDocument);
}
/**
@@ -270,19 +213,8 @@ public class DocumentTest {
storeProps[2].Value=new Boolean(true);
xStorable.storeToURL(FileUtil.getUrl(saveAsFile), storeProps);
- unoApp.closeDocument(textDocument);
-
- component = this.newDocumentFromTemplate(saveAsFile.getAbsolutePath());
- textDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, component);
- XTitle xTitle = (XTitle)UnoRuntime.queryInterface(XTitle.class, textDocument);
- xText = textDocument.getText();
- xTextCursor = xText.createTextCursor();
- xTextCursor.gotoEnd(true);
- xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
- String paraStyle = (String)xPropertySet.getPropertyValue("ParaStyleName");
- Assert.assertEquals("Save document as template, heading style is remained. ", "Heading 1", paraStyle);
- Assert.assertEquals("Save document as template, title start with \"Untitled\".", true, xTitle.getTitle().startsWith("Untitled"));
- unoApp.closeDocument(textDocument);
+ unoApp.closeDocument(textDocument);
+ Assert.assertTrue("Export document as ott.", saveAsFile.exists());
}
}
Modified: openoffice/branches/l10n/test/testuno/source/fvt/uno/sw/bookmark/CheckBookmarks.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testuno/source/fvt/uno/sw/bookmark/CheckBookmarks.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testuno/source/fvt/uno/sw/bookmark/CheckBookmarks.java (original)
+++ openoffice/branches/l10n/test/testuno/source/fvt/uno/sw/bookmark/CheckBookmarks.java Sun Feb 3 13:23:59 2013
@@ -57,7 +57,9 @@ public class CheckBookmarks {
XText xText = document.getText();
XTextCursor xTextCursor = xText.createTextCursor();
xTextCursor.setString("Contents");
-
+ /**
+ * insert bookmark into document
+ */
for (int i = 0; i < initBookmarkNames.length; i++) {
xTextCursor.gotoEnd(false);
XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xTextCursor);
@@ -77,7 +79,12 @@ public class CheckBookmarks {
public static void tearDownConnection() throws Exception {
app.close();
}
-
+ /**
+ * get bookmark content
+ * @param xBookmarks
+ * @return
+ * @throws Exception
+ */
private static String[] getBookmarkContents(XNameAccess xBookmarks) throws Exception {
String[] bookmarkNames = xBookmarks.getElementNames();
String[] bookmarkContents = new String[bookmarkNames.length];
@@ -89,14 +96,20 @@ public class CheckBookmarks {
return bookmarkContents;
}
-
+ /**
+ * verify inserted bookmark by compare their name and content
+ * @throws Exception
+ */
@Test
public void createBookmark() throws Exception {
XNameAccess xBookmarks = ((XBookmarksSupplier)UnoRuntime.queryInterface(XBookmarksSupplier.class, document)).getBookmarks();
assertArrayEquals("Bookmark name list:", initBookmarkNames, xBookmarks.getElementNames());
assertArrayEquals("Bookmark content list:", initBookmarkContents, getBookmarkContents(xBookmarks));
}
-
+ /**
+ * verify bookmark modify
+ * @throws Exception
+ */
@Test
public void updateBookmarkContent() throws Exception {
String[] expectedBookmarkNames= new String[]{"bookmark1", "bookmark2", "bookmark3"};
@@ -113,7 +126,10 @@ public class CheckBookmarks {
assertArrayEquals("Bookmark name list after updating some content:", expectedBookmarkNames, xBookmarks.getElementNames());
assertArrayEquals("Bookmark content list after updating some content:", expectedBookmarkContents, getBookmarkContents(xBookmarks));
}
-
+ /**
+ * verify bookmark remove
+ * @throws Exception
+ */
@Test
public void removeBookmark() throws Exception {
String[] expectedBookmarkNames= new String[]{"bookmark2", "bookmark3"};
Modified: openoffice/branches/l10n/test/testuno/source/pvt/uno/Conversion.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testuno/source/pvt/uno/Conversion.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testuno/source/pvt/uno/Conversion.java (original)
+++ openoffice/branches/l10n/test/testuno/source/pvt/uno/Conversion.java Sun Feb 3 13:23:59 2013
@@ -77,7 +77,7 @@ public class Conversion {
public static int nLevelInfo = Integer.parseInt(System.getProperty("conversion.limitationcheck", "0")); // Level info: starts from 1, 0 means no need for limitation check
- public static long nSleep = Long.parseLong(System.getProperty("conversion.sleep", "0")); // Sleep before loadComponentFromURL and storeToURL
+ public static long nSleep = Long.parseLong(System.getProperty("conversion.sleep", "0")); // Sleep before loadComponentFromURL and storeToURL, millisecond
private static OpenOffice aoo = new OpenOffice();
@@ -90,7 +90,7 @@ public class Conversion {
@BeforeClass
public static void beforeClass() throws Exception {
aoo.setUnoUrl(OpenOffice.DEFAULT_UNO_URL);
- aoo.addArgs("-invisible", "-conversionmode", "-hidemenu", "-nofirststartwizard", "-headless");
+ aoo.addArgs("-invisible", "-conversionmode", "-hidemenu", "-nofirststartwizard", "-headless", "-enableautomation");
app = new UnoApp(aoo);
Testspace.prepareDataFile("limit_cfg.ini", aoo.getHome().toString()+"/program"); // Move limitation check file to installation dir
result = new DataSheet(getFile("output/" + Conversion.class.getName()+ ".xml"));
@@ -159,7 +159,7 @@ public class Conversion {
}
- @Test(timeout=5 * 60000)
+ @Test(timeout=10 * 60000)
public void testConversion() throws Exception {
try {
if (nSleep > 0)
@@ -185,12 +185,18 @@ public class Conversion {
closeTime = System.currentTimeMillis() - start - nSleep;
} catch (com.sun.star.task.ErrorCodeIOException e){
int errCode = e.ErrCode;
- if( 296 == errCode ) {
+ if( 296 == errCode ) { // limitation check file
loadTime = -2;
saveTime = -2;
closeTime = -2;
}
+ if( 3878 == errCode ) { // file is corrupt
+ loadTime = -3;
+ saveTime = -3;
+ closeTime = -3;
+ }
+
throw e;
}
}
Modified: openoffice/branches/l10n/test/testuno/source/testlib/uno/SWUtil.java
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/test/testuno/source/testlib/uno/SWUtil.java?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/test/testuno/source/testlib/uno/SWUtil.java (original)
+++ openoffice/branches/l10n/test/testuno/source/testlib/uno/SWUtil.java Sun Feb 3 13:23:59 2013
@@ -21,6 +21,7 @@
package testlib.uno;
+import org.openoffice.test.common.FileUtil;
import org.openoffice.test.uno.UnoApp;
import com.sun.star.beans.PropertyValue;
@@ -42,6 +43,7 @@ import com.sun.star.text.XText;
import com.sun.star.text.XTextContent;
import com.sun.star.text.XTextCursor;
import com.sun.star.text.XTextDocument;
+import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XModel;
import com.sun.star.frame.XController;
import com.sun.star.uno.UnoRuntime;
@@ -229,4 +231,31 @@ public class SWUtil {
XPropertySet xStyleProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xStyle);
xStyleProps.setPropertyValue (propertyName.toString(), propertyValue);
}
+
+ public static XTextDocument saveTo_Override_reload(XTextDocument xTextDocument,String filtervalue, String url,UnoApp app) throws Exception {
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties = new PropertyValue[2];
+ aStoreProperties[0] = new PropertyValue();
+ aStoreProperties[1] = new PropertyValue();
+ aStoreProperties[0].Name = "Override";
+ aStoreProperties[0].Value = true;
+ aStoreProperties[1].Name = "FilterName";
+ aStoreProperties[1].Value = filtervalue;
+ xStorable_odt.storeToURL(FileUtil.getUrl(url), aStoreProperties);
+ //reopen the document
+ return (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(url));
+ }
+ /**
+ * create document from template
+ */
+ public static XComponent newDocumentFromTemplate(String templatePath,UnoApp unoApp) throws Exception
+ {
+ XComponentLoader componentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, unoApp.getDesktop());
+ PropertyValue[] pros = new PropertyValue[1];
+ pros[0] = new PropertyValue();
+ pros[0].Name = "AsTemplate";
+ pros[0].Value = new Boolean(true);
+ XComponent component = componentLoader.loadComponentFromURL(FileUtil.getUrl(templatePath), "_blank", 0,pros);
+ return component;
+ }
}