View | Details | Raw Unified | Return to issue 120747
Collapse All | Expand All

(-)testuno/.externalToolBuilders/Classpath Builder.launch (-22 / +22 lines)
Lines 1-22 Link Here
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
2
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
3
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
3
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
4
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
4
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
5
<booleanAttribute key="org.eclipse.ant.uiSET_INPUTHANDLER" value="false"/>
5
<booleanAttribute key="org.eclipse.ant.uiSET_INPUTHANDLER" value="false"/>
6
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/>
6
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/>
7
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
7
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
8
<listEntry value="/testuno"/>
8
<listEntry value="/testuno"/>
9
</listAttribute>
9
</listAttribute>
10
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
10
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
11
<listEntry value="4"/>
11
<listEntry value="4"/>
12
</listAttribute>
12
</listAttribute>
13
<booleanAttribute key="org.eclipse.debug.core.capture_output" value="false"/>
13
<booleanAttribute key="org.eclipse.debug.core.capture_output" value="false"/>
14
<booleanAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON" value="false"/>
14
<booleanAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON" value="false"/>
15
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
15
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
16
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
16
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
17
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
17
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
18
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="testuno"/>
18
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="testuno"/>
19
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/testuno/builder.xml}"/>
19
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/testuno/builder.xml}"/>
20
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,auto,"/>
20
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,auto,"/>
21
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
21
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
22
</launchConfiguration>
22
</launchConfiguration>
(-)testuno/source/testcase/uno/sw/table/tableBorderSpacingtoContent.java (+126 lines)
Line 0 Link Here
1
package testcase.uno.sw.table;
2
3
import static org.junit.Assert.*;
4
5
import org.junit.After;
6
import org.junit.Before;
7
import org.junit.Test;
8
import org.openoffice.test.common.FileUtil;
9
import org.openoffice.test.common.Testspace;
10
import org.openoffice.test.uno.UnoApp;
11
12
import com.sun.star.uno.UnoRuntime;
13
import com.sun.star.text.*;
14
import com.sun.star.lang.XMultiServiceFactory;
15
import com.sun.star.beans.PropertyValue;
16
import com.sun.star.beans.XPropertySet;
17
import com.sun.star.container.XIndexAccess;
18
import com.sun.star.frame.XStorable;
19
20
21
public class tableBorderSpacingtoContent {
22
23
	private static final UnoApp app = new UnoApp();
24
	private XTextDocument xTextDocument=null;
25
	private XMultiServiceFactory xWriterFactory=null;
26
	private XText xText=null;
27
	@Before
28
	public void setUp() throws Exception {
29
		app.start();		
30
	}
31
32
	@After
33
	public void tearDown() throws Exception {
34
		app.close();
35
	}
36
	/*
37
	 * test table border spacing to content
38
	 * 1.new a text document and create a table
39
	 * 2.set table border spacing to content
40
	 * 3.save to odt/doc,close it and reopen new saved document
41
	 * 4.check the table border spacing to content
42
	 */
43
	@Test
44
	public void testtableBorderSpacingtoContent() throws Exception {
45
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
46
		xText=xTextDocument.getText();
47
		XTextCursor xTextCursor = xText.createTextCursor();
48
		// get internal service factory of the document
49
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
50
		// Create a new table from the document's factory
51
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
52
		xText.insertTextContent(xTextCursor,xTable,false);
53
		String[] cellName=xTable.getCellNames();
54
		int i=0;
55
		while(cellName[i] != null)
56
		{
57
		XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i]));
58
		xCursorProps.setPropertyValue("LeftBorderDistance",499);
59
		xCursorProps.setPropertyValue("RightBorderDistance",499);
60
		xCursorProps.setPropertyValue("TopBorderDistance",499);
61
		xCursorProps.setPropertyValue("BottomBorderDistance",499);
62
		i++;
63
		if(i==4)break;
64
		}
65
		//save to odt 
66
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
67
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
68
		aStoreProperties_odt[0] = new PropertyValue();
69
		aStoreProperties_odt[1] = new PropertyValue();
70
		aStoreProperties_odt[0].Name = "Override";
71
		aStoreProperties_odt[0].Value = true;
72
		aStoreProperties_odt[1].Name = "FilterName";
73
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
74
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
75
		//save to doc 
76
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
77
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
78
		aStoreProperties_doc[0] = new PropertyValue();
79
		aStoreProperties_doc[1] = new PropertyValue();
80
		aStoreProperties_doc[0].Name = "Override";
81
		aStoreProperties_doc[0].Value = true;
82
		aStoreProperties_doc[1].Name = "FilterName";
83
		aStoreProperties_doc[1].Value = "MS Word 97";
84
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
85
		app.closeDocument(xTextDocument);
86
87
		//reopen the odt document and assert table border spacing to content
88
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
89
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
90
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
91
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
92
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
93
		String[] cellName_assert_odt=xTable_Assert_odt.getCellNames();
94
		int j=0;
95
		while(cellName_assert_odt[j] != null)
96
		{
97
		XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j]));
98
		assertEquals("assert table border spacing to content",499,xCursorProps_assert_odt.getPropertyValue("LeftBorderDistance"));
99
		assertEquals("assert table border spacing to content",499,xCursorProps_assert_odt.getPropertyValue("RightBorderDistance"));
100
		assertEquals("assert table border spacing to content",499,xCursorProps_assert_odt.getPropertyValue("TopBorderDistance"));
101
		assertEquals("assert table border spacing to content",499,xCursorProps_assert_odt.getPropertyValue("BottomBorderDistance"));
102
		j++;
103
		if(j==4)break;
104
		}
105
		
106
		//reopen the doc document and assert table border spacing to content
107
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
108
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
109
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
110
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
111
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
112
		String[] cellName_assert_doc=xTable_Assert_doc.getCellNames();
113
		int k=0;
114
		while(cellName_assert_doc[k] != null)
115
		{
116
		XPropertySet xCursorProps_assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k]));
117
		assertEquals("assert table border spacing to content",499,xCursorProps_assert_doc.getPropertyValue("LeftBorderDistance"));
118
		assertEquals("assert table border spacing to content",499,xCursorProps_assert_doc.getPropertyValue("RightBorderDistance"));
