1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 package complex.sfx2.undo; 23 24 import org.openoffice.test.tools.OfficeDocument; 25 26 /** 27 * wrapper around an OfficeDocument, for running a standardized test procedure (related do Undo functionality) 28 * on the document. 29 * 30 * @author frank.schoenheit@oracle.com 31 */ 32 public interface DocumentTest 33 { 34 /** 35 * returns a human-readable description for the document/type which the tests operates on 36 */ getDocumentDescription()37 public String getDocumentDescription(); 38 39 /** 40 * initializes the document to a state where the subsequent tests can be ran 41 */ initializeDocument()42 public void initializeDocument() throws com.sun.star.uno.Exception; 43 44 /** 45 * closes the document which the test is based on 46 */ closeDocument()47 public void closeDocument(); 48 49 /** 50 * does a simple modification to the document, which results in one Undo action being auto-generated 51 * by the OOo implementation 52 */ doSingleModification()53 public void doSingleModification() throws com.sun.star.uno.Exception; 54 55 /** 56 * verifies the document is in the same state as after {@link #initializeDocument} 57 */ verifyInitialDocumentState()58 public void verifyInitialDocumentState() throws com.sun.star.uno.Exception; 59 60 /** 61 * verifies the document is in the state as expected after {@link #doSingleModification} 62 * @throws com.sun.star.uno.Exception 63 */ verifySingleModificationDocumentState()64 public void verifySingleModificationDocumentState() throws com.sun.star.uno.Exception; 65 66 /** 67 * does multiple modifications do the document, which would normally result in multiple Undo actions. 68 * 69 * The test framework will encapsulate the call into an {@link com.sun.star.document.XUndoManager#enterUndoContext} and 70 * {@link com.sun.star.document.XUndoManager#leaveUndoContext} call. 71 * 72 * @return 73 * the number of modifications done to the document. The caller assumes (and asserts) that the number 74 * of actions on the Undo stack equals this number. 75 */ doMultipleModifications()76 public int doMultipleModifications() throws com.sun.star.uno.Exception; 77 78 /** 79 * returns the document which the test operates on 80 */ getDocument()81 public OfficeDocument getDocument(); 82 } 83