diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-10-15 23:39:05 +0200 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-10-15 23:39:05 +0200 |
commit | 63f1445c73f54fe9adcc0c0cb0aae6c7e639c8a2 (patch) | |
tree | 390174096c3deb5647b5e81d85338a1b990cea55 /sfx2/qa/complex/sfx2/undo | |
parent | 7c1bc8c31291669c2254592d7e30222a511d3a8a (diff) |
undoapi: API and Impl tweaks
Diffstat (limited to 'sfx2/qa/complex/sfx2/undo')
-rwxr-xr-x | sfx2/qa/complex/sfx2/undo/CalcDocumentTest.java | 21 | ||||
-rwxr-xr-x | sfx2/qa/complex/sfx2/undo/DocumentTest.java | 8 | ||||
-rwxr-xr-x | sfx2/qa/complex/sfx2/undo/DocumentTestBase.java | 7 |
3 files changed, 23 insertions, 13 deletions
diff --git a/sfx2/qa/complex/sfx2/undo/CalcDocumentTest.java b/sfx2/qa/complex/sfx2/undo/CalcDocumentTest.java index 03f2b3ade019..16d813bdaeb8 100755 --- a/sfx2/qa/complex/sfx2/undo/CalcDocumentTest.java +++ b/sfx2/qa/complex/sfx2/undo/CalcDocumentTest.java @@ -6,13 +6,13 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.table.XCell; import com.sun.star.uno.UnoRuntime; import org.openoffice.test.tools.DocumentType; -import org.openoffice.test.tools.OfficeDocument; import static org.junit.Assert.*; /** + * implements the {@link DocumentTest} interface on top of a spreadsheet document * @author frank.schoenheit@oracle.com */ -public class CalcDocumentTest extends DocumentTestBase implements DocumentTest +public class CalcDocumentTest extends DocumentTestBase { public CalcDocumentTest( final XMultiServiceFactory i_orb ) throws Exception { @@ -43,15 +43,15 @@ public class CalcDocumentTest extends DocumentTestBase implements DocumentTest public void doSingleModification() throws com.sun.star.uno.Exception { final XCell cellA1 = getCellA1(); - assertEquals( "initial cell value not as expected", cellA1.getValue(), INIT_VALUE, 0 ); + assertEquals( "initial cell value not as expected", INIT_VALUE, cellA1.getValue(), 0 ); cellA1.setValue( MODIFIED_VALUE ); - assertEquals( "modified cell value not as expected", cellA1.getValue(), MODIFIED_VALUE, 0 ); + assertEquals( "modified cell value not as expected", MODIFIED_VALUE, cellA1.getValue(), 0 ); } public void verifyInitialDocumentState() throws com.sun.star.uno.Exception { final XCell cellA1 = getCellA1(); - assertEquals( "cell A1 didn't restore its value", cellA1.getValue(), INIT_VALUE, 0 ); + assertEquals( "cell A1 didn't restore its value", INIT_VALUE, cellA1.getValue(), 0 ); XCellRange range = UnoRuntime.queryInterface( XCellRange.class, ((SpreadsheetDocument)m_document).getSheet(0) ); @@ -62,6 +62,12 @@ public class CalcDocumentTest extends DocumentTestBase implements DocumentTest } } + public void verifySingleModificationDocumentState() throws com.sun.star.uno.Exception + { + final XCell cellA1 = getCellA1(); + assertEquals( "cell A1 doesn't have the value which we gave it", MODIFIED_VALUE, cellA1.getValue(), 0 ); + } + public int doMultipleModifications() throws com.sun.star.uno.Exception { XCellRange range = UnoRuntime.queryInterface( XCellRange.class, @@ -78,11 +84,6 @@ public class CalcDocumentTest extends DocumentTestBase implements DocumentTest return 12; } - public OfficeDocument getDocument() - { - return m_document; - } - private XCell getCellA1() throws com.sun.star.uno.Exception { XCellRange range = UnoRuntime.queryInterface( XCellRange.class, diff --git a/sfx2/qa/complex/sfx2/undo/DocumentTest.java b/sfx2/qa/complex/sfx2/undo/DocumentTest.java index f9339c8146b9..431e64ab0197 100755 --- a/sfx2/qa/complex/sfx2/undo/DocumentTest.java +++ b/sfx2/qa/complex/sfx2/undo/DocumentTest.java @@ -1,7 +1,5 @@ package complex.sfx2.undo; -import com.sun.star.document.XUndoAction; -import com.sun.star.document.XUndoManager; import org.openoffice.test.tools.OfficeDocument; /** @@ -34,6 +32,12 @@ public interface DocumentTest public void verifyInitialDocumentState() throws com.sun.star.uno.Exception; /** + * verifies the document is in the state as expected after {@link #doSingleModification} + * @throws com.sun.star.uno.Exception + */ + public void verifySingleModificationDocumentState() throws com.sun.star.uno.Exception; + + /** * does multiple modifications do the document, which would normally result in multiple Undo actions. * * The test framework will encapsulate the call into an {@link XUndoManager.enterUndoContext()} and diff --git a/sfx2/qa/complex/sfx2/undo/DocumentTestBase.java b/sfx2/qa/complex/sfx2/undo/DocumentTestBase.java index ba895973a2dc..147ef587b3bc 100755 --- a/sfx2/qa/complex/sfx2/undo/DocumentTestBase.java +++ b/sfx2/qa/complex/sfx2/undo/DocumentTestBase.java @@ -8,12 +8,17 @@ import org.openoffice.test.tools.OfficeDocument; /** * @author frank.schoenheit@oracle.com */ -class DocumentTestBase +abstract class DocumentTestBase implements DocumentTest { DocumentTestBase( final XMultiServiceFactory i_orb, final DocumentType i_docType ) throws Exception { m_document = OfficeDocument.blankDocument( i_orb, i_docType ); } + public OfficeDocument getDocument() + { + return m_document; + } + protected final OfficeDocument m_document; } |