119
		assertEquals("assert table border spacing to content",499,xCursorProps_assert_doc.getPropertyValue("TopBorderDistance"));
120
		assertEquals("assert table border spacing to content",499,xCursorProps_assert_doc.getPropertyValue("BottomBorderDistance"));
121
		k++;
122
		if(k==4)break;
123
		}
124
	}
125
}
126
(-)testuno/source/testcase/uno/sw/table/tableCellProtect.java (+118 lines)
Line 0 Link Here
1
package testcase.uno.sw.table;
2
3
import static org.junit.Assert.*;
4
5
import org.junit.After;
6
import org.junit.Before;
7
import org.junit.Ignore;
8
import org.junit.Test;
9
import org.openoffice.test.common.FileUtil;
10
import org.openoffice.test.common.Testspace;
11
import org.openoffice.test.uno.UnoApp;
12
13
import com.sun.star.uno.UnoRuntime;
14
import com.sun.star.text.*;
15
import com.sun.star.lang.XMultiServiceFactory;
16
import com.sun.star.beans.PropertyValue;
17
import com.sun.star.beans.XPropertySet;
18
import com.sun.star.container.XIndexAccess;
19
import com.sun.star.frame.XStorable;
20
21
22
public class tableCellProtect {
23
24
	private static final UnoApp app = new UnoApp();
25
	private XTextDocument xTextDocument=null;
26
	private XMultiServiceFactory xWriterFactory=null;
27
	private XText xText=null;
28
	@Before
29
	public void setUp() throws Exception {
30
		app.start();		
31
	}
32
33
	@After
34
	public void tearDown() throws Exception {
35
		app.close();
36
	}
37
	/*
38
	 * test table border spacing to content
39
	 * 1.new a text document and create a table
40
	 * 2.set table cell protect
41
	 * 3.save to odt/doc,close it and reopen new saved document
42
	 * 4.check the table cell protect setting
43
	 */
44
	@Test@Ignore //bug120745_table cell protect effect lost when save to doc.
45
	public void testtableBorderSpacingtoContent() throws Exception {
46
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
47
		xText=xTextDocument.getText();
48
		XTextCursor xTextCursor = xText.createTextCursor();
49
		// get internal service factory of the document
50
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
51
		// Create a new table from the document's factory
52
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
53
		xText.insertTextContent(xTextCursor,xTable,false);
54
		String[] cellName=xTable.getCellNames();
55
		int i=0;
56
		while(cellName[i] != null)
57
		{
58
		XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i]));
59
		xCursorProps.setPropertyValue("IsProtected",true);
60
		i++;
61
		if(i==4)break;
62
		}
63
		//save to odt 
64
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
65
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
66
		aStoreProperties_odt[0] = new PropertyValue();
67
		aStoreProperties_odt[1] = new PropertyValue();
68
		aStoreProperties_odt[0].Name = "Override";
69
		aStoreProperties_odt[0].Value = true;
70
		aStoreProperties_odt[1].Name = "FilterName";
71
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
72
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
73
		//save to doc 
74
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
75
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
76
		aStoreProperties_doc[0] = new PropertyValue();
77
		aStoreProperties_doc[1] = new PropertyValue();
78
		aStoreProperties_doc[0].Name = "Override";
79
		aStoreProperties_doc[0].Value = true;
80
		aStoreProperties_doc[1].Name = "FilterName";
81
		aStoreProperties_doc[1].Value = "MS Word 97";
82
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
83
		app.closeDocument(xTextDocument);
84
85
		//reopen the odt document and assert table border spacing to content
86
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
87
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
88
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
89
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
90
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
91
		String[] cellName_assert_odt=xTable_Assert_odt.getCellNames();
92
		int j=0;
93
		while(cellName_assert_odt[j] != null)
94
		{
95
		XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j]));
96
		assertEquals("assert table cell proptext",true,xCursorProps_assert_odt.getPropertyValue("IsProtected"));
97
		j++;
98
		if(j==4)break;
99
		}
100
		
101
		//reopen the doc document and assert table border spacing to content
102
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
103
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
104
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
105
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
106
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
107
		String[] cellName_assert_doc=xTable_Assert_doc.getCellNames();
108
		int k=0;
109
		while(cellName_assert_doc[k] != null)
110
		{
111
		XPropertySet xCursorProps_assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k]));
112
		assertEquals("assert table cell proptext",true,xCursorProps_assert_doc.getPropertyValue("IsProtected"));
113
		k++;
114
		if(k==4)break;
115
		}
116
	}
