001 /*
002 * Copyright (c) 2005 Jens Schou, Staffan Gustafsson, Björn Lanneskog,
003 * Einar Pehrson and Sebastian Kekkonen
004 *
005 * This file is part of
006 * CleanSheets Extension for Test Cases
007 *
008 * CleanSheets Extension for Test Cases is free software; you can
009 * redistribute it and/or modify it under the terms of the GNU General Public
010 * License as published by the Free Software Foundation; either version 2 of
011 * the License, or (at your option) any later version.
012 *
013 * CleanSheets Extension for Test Cases is distributed in the hope that
014 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
015 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016 * See the GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with CleanSheets Extension for Test Cases; if not, write to the
020 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
021 * Boston, MA 02111-1307 USA
022 */
023 package csheets.ext.test;
024
025 import csheets.core.Cell;
026 import csheets.core.Spreadsheet;
027 import csheets.ext.Extension;
028 import csheets.ext.test.ui.TestUIExtension;
029 import csheets.ui.ctrl.UIController;
030 import csheets.ui.ext.UIExtension;
031
032 /**
033 * The extension for tests.
034 * @author Einar Pehrson
035 */
036 public class TestExtension extends Extension {
037
038 /** The name of the extension */
039 public static final String NAME = "Test Cases";
040
041 /**
042 * Creates a new test extension.
043 */
044 public TestExtension() {
045 super(NAME);
046 }
047
048 /**
049 * Makes the given spreadsheet testable.
050 * @param spreadsheet the spreadsheet to extend
051 * @return a testable spreadsheet
052 */
053 public TestableSpreadsheet extend(Spreadsheet spreadsheet) {
054 return new TestableSpreadsheet(spreadsheet);
055 }
056
057 /**
058 * Makes the given cell testable.
059 * @param cell the cell to extend
060 * @return a testable cell
061 */
062 public TestableCell extend(Cell cell) {
063 return new TestableCell(cell);
064 }
065
066 /**
067 * Returns a user interface extension for testing.
068 * @param uiController the user interface controller
069 * @return a user interface extension for testing
070 */
071 public UIExtension getUIExtension(UIController uiController) {
072 return new TestUIExtension(this, uiController);
073 }
074 }