117
}
118
(-)testuno/source/testcase/uno/sw/table/TableInsertBreak.java (+807 lines)
Line 0 Link Here
1
package testcase.uno.sw.table;
2
3
import static org.junit.Assert.*;
4
5
import org.junit.After;
6
import org.junit.Before;
7
import org.junit.Ignore;
8
import org.junit.Test;
9
import org.openoffice.test.common.FileUtil;
10
import org.openoffice.test.common.Testspace;
11
import org.openoffice.test.uno.UnoApp;
12
import com.sun.star.text.*;
13
import com.sun.star.beans.*;
14
import com.sun.star.container.XIndexAccess;
15
import com.sun.star.frame.XStorable;
16
import com.sun.star.lang.XMultiServiceFactory;
17
import com.sun.star.uno.UnoRuntime;
18
19
public class TableInsertBreak {
20
	private static final UnoApp app = new UnoApp();
21
	private XTextDocument xTextDocument=null;
22
	private XMultiServiceFactory xWriterFactory=null;
23
	private XText xText=null;
24
25
	@Before
26
	public void setUp() throws Exception {
27
		app.start();
28
29
	}
30
31
	@After
32
	public void tearDown() throws Exception {
33
		app.close();
34
	}
35
	@Test@Ignore //bug120719
36
	public void InsertPage_BeforeBreak_Split_KeepTogether() throws Exception {
37
38
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
39
		xText=xTextDocument.getText();
40
		XTextCursor xTextCursor = xText.createTextCursor();
41
		// get internal service factory of the document
42
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
43
		// Create a new table from the document's factory
44
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
45
		xText.insertTextContent(xTextCursor,xTable,false);
46
		//insert page break for table 
47
		XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable);
48
		assertEquals("assert default split",true,xCursorProps.getPropertyValue("Split"));
49
		assertEquals("assert default keep_together",false,xCursorProps.getPropertyValue("KeepTogether"));
50
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
51
		xCursorProps.setPropertyValue("Split",false);
52
		xCursorProps.setPropertyValue("KeepTogether",true);
53
		//save to odt 
54
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
55
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
56
		aStoreProperties_odt[0] = new PropertyValue();
57
		aStoreProperties_odt[1] = new PropertyValue();
58
		aStoreProperties_odt[0].Name = "Override";
59
		aStoreProperties_odt[0].Value = true;
60
		aStoreProperties_odt[1].Name = "FilterName";
61
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
62
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
63
		//save to doc 
64
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
65
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
66
		aStoreProperties_doc[0] = new PropertyValue();
67
		aStoreProperties_doc[1] = new PropertyValue();
68
		aStoreProperties_doc[0].Name = "Override";
69
		aStoreProperties_doc[0].Value = true;
70
		aStoreProperties_doc[1].Name = "FilterName";
71
		aStoreProperties_doc[1].Value = "MS Word 97";
72
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
73
		app.closeDocument(xTextDocument);
74
75
		//reopen the document 
76
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
77
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
78
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
79
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
80
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
81
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
82
		//verify paragraph break
83
		assertEquals("assert table break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
84
		assertEquals("assert table split",false,xCursorProps_Assert_odt.getPropertyValue("Split"));
85
		assertEquals("assert table keep_tpgether",true,xCursorProps_Assert_odt.getPropertyValue("KeepTogether"));
86
87
		//reopen the doc document and assert table break
88
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
89
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
90
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
91
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
92
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
93
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
94
		//verify paragraph background color
95
		assertEquals("assert table break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
96
		assertEquals("assert table split",false,xCursorProps_Assert_doc.getPropertyValue("Split"));
97
		assertEquals("assert table keep_together",true,xCursorProps_Assert_doc.getPropertyValue("KeepTogether"));
98
	}
99
	@Test@Ignore //bug 120719
100
	public void InsertPage_AfterBreak() throws Exception {
101
102
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
103
		xText=xTextDocument.getText();
104
		XTextCursor xTextCursor = xText.createTextCursor();
105
		// get internal service factory of the document
106
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
107
		// Create a new table from the document's factory
108
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
109
		xText.insertTextContent(xTextCursor,xTable,false);
110
		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
111
		//set table break type
112
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_AFTER);		
113
		//save to odt 
114
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
115
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
116
		aStoreProperties_odt[0] = new PropertyValue();
117
		aStoreProperties_odt[1] = new PropertyValue();
118
		aStoreProperties_odt[0].Name = "Override";
119
		aStoreProperties_odt[0].Value = true;
120
		aStoreProperties_odt[1].Name = "FilterName";
121
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
122
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
123
		//save to doc 
124
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
125
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
126
		aStoreProperties_doc[0] = new PropertyValue();
127
		aStoreProperties_doc[1] = new PropertyValue();
128
		aStoreProperties_doc[0].Name = "Override";
129
		aStoreProperties_doc[0].Value = true;
130
		aStoreProperties_doc[1].Name = "FilterName";
131
		aStoreProperties_doc[1].Value = "MS Word 97";
132
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
133
		app.closeDocument(xTextDocument);
134
135
		//reopen the document 
136
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
137
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
138
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
139
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
140
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
141
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
142
		//verify paragraph break
143
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_AFTER,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
144
145
		//reopen the doc document and assert table break
146
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
147
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
148
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
149
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
150
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
151
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
152
		//verify paragraph break
153
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_AFTER,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
154
	}
155
	@Test@Ignore //bug 120719
156
	public void InsertColumn_BeforeBreak() throws Exception {
157
158
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
159
		xText=xTextDocument.getText();
160
		XTextCursor xTextCursor = xText.createTextCursor();
161
		// get internal service factory of the document
162
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
163
		// Create a new table from the document's factory
164
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
165
		xText.insertTextContent(xTextCursor,xTable,false);
166
		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
167
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.COLUMN_BEFORE);		
168
		//save to odt 
169
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
170
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
171
		aStoreProperties_odt[0] = new PropertyValue();
172
		aStoreProperties_odt[1] = new PropertyValue();
173
		aStoreProperties_odt[0].Name = "Override";
174
		aStoreProperties_odt[0].Value = true;
175
		aStoreProperties_odt[1].Name = "FilterName";
176
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
177
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
178
		//save to doc 
179
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
180
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
181
		aStoreProperties_doc[0] = new PropertyValue();
182
		aStoreProperties_doc[1] = new PropertyValue();
183
		aStoreProperties_doc[0].Name = "Override";
184
		aStoreProperties_doc[0].Value = true;
185
		aStoreProperties_doc[1].Name = "FilterName";
186
		aStoreProperties_doc[1].Value = "MS Word 97";
187
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
188
		app.closeDocument(xTextDocument);
189
190
		//reopen the document 
191
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
192
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
193
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
194
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
195
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
196
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
197
		//verify paragraph break
198
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
199
200
		//reopen the doc document and assert table break
201
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
202
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
203
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
204
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
205
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
206
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
207
		//verify paragraph break
208
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
209
	}
210
	@Test@Ignore //bug 120719
211
	public void InsertColumn_AfterBreak() throws Exception {
212
213
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
214
		xText=xTextDocument.getText();
215
		XTextCursor xTextCursor = xText.createTextCursor();
216
		// get internal service factory of the document
217
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
218
		// Create a new table from the document's factory
219
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
220
		xText.insertTextContent(xTextCursor,xTable,false);
221
		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
222
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.COLUMN_AFTER);		
223
		//save to odt 
224
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
225
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
226
		aStoreProperties_odt[0] = new PropertyValue();
227
		aStoreProperties_odt[1] = new PropertyValue();
228
		aStoreProperties_odt[0].Name = "Override";
229
		aStoreProperties_odt[0].Value = true;
230
		aStoreProperties_odt[1].Name = "FilterName";
231
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
232
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
233
		//save to doc 
234
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
235
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
236
		aStoreProperties_doc[0] = new PropertyValue();
237
		aStoreProperties_doc[1] = new PropertyValue();
238
		aStoreProperties_doc[0].Name = "Override";
239
		aStoreProperties_doc[0].Value = true;
240
		aStoreProperties_doc[1].Name = "FilterName";
241
		aStoreProperties_doc[1].Value = "MS Word 97";
242
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
243
		app.closeDocument(xTextDocument);
244
245
		//reopen the document 
246
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
247
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
248
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
249
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
250
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
251
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
252
		//verify paragraph break
253
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_AFTER,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
254
255
		//reopen the doc document and assert table break
256
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
257
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
258
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
259
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
260
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
261
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
262
		//verify table break
263
		assertEquals("assert table break",com.sun.star.style.BreakType.COLUMN_AFTER,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
264
	}
265
	@Test@Ignore //bug120721
266
	public void InsertPage_Endnote_BeforeBreak() throws Exception {
267
268
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
269
		xText=xTextDocument.getText();
270
		XTextCursor xTextCursor = xText.createTextCursor();
271
		// get internal service factory of the document
272
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
273
		// Create a new table from the document's factory
274
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
275
		xText.insertTextContent(xTextCursor,xTable,false);
276
		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
277
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
278
		xCursorProps.setPropertyValue("PageDescName","Endnote");
279
		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
280
		//save to odt 
281
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
282
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
283
		aStoreProperties_odt[0] = new PropertyValue();
284
		aStoreProperties_odt[1] = new PropertyValue();
285
		aStoreProperties_odt[0].Name = "Override";
286
		aStoreProperties_odt[0].Value = true;
287
		aStoreProperties_odt[1].Name = "FilterName";
288
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
289
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
290
		//save to doc 
291
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
292
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
293
		aStoreProperties_doc[0] = new PropertyValue();
294
		aStoreProperties_doc[1] = new PropertyValue();
295
		aStoreProperties_doc[0].Name = "Override";
296
		aStoreProperties_doc[0].Value = true;
297
		aStoreProperties_doc[1].Name = "FilterName";
298
		aStoreProperties_doc[1].Value = "MS Word 97";
299
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
300
		app.closeDocument(xTextDocument);
301
302
		//reopen the document 
303
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
304
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
305
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
306
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
307
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
308
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
309
		//verify paragraph break
310
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
311
		assertEquals("assert paragraph break","Endnote",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
312
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
313
		//reopen the doc document and assert table break
314
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
315
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
316
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
317
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
318
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
319
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
320
		//verify paragraph background color
321
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
322
		assertEquals("assert paragraph break","Endnote",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
323
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
324
	}
325
326
	@Test@Ignore //bug120721
327
	public void InsertPage_Envelop_BeforeBreak() throws Exception {
328
329
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
330
		xText=xTextDocument.getText();
331
		XTextCursor xTextCursor = xText.createTextCursor();
332
		// get internal service factory of the document
333
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
334
		// Create a new table from the document's factory
335
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
336
		xText.insertTextContent(xTextCursor,xTable,false);
337
		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
338
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
339
		xCursorProps.setPropertyValue("PageDescName","Envelope");
340
		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
341
		//save to odt 
342
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
343
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
344
		aStoreProperties_odt[0] = new PropertyValue();
345
		aStoreProperties_odt[1] = new PropertyValue();
346
		aStoreProperties_odt[0].Name = "Override";
347
		aStoreProperties_odt[0].Value = true;
348
		aStoreProperties_odt[1].Name = "FilterName";
349
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
350
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
351
		//save to doc 
352
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
353
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
354
		aStoreProperties_doc[0] = new PropertyValue();
355
		aStoreProperties_doc[1] = new PropertyValue();
356
		aStoreProperties_doc[0].Name = "Override";
357
		aStoreProperties_doc[0].Value = true;
358
		aStoreProperties_doc[1].Name = "FilterName";
359
		aStoreProperties_doc[1].Value = "MS Word 97";
360
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
361
		app.closeDocument(xTextDocument);
362
363
		//reopen the document 
364
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
365
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
366
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
367
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
368
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
369
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
370
		//verify paragraph break
371
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
372
		assertEquals("assert paragraph break","Envelope",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
373
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
374
		//reopen the doc document and assert table break
375
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
376
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
377
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
378
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
379
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
380
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
381
		//verify paragraph background color
382
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
383
		assertEquals("assert paragraph break","Envelope",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
384
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
385
	}
386
387
	@Test
388
	public void InsertPage_Firstpage_BeforeBreak() throws Exception {
389
390
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
391
		xText=xTextDocument.getText();
392
		XTextCursor xTextCursor = xText.createTextCursor();
393
		// get internal service factory of the document
394
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
395
		// Create a new table from the document's factory
396
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
397
		xText.insertTextContent(xTextCursor,xTable,false);
398
		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
399
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
400
		xCursorProps.setPropertyValue("PageDescName","First Page");
401
		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
402
		//save to odt 
403
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
404
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
405
		aStoreProperties_odt[0] = new PropertyValue();
406
		aStoreProperties_odt[1] = new PropertyValue();
407
		aStoreProperties_odt[0].Name = "Override";
408
		aStoreProperties_odt[0].Value = true;
409
		aStoreProperties_odt[1].Name = "FilterName";
410
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
411
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
412
		//save to doc 
413
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
414
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
415
		aStoreProperties_doc[0] = new PropertyValue();
416
		aStoreProperties_doc[1] = new PropertyValue();
417
		aStoreProperties_doc[0].Name = "Override";
418
		aStoreProperties_doc[0].Value = true;
419
		aStoreProperties_doc[1].Name = "FilterName";
420
		aStoreProperties_doc[1].Value = "MS Word 97";
421
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
422
		app.closeDocument(xTextDocument);
423
424
		//reopen the document 
425
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
426
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
427
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
428
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
429
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
430
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
431
		//verify paragraph break
432
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
433
		assertEquals("assert paragraph break","First Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
434
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
435
		//reopen the doc document and assert table break
436
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
437
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
438
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
439
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
440
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
441
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
442
		//verify paragraph background color
443
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
444
		assertEquals("assert paragraph break","First Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
445
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
446
	}
447
	@Test@Ignore //bug120721
448
	public void InsertPage_Footnote_BeforeBreak() throws Exception {
449
450
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
451
		xText=xTextDocument.getText();
452
		XTextCursor xTextCursor = xText.createTextCursor();
453
		// get internal service factory of the document
454
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
455
		// Create a new table from the document's factory
456
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
457
		xText.insertTextContent(xTextCursor,xTable,false);
458
		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
459
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
460
		xCursorProps.setPropertyValue("PageDescName","Footnote");
461
		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
462
		//save to odt 
463
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
464
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
465
		aStoreProperties_odt[0] = new PropertyValue();
466
		aStoreProperties_odt[1] = new PropertyValue();
467
		aStoreProperties_odt[0].Name = "Override";
468
		aStoreProperties_odt[0].Value = true;
469
		aStoreProperties_odt[1].Name = "FilterName";
470
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
471
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
472
		//save to doc 
473
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
474
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
475
		aStoreProperties_doc[0] = new PropertyValue();
476
		aStoreProperties_doc[1] = new PropertyValue();
477
		aStoreProperties_doc[0].Name = "Override";
478
		aStoreProperties_doc[0].Value = true;
479
		aStoreProperties_doc[1].Name = "FilterName";
480
		aStoreProperties_doc[1].Value = "MS Word 97";
481
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
482
		app.closeDocument(xTextDocument);
483
484
		//reopen the document 
485
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
486
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
487
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
488
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
489
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
490
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
491
		//verify paragraph break
492
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
493
		assertEquals("assert paragraph break","Footnote",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
494
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
495
		//reopen the doc document and assert table break
496
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
497
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
498
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
499
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
500
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
501
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
502
		//verify paragraph background color
503
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
504
		assertEquals("assert paragraph break","Footnote",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
505
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
506
	}
507
	@Test@Ignore //bug120721
508
	public void InsertPage_HTML_BeforeBreak() throws Exception {
509
510
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
511
		xText=xTextDocument.getText();
512
		XTextCursor xTextCursor = xText.createTextCursor();
513
		// get internal service factory of the document
514
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
515
		// Create a new table from the document's factory
516
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
517
		xText.insertTextContent(xTextCursor,xTable,false);
518
		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
519
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
520
		xCursorProps.setPropertyValue("PageDescName","HTML");
521
		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
522
		//save to odt 
523
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
524
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
525
		aStoreProperties_odt[0] = new PropertyValue();
526
		aStoreProperties_odt[1] = new PropertyValue();
527
		aStoreProperties_odt[0].Name = "Override";
528
		aStoreProperties_odt[0].Value = true;
529
		aStoreProperties_odt[1].Name = "FilterName";
530
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
531
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
532
		//save to doc 
533
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
534
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
535
		aStoreProperties_doc[0] = new PropertyValue();
536
		aStoreProperties_doc[1] = new PropertyValue();
537
		aStoreProperties_doc[0].Name = "Override";
538
		aStoreProperties_doc[0].Value = true;
539
		aStoreProperties_doc[1].Name = "FilterName";
540
		aStoreProperties_doc[1].Value = "MS Word 97";
541
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
542
		app.closeDocument(xTextDocument);
543
544
		//reopen the document 
545
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
546
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
547
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
548
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
549
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
550
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
551
		//verify paragraph break
552
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
553
		assertEquals("assert paragraph break","HTML",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
554
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
555
		//reopen the doc document and assert table break
556
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
557
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
558
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
559
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
560
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
561
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
562
		//verify paragraph background color
563
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
564
		assertEquals("assert paragraph break","HTML",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
565
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
566
	}
567
	@Test@Ignore //bug120721
568
	public void InsertPage_Index_BeforeBreak() throws Exception {
569
570
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
571
		xText=xTextDocument.getText();
572
		XTextCursor xTextCursor = xText.createTextCursor();
573
		// get internal service factory of the document
574
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
575
		// Create a new table from the document's factory
576
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
577
		xText.insertTextContent(xTextCursor,xTable,false);
578
		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
579
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
580
		xCursorProps.setPropertyValue("PageDescName","Index");
581
		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
582
		//save to odt 
583
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
584
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
585
		aStoreProperties_odt[0] = new PropertyValue();
586
		aStoreProperties_odt[1] = new PropertyValue();
587
		aStoreProperties_odt[0].Name = "Override";
588
		aStoreProperties_odt[0].Value = true;
589
		aStoreProperties_odt[1].Name = "FilterName";
590
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
591
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
592
		//save to doc 
593
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
594
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
595
		aStoreProperties_doc[0] = new PropertyValue();
596
		aStoreProperties_doc[1] = new PropertyValue();
597
		aStoreProperties_doc[0].Name = "Override";
598
		aStoreProperties_doc[0].Value = true;
599
		aStoreProperties_doc[1].Name = "FilterName";
600
		aStoreProperties_doc[1].Value = "MS Word 97";
601
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
602
		app.closeDocument(xTextDocument);
603
604
		//reopen the document 
605
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
606
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
607
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
608
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
609
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
610
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
611
		//verify paragraph break
612
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
613
		assertEquals("assert paragraph break","Index",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
614
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
615
		//reopen the doc document and assert table break
616
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
617
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
618
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
619
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
620
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
621
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
622
		//verify paragraph background color
623
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
624
		assertEquals("assert paragraph break","Index",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
625
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
626
	}
627
	@Test@Ignore //bug120721
628
	public void InsertPage_Landscape_BeforeBreak() throws Exception {
629
630
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
631
		xText=xTextDocument.getText();
632
		XTextCursor xTextCursor = xText.createTextCursor();
633
		// get internal service factory of the document
634
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
635
		// Create a new table from the document's factory
636
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
637
		xText.insertTextContent(xTextCursor,xTable,false);
638
		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
639
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
640
		xCursorProps.setPropertyValue("PageDescName","Landscape");
641
		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
642
		//save to odt 
643
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
644
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
645
		aStoreProperties_odt[0] = new PropertyValue();
646
		aStoreProperties_odt[1] = new PropertyValue();
647
		aStoreProperties_odt[0].Name = "Override";
648
		aStoreProperties_odt[0].Value = true;
649
		aStoreProperties_odt[1].Name = "FilterName";
650
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
651
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
652
		//save to doc 
653
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
654
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
655
		aStoreProperties_doc[0] = new PropertyValue();
656
		aStoreProperties_doc[1] = new PropertyValue();
657
		aStoreProperties_doc[0].Name = "Override";
658
		aStoreProperties_doc[0].Value = true;
659
		aStoreProperties_doc[1].Name = "FilterName";
660
		aStoreProperties_doc[1].Value = "MS Word 97";
661
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
662
		app.closeDocument(xTextDocument);
663
664
		//reopen the document 
665
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
666
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
667
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
668
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
669
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
670
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
671
		//verify paragraph break
672
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
673
		assertEquals("assert paragraph break","Landscape",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
674
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
675
		//reopen the doc document and assert table break
676
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
677
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
678
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
679
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
680
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
681
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
682
		//verify paragraph background color
683
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
684
		assertEquals("assert paragraph break","Landscape",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
685
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
686
	}
687
	@Test@Ignore //bug120721
688
	public void InsertPage_LeftPage_BeforeBreak() throws Exception {
689
690
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
691
		xText=xTextDocument.getText();
692
		XTextCursor xTextCursor = xText.createTextCursor();
693
		// get internal service factory of the document
694
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
695
		// Create a new table from the document's factory
696
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
697
		xText.insertTextContent(xTextCursor,xTable,false);
698
		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
699
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
700
		xCursorProps.setPropertyValue("PageDescName","Left Page");
701
		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
702
		//save to odt 
703
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
704
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
705
		aStoreProperties_odt[0] = new PropertyValue();
706
		aStoreProperties_odt[1] = new PropertyValue();
707
		aStoreProperties_odt[0].Name = "Override";
708
		aStoreProperties_odt[0].Value = true;
709
		aStoreProperties_odt[1].Name = "FilterName";
710
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
711
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
712
		//save to doc 
713
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
714
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
715
		aStoreProperties_doc[0] = new PropertyValue();
716
		aStoreProperties_doc[1] = new PropertyValue();
717
		aStoreProperties_doc[0].Name = "Override";
718
		aStoreProperties_doc[0].Value = true;
719
		aStoreProperties_doc[1].Name = "FilterName";
720
		aStoreProperties_doc[1].Value = "MS Word 97";
721
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
722
		app.closeDocument(xTextDocument);
723
724
		//reopen the document 
725
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
726
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
727
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
728
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
729
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
730
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
731
		//verify paragraph break
732
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
733
		assertEquals("assert paragraph break","Left Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
734
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
735
		//reopen the doc document and assert table break
736
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
737
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
738
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
739
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
740
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
741
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
742
		//verify paragraph background color
743
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
744
		assertEquals("assert paragraph break","Left Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
745
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
746
	}
747
	@Test@Ignore //bug120721
748
	public void InsertPage_RightPage_BeforeBreak() throws Exception {
749
750
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
751
		xText=xTextDocument.getText();
752
		XTextCursor xTextCursor = xText.createTextCursor();
753
		// get internal service factory of the document
754
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
755
		// Create a new table from the document's factory
756
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
757
		xText.insertTextContent(xTextCursor,xTable,false);
758
		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xTable);
759
		xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
760
		xCursorProps.setPropertyValue("PageDescName","Right Page");
761
		xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
762
		//save to odt 
763
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
764
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
765
		aStoreProperties_odt[0] = new PropertyValue();
766
		aStoreProperties_odt[1] = new PropertyValue();
767
		aStoreProperties_odt[0].Name = "Override";
768
		aStoreProperties_odt[0].Value = true;
769
		aStoreProperties_odt[1].Name = "FilterName";
770
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
771
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
772
		//save to doc 
773
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
774
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
775
		aStoreProperties_doc[0] = new PropertyValue();
776
		aStoreProperties_doc[1] = new PropertyValue();
777
		aStoreProperties_doc[0].Name = "Override";
778
		aStoreProperties_doc[0].Value = true;
779
		aStoreProperties_doc[1].Name = "FilterName";
780
		aStoreProperties_doc[1].Value = "MS Word 97";
781
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
782
		app.closeDocument(xTextDocument);
783
784
		//reopen the document 
785
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
786
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
787
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
788
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
789
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
790
		XPropertySet xCursorProps_Assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt);
791
		//verify paragraph break
792
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
793
		assertEquals("assert paragraph break","Right Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
794
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
795
		//reopen the doc document and assert table break
796
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
797
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
798
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
799
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
800
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
801
		XPropertySet xCursorProps_Assert_doc = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc);
802
		//verify paragraph background color
803
		assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
804
		assertEquals("assert paragraph break","Right Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
805
		assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
806
	}
807
}
(-)testuno/source/testcase/uno/sw/table/tableName.java (+99 lines)
Line 0 Link Here
1
package testcase.uno.sw.table;
2
3
import static org.junit.Assert.*;
4
5
import org.junit.After;
6
import org.junit.Before;
7
import org.junit.Ignore;
8
import org.junit.Test;
9
import org.openoffice.test.common.FileUtil;
10
import org.openoffice.test.common.Testspace;
11
import org.openoffice.test.uno.UnoApp;
12
13
import com.sun.star.uno.UnoRuntime;
14
import com.sun.star.text.*;
15
import com.sun.star.lang.XMultiServiceFactory;
16
import com.sun.star.beans.PropertyValue;
17
import com.sun.star.container.XIndexAccess;
18
import com.sun.star.container.XNamed;
19
import com.sun.star.frame.XStorable;
20
21
22
public class tableName {
23
24
	private static final UnoApp app = new UnoApp();
25
	private XTextDocument xTextDocument=null;
26
	private XMultiServiceFactory xWriterFactory=null;
27
	private XText xText=null;
28
	@Before
29
	public void setUp() throws Exception {
30
		app.start();		
31
	}
32
33
	@After
34
	public void tearDown() throws Exception {
35
		app.close();
36
	}
37
	/*
38
	 * test table border spacing to content
39
	 * 1.new a text document and create a table
40
	 * 2.set table name
41
	 * 3.save to odt/doc,close it and reopen new saved document
42
	 * 4.check the table name
43
	 */
44
	@Test@Ignore //bug120739_the table name change to default name when save to doc.
45
	public void testtableName() throws Exception {
46
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
47
		xText=xTextDocument.getText();
48
		XTextCursor xTextCursor = xText.createTextCursor();
49
		// get internal service factory of the document
50
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
51
		// Create a new table from the document's factory
52
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
53
		xText.insertTextContent(xTextCursor,xTable,false);
54
		XNamed tableName=(XNamed)UnoRuntime.queryInterface(XNamed.class, xTable);
55
		assertEquals("assert default table name","Table1",tableName.getName());
56
		tableName.setName("test_TableExample");
57
		//save to odt 
58
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
59
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
60
		aStoreProperties_odt[0] = new PropertyValue();
61
		aStoreProperties_odt[1] = new PropertyValue();
62
		aStoreProperties_odt[0].Name = "Override";
63
		aStoreProperties_odt[0].Value = true;
64
		aStoreProperties_odt[1].Name = "FilterName";
65
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
66
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
67
		//save to doc 
68
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
69
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
70
		aStoreProperties_doc[0] = new PropertyValue();
71
		aStoreProperties_doc[1] = new PropertyValue();
72
		aStoreProperties_doc[0].Name = "Override";
73
		aStoreProperties_doc[0].Value = true;
74
		aStoreProperties_doc[1].Name = "FilterName";
75
		aStoreProperties_doc[1].Value = "MS Word 97";
76
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
77
		app.closeDocument(xTextDocument);
78
79
		//reopen the odt document and assert table border spacing to content
80
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
81
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
82
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
83
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
84
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
85
		XNamed tableName_odt=(XNamed)UnoRuntime.queryInterface(XNamed.class, xTable_Assert_odt);
86
		assertEquals("assert default table name","test_TableExample",tableName_odt.getName());
87
		
88
		//reopen the doc document and assert table border spacing to content
89
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
90
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
91
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
92
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
93
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
94
		XNamed tableName_doc=(XNamed)UnoRuntime.queryInterface(XNamed.class, xTable_Assert_doc);
95
		assertEquals("assert default table name","test_TableExample",tableName_doc.getName());
96
       
97
	}
98
}
99
(-)testuno/source/testcase/uno/sw/table/tableVerticalAlignment.java (+263 lines)
Line 0 Link Here
1
package testcase.uno.sw.table;
2
3
import static org.junit.Assert.*;
4
5
import org.junit.After;
6
import org.junit.Before;
7
import org.junit.Test;
8
import org.openoffice.test.common.FileUtil;
9
import org.openoffice.test.common.Testspace;
10
import org.openoffice.test.uno.UnoApp;
11
12
import com.sun.star.uno.UnoRuntime;
13
import com.sun.star.text.*;
14
import com.sun.star.lang.XMultiServiceFactory;
15
import com.sun.star.beans.PropertyValue;
16
import com.sun.star.beans.XPropertySet;
17
import com.sun.star.container.XIndexAccess;
18
import com.sun.star.frame.XStorable;
19
20
21
public class tableVerticalAlignment {
22
23
	private static final UnoApp app = new UnoApp();
24
	private XTextDocument xTextDocument=null;
25
	private XMultiServiceFactory xWriterFactory=null;
26
	private XText xText=null;
27
	@Before
28
	public void setUp() throws Exception {
29
		app.start();		
30
	}
31
32
	@After
33
	public void tearDown() throws Exception {
34
		app.close();
35
	}
36
	/*
37
	 * test table border spacing to content
38
	 * 1.new a text document and create a table
39
	 * 2.set table cell vertical alignment
40
	 * 3.save to odt/doc,close it and reopen new saved document
41
	 * 4.check the table cell vertical alignment
42
	 */
43
	@Test
44
	public void testtableVerticalAlignment_Bottom() throws Exception {
45
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
46
		xText=xTextDocument.getText();
47
		XTextCursor xTextCursor = xText.createTextCursor();
48
		// get internal service factory of the document
49
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
50
		// Create a new table from the document's factory
51
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
52
		xText.insertTextContent(xTextCursor,xTable,false);
53
		String[] cellName=xTable.getCellNames();
54
		int i=0;
55
		while(cellName[i] != null)
56
		{
57
		XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i]));
58
		xCursorProps.setPropertyValue("VertOrient",VertOrientation.BOTTOM);
59
		i++;
60
		if(i==4)break;
61
		}
62
		//save to odt 
63
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
64
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
65
		aStoreProperties_odt[0] = new PropertyValue();
66
		aStoreProperties_odt[1] = new PropertyValue();
67
		aStoreProperties_odt[0].Name = "Override";
68
		aStoreProperties_odt[0].Value = true;
69
		aStoreProperties_odt[1].Name = "FilterName";
70
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
71
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
72
		//save to doc 
73
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
74
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
75
		aStoreProperties_doc[0] = new PropertyValue();
76
		aStoreProperties_doc[1] = new PropertyValue();
77
		aStoreProperties_doc[0].Name = "Override";
78
		aStoreProperties_doc[0].Value = true;
79
		aStoreProperties_doc[1].Name = "FilterName";
80
		aStoreProperties_doc[1].Value = "MS Word 97";
81
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
82
		app.closeDocument(xTextDocument);
83
84
		//reopen the odt document and assert table vertical alignment
85
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
86
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
87
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
88
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
89
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
90
		String[] cellName_assert_odt=xTable_Assert_odt.getCellNames();
91
		int j=0;
92
		while(cellName_assert_odt[j] != null)
93
		{
94
		XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j]));
95
		assertEquals("assert table border spacing to content",VertOrientation.BOTTOM,xCursorProps_assert_odt.getPropertyValue("VertOrient"));
96
		j++;
97
		if(j==4)break;
98
		}
99
		
100
		//reopen the doc document and assert table vertical alignment
101
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
102
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
103
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
104
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
105
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
106
		String[] cellName_assert_doc=xTable_Assert_doc.getCellNames();
107
		int k=0;
108
		while(cellName_assert_doc[k] != null)
109
		{
110
		XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k]));
111
		assertEquals("assert table vertical alignment",VertOrientation.BOTTOM,xCursorProps_assert_odt.getPropertyValue("VertOrient"));
112
		k++;
113
		if(k==4)break;
114
		}
115
	}
116
	@Test
117
	public void testtableVerticalAlignment_Center() throws Exception {
118
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
119
		xText=xTextDocument.getText();
120
		XTextCursor xTextCursor = xText.createTextCursor();
121
		// get internal service factory of the document
122
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
123
		// Create a new table from the document's factory
124
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
125
		xText.insertTextContent(xTextCursor,xTable,false);
126
		String[] cellName=xTable.getCellNames();
127
		int i=0;
128
		while(cellName[i] != null)
129
		{
130
		XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i]));
131
		xCursorProps.setPropertyValue("VertOrient",VertOrientation.CENTER);
132
		i++;
133
		if(i==4)break;
134
		}
135
		//save to odt 
136
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
137
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
138
		aStoreProperties_odt[0] = new PropertyValue();
139
		aStoreProperties_odt[1] = new PropertyValue();
140
		aStoreProperties_odt[0].Name = "Override";
141
		aStoreProperties_odt[0].Value = true;
142
		aStoreProperties_odt[1].Name = "FilterName";
143
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
144
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
145
		//save to doc 
146
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
147
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
148
		aStoreProperties_doc[0] = new PropertyValue();
149
		aStoreProperties_doc[1] = new PropertyValue();
150
		aStoreProperties_doc[0].Name = "Override";
151
		aStoreProperties_doc[0].Value = true;
152
		aStoreProperties_doc[1].Name = "FilterName";
153
		aStoreProperties_doc[1].Value = "MS Word 97";
154
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
155
		app.closeDocument(xTextDocument);
156
157
		//reopen the odt document and assert table vertical alignment
158
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
159
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
160
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
161
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
162
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
163
		String[] cellName_assert_odt=xTable_Assert_odt.getCellNames();
164
		int j=0;
165
		while(cellName_assert_odt[j] != null)
166
		{
167
		XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j]));
168
		assertEquals("assert table border spacing to content",VertOrientation.CENTER,xCursorProps_assert_odt.getPropertyValue("VertOrient"));
169
		j++;
170
		if(j==4)break;
171
		}
172
		
173
		//reopen the doc document and assert table vertical alignment
174
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
175
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
176
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
177
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
178
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
179
		String[] cellName_assert_doc=xTable_Assert_doc.getCellNames();
180
		int k=0;
181
		while(cellName_assert_doc[k] != null)
182
		{
183
		XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k]));
184
		assertEquals("assert table vertical alignment",VertOrientation.CENTER,xCursorProps_assert_odt.getPropertyValue("VertOrient"));
185
		k++;
186
		if(k==4)break;
187
		}
188
	}
189
	@Test
190
	public void testtableVerticalAlignment_Top() throws Exception {
191
		xTextDocument =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
192
		xText=xTextDocument.getText();
193
		XTextCursor xTextCursor = xText.createTextCursor();
194
		// get internal service factory of the document
195
		xWriterFactory =(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
196
		// Create a new table from the document's factory
197
		XTextTable xTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, xWriterFactory.createInstance("com.sun.star.text.TextTable"));
198
		xText.insertTextContent(xTextCursor,xTable,false);
199
		String[] cellName=xTable.getCellNames();
200
		int i=0;
201
		while(cellName[i] != null)
202
		{
203
		XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable.getCellByName(cellName[i]));
204
		xCursorProps.setPropertyValue("VertOrient",VertOrientation.TOP);
205
		i++;
206
		if(i==4)break;
207
		}
208
		//save to odt 
209
		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
210
		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
211
		aStoreProperties_odt[0] = new PropertyValue();
212
		aStoreProperties_odt[1] = new PropertyValue();
213
		aStoreProperties_odt[0].Name = "Override";
214
		aStoreProperties_odt[0].Value = true;
215
		aStoreProperties_odt[1].Name = "FilterName";
216
		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
217
		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
218
		//save to doc 
219
		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
220
		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
221
		aStoreProperties_doc[0] = new PropertyValue();
222
		aStoreProperties_doc[1] = new PropertyValue();
223
		aStoreProperties_doc[0].Name = "Override";
224
		aStoreProperties_doc[0].Value = true;
225
		aStoreProperties_doc[1].Name = "FilterName";
226
		aStoreProperties_doc[1].Value = "MS Word 97";
227
		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);	
228
		app.closeDocument(xTextDocument);
229
230
		//reopen the odt document and assert table vertical alignment
231
		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
232
		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_odt );
233
		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_odt.getTextTables());
234
		Object xTable_obj_odt=xIndexedTables_odt.getByIndex(0);
235
		XTextTable xTable_Assert_odt=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_odt);
236
		String[] cellName_assert_odt=xTable_Assert_odt.getCellNames();
237
		int j=0;
238
		while(cellName_assert_odt[j] != null)
239
		{
240
		XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_odt.getCellByName(cellName_assert_odt[j]));
241
		assertEquals("assert table border spacing to content",VertOrientation.TOP,xCursorProps_assert_odt.getPropertyValue("VertOrient"));
242
		j++;
243
		if(j==4)break;
244
		}
245
		
246
		//reopen the doc document and assert table vertical alignment
247
		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
248
		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, assertDocument_doc );
249
		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTablesSupplier_doc.getTextTables());
250
		Object xTable_obj_doc=xIndexedTables_doc.getByIndex(0);
251
		XTextTable xTable_Assert_doc=(XTextTable) UnoRuntime.queryInterface(XTextTable.class, xTable_obj_doc);
252
		String[] cellName_assert_doc=xTable_Assert_doc.getCellNames();
253
		int k=0;
254
		while(cellName_assert_doc[k] != null)
255
		{
256
		XPropertySet xCursorProps_assert_odt = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xTable_Assert_doc.getCellByName(cellName_assert_doc[k]));
257
		assertEquals("assert table vertical alignment",VertOrientation.TOP,xCursorProps_assert_odt.getPropertyValue("VertOrient"));
258
		k++;
259
		if(k==4)break;
260
		}
261
	}
262
}
263

Return to issue 120747