You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2012/01/27 02:29:58 UTC
svn commit: r1236486 [43/43] - in
/incubator/ooo/devtools/netbeansintegration: ./ build/
build/public-package-jars/ javahelp/ javahelp/org/ javahelp/org/openoffice/
javahelp/org/openoffice/extensions/
javahelp/org/openoffice/extensions/docs/ javahelp/o...
Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/LocalizedOpenOfficeOrgPropertyTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/LocalizedOpenOfficeOrgPropertyTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/LocalizedOpenOfficeOrgPropertyTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/LocalizedOpenOfficeOrgPropertyTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,351 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: LocalizedOpenOfficeOrgPropertyTest.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sg $ $Date: 2007/09/04 15:06:45 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util.datamodel.properties;
+
+import junit.framework.*;
+import java.awt.event.ActionEvent;
+import javax.swing.Action;
+import org.openide.nodes.Node;
+import org.openoffice.extensions.util.datamodel.*;
+import org.openoffice.extensions.util.datamodel.localization.LanguageDefinition;
+import org.openoffice.extensions.util.datamodel.properties.ObjectHelperImplementations.MyLanguageAction;
+
+/**
+ *
+ * @author sg128468
+ */
+public class LocalizedOpenOfficeOrgPropertyTest extends TestCase {
+
+ private ObjectHelperImplementations m_objectHelper;
+
+ public LocalizedOpenOfficeOrgPropertyTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ m_objectHelper = new ObjectHelperImplementations();
+ }
+
+ protected void tearDown() throws Exception {
+ m_objectHelper = null;
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(LocalizedOpenOfficeOrgPropertyTest.class);
+
+ return suite;
+ }
+
+ /**
+ * Test of isLocalized method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testIsLocalized() {
+ System.out.println("isLocalized");
+
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "MyName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+ boolean expResult = true;
+ boolean result = instance.isLocalized();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getPropertyName method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testGetPropertyName() {
+ System.out.println("getPropertyName");
+
+ String expResult = "MyName";
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ expResult, "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ String result = instance.getPropertyName();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getUsedLanguageIndexes method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testGetUsedLanguageIndexes() {
+ System.out.println("getUsedLanguageIndexes");
+
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "MyName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ Integer[] expResult = new Integer[]{new Integer(LanguageDefinition.LANGUAGE_ID_en)};
+ Integer[] result = instance.getUsedLanguageIndexes();
+ assertEquals(expResult.length, result.length);
+ assertEquals(expResult[0], result[0]);
+ }
+
+ /**
+ * Test of setPropertyName method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testSetPropertyName() {
+ System.out.println("setPropertyName");
+
+ String name = "A new Name";
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "MyName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ instance.setPropertyName(name);
+
+ String expResult = instance.getPropertyName();
+ assertEquals(expResult, name);
+ }
+
+ /**
+ * Test of getValueForLanguage method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testGetValueForLanguage() {
+ System.out.println("getValueForLanguage");
+
+ String expResult = "aValue";
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "MyName", expResult, "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ String result = instance.getValueForLanguage(LanguageDefinition.LANGUAGE_ID_en);
+ assertEquals(expResult, result);
+
+ result = instance.getValueForLanguage(LanguageDefinition.LANGUAGE_ID_de);
+ assertNull(result);
+
+ result = instance.getValueForLanguage(-2);
+ assertNull(result);
+ }
+
+ /**
+ * Test of setValueForLanguage method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testSetValueForLanguage() {
+ System.out.println("setValueForLanguage");
+
+ String expResult = "a new Value";
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "MyName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ instance.setValueForLanguage(LanguageDefinition.LANGUAGE_ID_en, expResult);
+ String result = instance.getValueForLanguage(LanguageDefinition.LANGUAGE_ID_en);
+ assertEquals(expResult, result);
+
+ expResult = "another new Value";
+ instance.setValueForLanguage(LanguageDefinition.LANGUAGE_ID_de, expResult);
+ result = instance.getValueForLanguage(LanguageDefinition.LANGUAGE_ID_de);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of removeValueForLanguage method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testRemoveValueForLanguage() {
+ System.out.println("removeValueForLanguage");
+
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "MyName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ instance.removeValueForLanguage(LanguageDefinition.LANGUAGE_ID_en);
+ String result = instance.getValueForLanguage(LanguageDefinition.LANGUAGE_ID_en);
+ assertNull(result);
+ }
+
+ /**
+ * Test of getDescription method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testGetDescription() {
+ System.out.println("getDescription");
+
+ String expResult = "a really long description";
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "MyName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ instance.setDescription(expResult);
+ String result = instance.getDescription();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of setDescription method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testSetDescription() {
+ System.out.println("setDescription");
+
+ String expResult = "a new description";
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "MyName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ instance.setDescription(expResult);
+ String result = instance.getDescription();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getDisplayName method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testGetDisplayName() {
+ System.out.println("getDisplayName");
+
+ String expResult = "myName";
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ expResult, "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ String result = instance.getDisplayName();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getAllSubObjects method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testGetAllSubObjects() {
+ System.out.println("getAllSubObjects");
+
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "myName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ NbNodeObject[] result = instance.getAllSubObjects();
+ assertNull(result);
+ }
+
+ /**
+ * Test of createProperties method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testCreateProperties() {
+ System.out.println("createProperties");
+
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "myName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ // does not compile?
+// Node.Property[] expResult = new LocalizedProperty(LanguageDefinition.LANGUAGE_ID_en);
+ int expResult = 1;
+ Node.Property[] result = instance.createProperties(null, null);
+ assertEquals(expResult, result.length);
+ }
+
+ /**
+ * Test of getParent method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testGetParent() {
+ System.out.println("getParent");
+
+ NbNodeObject expResult = m_objectHelper.getMockNbNodeObject();
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "myName", "aValue", "a description", expResult,
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ NbNodeObject result = instance.getParent();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of hasActions method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testHasActions() {
+ System.out.println("hasActions");
+
+ int type = 0;
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "myName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ boolean expResult = true;
+ boolean result = instance.hasActions(type);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getActions method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testGetActions() {
+ System.out.println("getActions");
+
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "myName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ Action[] result = instance.getActions(true);
+ assertEquals(result.length, 2); // got two actions
+ }
+
+ /**
+ * Test of setActions method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testSetActions() {
+ System.out.println("setActions");
+
+ boolean expResult = true;
+ MyLanguageAction langActions = new ObjectHelperImplementations().getMyLanguageAction();
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "myName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ instance.setActions(langActions);
+
+ Action[] actions = instance.getActions(true);
+ actions[0].actionPerformed(new ActionEvent(this, 0, "addLang"));
+ actions[1].actionPerformed(new ActionEvent(this, 0, "delLang"));
+
+ boolean result = langActions.addLangCalled & langActions.delLangCalled;
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getType method, of class org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty.
+ */
+ public void testGetType() {
+ System.out.println("getType");
+
+ LocalizedOpenOfficeOrgProperty instance = new LocalizedOpenOfficeOrgProperty(
+ "myName", "aValue", "a description", m_objectHelper.getMockNbNodeObject(),
+ LanguageDefinition.LANGUAGE_ID_en, null);
+
+ int expResult = NbNodeObject.LOCALIZED_PROPERTY_TYPE;
+ int result = instance.getType();
+ assertEquals(expResult, result);
+
+ }
+}
Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/ObjectHelperImplementations.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/ObjectHelperImplementations.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/ObjectHelperImplementations.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/ObjectHelperImplementations.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ObjectHelperImplementations.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sg $ $Date: 2007/09/04 15:06:45 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util.datamodel.properties;
+
+import java.beans.PropertyChangeListener;
+import javax.swing.Action;
+import org.openide.nodes.Node;
+import org.openide.nodes.Sheet;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+import org.openoffice.extensions.util.datamodel.actions.BaseAction;
+import org.openoffice.extensions.util.datamodel.actions.LanguageAction;
+
+/**
+ *
+ * @author sg128468
+ */
+public class ObjectHelperImplementations {
+
+
+ public MockNbNodeObject getMockNbNodeObject() {
+ return new MockNbNodeObject();
+ }
+
+ public MockNbNodeObject getAddinNbNodeObject() {
+ MockNbNodeObject obj = new MockNbNodeObject();
+ obj.type = NbNodeObject.ADDIN_TYPE;
+ return obj;
+ }
+
+ public class MockNbNodeObject implements NbNodeObject {
+ int type = NbNodeObject.FUNCTION_TYPE; // some type with props
+ public NbNodeObject getParent() {
+ return null; // we assume this is the topmost object
+ }
+
+ public String getDisplayName() {
+ return "myDisplayName";
+ }
+
+ public NbNodeObject[] getAllSubObjects() {
+ return null; // no sub objects either
+ }
+
+ public Node.Property[] createProperties(Sheet sheet, PropertyChangeListener listener) {
+ return null; // do not ask for a prop sheet in tests -> NetBeans domain
+ }
+
+ public boolean hasActions(int type) {
+ return false;
+ }
+
+ public Action[] getActions(boolean context) {
+ return null; // no actions there nothing to get
+ }
+
+ public void setActions(BaseAction actions) {
+ // ignore
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ }
+
+ public MyLanguageAction getMyLanguageAction() {
+ return new MyLanguageAction();
+ }
+
+ public class MyLanguageAction implements BaseAction, LanguageAction {
+ boolean deleteCalled = false;
+ boolean addLangCalled = false;
+ boolean delLangCalled = false;
+ public void deleteAction() {
+ deleteCalled = true;
+ }
+ public void addLanguageAction() {
+ addLangCalled = true;
+ }
+ public void deleteLanguageAction() {
+ delLangCalled = true;
+ }
+ }
+
+}
Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/OpenOfficeOrgBooleanPropertyTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/OpenOfficeOrgBooleanPropertyTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/OpenOfficeOrgBooleanPropertyTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/OpenOfficeOrgBooleanPropertyTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,348 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: OpenOfficeOrgBooleanPropertyTest.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sg $ $Date: 2007/09/04 15:06:45 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util.datamodel.properties;
+
+import junit.framework.*;
+import java.awt.Image;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyEditor;
+import javax.swing.Action;
+import javax.swing.ImageIcon;
+import org.openide.nodes.Node;
+import org.openide.nodes.Sheet;
+import org.openide.util.Utilities;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+import org.openoffice.extensions.util.datamodel.actions.BaseAction;
+
+/**
+ *
+ * @author sg128468
+ */
+public class OpenOfficeOrgBooleanPropertyTest extends TestCase {
+
+ private ObjectHelperImplementations m_objectHelper;
+
+ public OpenOfficeOrgBooleanPropertyTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ m_objectHelper = new ObjectHelperImplementations();
+ }
+
+ protected void tearDown() throws Exception {
+ m_objectHelper = null;
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(OpenOfficeOrgBooleanPropertyTest.class);
+
+ return suite;
+ }
+
+ /**
+ * Test of isLocalized method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testIsLocalized() {
+ System.out.println("isLocalized");
+
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ boolean expResult = false;
+ boolean result = instance.isLocalized();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getPropertyName method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testGetPropertyName() {
+ System.out.println("getPropertyName");
+
+ String expResult = "my name";
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ expResult, true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ String result = instance.getPropertyName();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of setPropertyName method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testSetPropertyName() {
+ System.out.println("setPropertyName");
+
+ String name = "my other name";
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setPropertyName(name);
+
+ String result = instance.getPropertyName();
+ assertEquals(name, result);
+ }
+
+ /**
+ * Test of getDescription method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testGetDescription() {
+ System.out.println("getDescription");
+
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ String expResult = "the real description";
+
+ instance.setDescription(expResult);
+ String result = instance.getDescription();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of setDescription method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testSetDescription() {
+ System.out.println("setDescription");
+
+ String expResult = "the real description";
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setDescription(expResult);
+
+ String result = instance.getDescription();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of setValue method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testSetValue() {
+ System.out.println("setValue");
+
+ boolean value = false;
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setValue(value);
+
+ boolean expResult = false;
+ boolean result = instance.getValue();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getValue method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testGetValue() {
+ System.out.println("getValue");
+
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ boolean expResult = true;
+ boolean result = instance.getValue();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getValueForLanguage method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testGetValueForLanguage() throws Exception {
+ System.out.println("getValueForLanguage");
+
+ int langID = 0;
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ boolean expResult = true;
+ String result = instance.getValueForLanguage(langID);
+ assertEquals(expResult, Boolean.parseBoolean(result));
+ }
+
+ /**
+ * Test of removeValueForLanguage method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testRemoveValueForLanguage() throws Exception {
+ System.out.println("removeValueForLanguage");
+
+ int langID = 0;
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.removeValueForLanguage(langID); // empty implemented!
+ }
+
+ /**
+ * Test of setValueForLanguage method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testSetValueForLanguage() throws Exception {
+ System.out.println("setValueForLanguage");
+
+ int langID = 0;
+ String value = "false";
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setValueForLanguage(langID, value);
+ boolean expResult = false;
+ assertEquals(expResult, instance.getValue());
+
+ value = "true";
+ instance.setValueForLanguage(langID, value);
+ expResult = true;
+ assertEquals(expResult, instance.getValue());
+ }
+
+ /**
+ * Test of getParent method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testGetParent() {
+ System.out.println("getParent");
+
+ NbNodeObject parent = m_objectHelper.getMockNbNodeObject();
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", parent, null);
+
+ NbNodeObject expResult = parent;
+ NbNodeObject result = instance.getParent();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getDisplayName method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testGetDisplayName() {
+ System.out.println("getDisplayName");
+
+ String expResult = "my name";
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ expResult, true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ String result = instance.getDisplayName(); // does not really have a display name, equals name
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getAllSubObjects method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testGetAllSubObjects() {
+ System.out.println("getAllSubObjects");
+
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ NbNodeObject[] result = instance.getAllSubObjects();
+ assertNull(result); // no sub objects: returns null
+ }
+
+ /**
+ * Test of createProperties method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testCreateProperties() {
+ System.out.println("createProperties");
+
+ Sheet sheet = null;
+ PropertyChangeListener listener = null;
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ // does not compile?
+// Node.Property[] expResult = new LocalizedProperty(LanguageDefinition.LANGUAGE_ID_en);
+ int expResult = 1;
+ Node.Property[] result = instance.createProperties(null, null);
+ assertEquals(expResult, result.length);
+ }
+
+ /**
+ * Test of hasActions method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testHasActions() {
+ System.out.println("hasActions");
+
+ int type = 0;
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ boolean expResult = false;
+ boolean result = instance.hasActions(type);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getActions method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testGetActions() {
+ System.out.println("getActions");
+
+ boolean context = true;
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ assertNull(instance.getActions(true));
+ }
+
+ /**
+ * Test of setActions method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testSetActions() {
+ System.out.println("setActions");
+
+ BaseAction actions = null;
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setActions(actions); // empty
+ }
+
+ /**
+ * Test of getType method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanProperty.
+ */
+ public void testGetType() {
+ System.out.println("getType");
+
+ OpenOfficeOrgBooleanProperty instance = new OpenOfficeOrgBooleanProperty(
+ "my name", true, "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ int expResult = NbNodeObject.PROPERTY_TYPE;
+ int result = instance.getType();
+ assertEquals(expResult, result);
+ }
+
+}
Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/OpenOfficeOrgIconPropertyTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/OpenOfficeOrgIconPropertyTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/OpenOfficeOrgIconPropertyTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/OpenOfficeOrgIconPropertyTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,334 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: OpenOfficeOrgIconPropertyTest.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sg $ $Date: 2007/09/04 15:06:45 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util.datamodel.properties;
+
+import junit.framework.*;
+import java.awt.Image;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyEditor;
+import java.io.File;
+import java.io.IOException;
+import javax.imageio.ImageIO;
+import javax.swing.Action;
+import javax.swing.ImageIcon;
+import org.openide.nodes.Node;
+import org.openide.nodes.Sheet;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+import org.openoffice.extensions.util.datamodel.actions.BaseAction;
+
+/**
+ *
+ * @author sg128468
+ */
+public class OpenOfficeOrgIconPropertyTest extends TestCase {
+
+ private ObjectHelperImplementations m_objectHelper;
+
+ public OpenOfficeOrgIconPropertyTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ m_objectHelper = new ObjectHelperImplementations();
+ }
+
+ protected void tearDown() throws Exception {
+ m_objectHelper = null;
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(OpenOfficeOrgIconPropertyTest.class);
+
+ return suite;
+ }
+
+ /**
+ * Test of isLocalized method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testIsLocalized() {
+ System.out.println("isLocalized");
+
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ boolean expResult = false;
+ boolean result = instance.isLocalized();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getPropertyName method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testGetPropertyName() {
+ System.out.println("getPropertyName");
+
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ String expResult = "a name";
+ String result = instance.getPropertyName();
+ assertEquals(expResult, result);
+
+ }
+
+ /**
+ * Test of setPropertyName method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testSetPropertyName() {
+ System.out.println("setPropertyName");
+
+ String name = "new name";
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setPropertyName(name);
+
+ String expResult = name;
+ String result = instance.getPropertyName();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getDescription method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testGetDescription() {
+ System.out.println("getDescription");
+
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ String expResult = "a description";
+ String result = instance.getDescription();
+ assertEquals(expResult, result);
+
+ }
+
+ /**
+ * Test of setDescription method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testSetDescription() {
+ System.out.println("setDescription");
+
+ String description = "new description";
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setDescription(description);
+
+ String expResult = description;
+ String result = instance.getDescription();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getImage method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testGetImage() {
+ System.out.println("getImage");
+
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+// Image expResult = null;
+ Image result = instance.getImage();
+ assertNotNull(result); // not a valid image with the constructor
+
+ }
+
+ /**
+ * Test of getValueForLanguage method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testGetValueForLanguage() throws Exception {
+ System.out.println("getValueForLanguage");
+
+ int langID = 0;
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ String expResult = "a path";
+ String result = instance.getValueForLanguage(langID);
+ assertEquals(expResult, result);
+
+ }
+
+ /**
+ * Test of removeValueForLanguage method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testRemoveValueForLanguage() throws Exception {
+ System.out.println("removeValueForLanguage");
+
+ int langID = 0;
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.removeValueForLanguage(langID); // not easily testable
+ }
+
+ /**
+ * Test of setValueForLanguage method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testSetValueForLanguage() throws Exception {
+ System.out.println("setValueForLanguage");
+
+ int langID = 0;
+ String value = "";
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setValueForLanguage(langID, value);// not easily testable
+
+ }
+
+ /**
+ * Test of getParent method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testGetParent() {
+ System.out.println("getParent");
+
+ NbNodeObject parent = m_objectHelper.getMockNbNodeObject();
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", parent, null);
+
+ NbNodeObject expResult = parent;
+ NbNodeObject result = instance.getParent();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getDisplayName method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testGetDisplayName() {
+ System.out.println("getDisplayName");
+
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ String expResult = "a name";
+ String result = instance.getDisplayName();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getAllSubObjects method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testGetAllSubObjects() {
+ System.out.println("getAllSubObjects");
+
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+// NbNodeObject[] expResult = null;
+ NbNodeObject[] result = instance.getAllSubObjects();
+ assertNull(result);
+
+ }
+
+ /**
+ * Test of createProperties method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testCreateProperties() {
+ System.out.println("createProperties");
+
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ int expResult = 1;
+ Node.Property[] result = instance.createProperties(null, null);
+ assertEquals(expResult, result.length);
+
+ }
+
+ /**
+ * Test of hasActions method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testHasActions() {
+ System.out.println("hasActions");
+
+ int type = 0;
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ boolean expResult = false;
+ boolean result = instance.hasActions(type);
+ assertEquals(expResult, result);
+
+ }
+
+ /**
+ * Test of getActions method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testGetActions() {
+ System.out.println("getActions");
+
+ boolean context = true;
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+// Action[] expResult = null;
+ Action[] result = instance.getActions(context);
+ assertNull(result);
+
+ }
+
+ /**
+ * Test of setActions method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testSetActions() {
+ System.out.println("setActions");
+
+ BaseAction actions = null;
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setActions(actions); // empty implemented
+ }
+
+ /**
+ * Test of getType method, of class org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconProperty.
+ */
+ public void testGetType() {
+ System.out.println("getType");
+
+ OpenOfficeOrgIconProperty instance = new OpenOfficeOrgIconProperty(
+ "a name", "a path", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ int expResult = NbNodeObject.PROPERTY_TYPE;
+ int result = instance.getType();
+ assertEquals(expResult, result);
+ }
+
+}
Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/PropertiesSuite.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/PropertiesSuite.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/PropertiesSuite.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/PropertiesSuite.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: PropertiesSuite.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sg $ $Date: 2007/09/04 15:06:46 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util.datamodel.properties;
+
+import junit.framework.*;
+
+/**
+ *
+ * @author sg128468
+ */
+public class PropertiesSuite extends TestCase {
+
+ public PropertiesSuite(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ /**
+ * suite method automatically generated by JUnit module
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite("PropertiesSuite");
+ suite.addTest(org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgIconPropertyTest.suite());
+ suite.addTest(org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgPropertyTest.suite());
+ suite.addTest(org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgPropertyTest.suite());
+ suite.addTest(org.openoffice.extensions.util.datamodel.properties.OpenOfficeOrgBooleanPropertyTest.suite());
+ return suite;
+ }
+}
Added: incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/SimpleOpenOfficeOrgPropertyTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/SimpleOpenOfficeOrgPropertyTest.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/SimpleOpenOfficeOrgPropertyTest.java (added)
+++ incubator/ooo/devtools/netbeansintegration/test/unit/src/org/openoffice/extensions/util/datamodel/properties/SimpleOpenOfficeOrgPropertyTest.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,316 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: SimpleOpenOfficeOrgPropertyTest.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sg $ $Date: 2007/09/04 15:06:45 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.util.datamodel.properties;
+
+import junit.framework.*;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyEditor;
+import javax.swing.Action;
+import org.openide.nodes.Node;
+import org.openide.nodes.Sheet;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.*;
+import org.openoffice.extensions.util.datamodel.actions.BaseAction;
+
+/**
+ *
+ * @author sg128468
+ */
+public class SimpleOpenOfficeOrgPropertyTest extends TestCase {
+
+ private ObjectHelperImplementations m_objectHelper;
+
+ public SimpleOpenOfficeOrgPropertyTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ m_objectHelper = new ObjectHelperImplementations();
+ }
+
+ protected void tearDown() throws Exception {
+ m_objectHelper = null;
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(SimpleOpenOfficeOrgPropertyTest.class);
+
+ return suite;
+ }
+
+ /**
+ * Test of isLocalized method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testIsLocalized() {
+ System.out.println("isLocalized");
+
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ boolean expResult = false;
+ boolean result = instance.isLocalized();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getPropertyName method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testGetPropertyName() {
+ System.out.println("getPropertyName");
+
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ String expResult = "a name";
+ String result = instance.getPropertyName();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of setPropertyName method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testSetPropertyName() {
+ System.out.println("setPropertyName");
+
+ String name = "a new name";
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setPropertyName(name);
+
+ String expResult = name;
+ String result = instance.getPropertyName();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getValueForLanguage method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testGetValueForLanguage() {
+ System.out.println("getValueForLanguage");
+
+ int langID = -1;
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ String expResult = "a value";
+ String result = instance.getValueForLanguage(langID);
+ assertEquals(expResult, result);
+
+ }
+
+ /**
+ * Test of setValueForLanguage method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testSetValueForLanguage() {
+ System.out.println("setValueForLanguage");
+
+ int langID = -1;
+ String value = "new value";
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setValueForLanguage(langID, value);
+
+ String expResult = value;
+ String result = instance.getValueForLanguage(langID);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of removeValueForLanguage method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testRemoveValueForLanguage() {
+ System.out.println("removeValueForLanguage");
+
+ int langID = 0;
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.removeValueForLanguage(langID);
+
+ String result = instance.getValueForLanguage(langID);
+ assertNull(result);
+ }
+
+ /**
+ * Test of getDescription method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testGetDescription() {
+ System.out.println("getDescription");
+
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ String expResult = "a description";
+ String result = instance.getDescription();
+ assertEquals(expResult, result);
+
+ }
+
+ /**
+ * Test of setDescription method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testSetDescription() {
+ System.out.println("setDescription");
+
+ String description = "new description";
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setDescription(description);
+
+ String expResult = description;
+ String result = instance.getDescription();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getDisplayName method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testGetDisplayName() {
+ System.out.println("getDisplayName");
+
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ String expResult = "a name";
+ String result = instance.getDisplayName();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of hasActions method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testHasActions() {
+ System.out.println("hasActions");
+
+ int type = 0;
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ boolean expResult = false;
+ boolean result = instance.hasActions(type);
+ assertEquals(expResult, result);
+
+ }
+
+ /**
+ * Test of getActions method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testGetActions() {
+ System.out.println("getActions");
+
+ boolean b = true;
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+// Action[] expResult = null;
+ Action[] result = instance.getActions(b);
+ assertNull(result);
+ }
+
+ /**
+ * Test of setActions method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testSetActions() {
+ System.out.println("setActions");
+
+ BaseAction actions = null;
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ instance.setActions(actions);
+ }
+
+ /**
+ * Test of getAllSubObjects method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testGetAllSubObjects() {
+ System.out.println("getAllSubObjects");
+
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+// NbNodeObject[] expResult = null;
+ NbNodeObject[] result = instance.getAllSubObjects();
+ assertNull(result);
+ }
+
+ /**
+ * Test of createProperties method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testCreateProperties() {
+ System.out.println("createProperties");
+
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ int expResult = 1;
+ Node.Property[] result = instance.createProperties(null, null);
+ assertEquals(expResult, result.length);
+ }
+
+ /**
+ * Test of getParent method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testGetParent() {
+ System.out.println("getParent");
+
+ NbNodeObject parent = m_objectHelper.getMockNbNodeObject();
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", parent, null);
+
+ NbNodeObject expResult = parent;
+ NbNodeObject result = instance.getParent();
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getType method, of class org.openoffice.extensions.util.datamodel.properties.SimpleOpenOfficeOrgProperty.
+ */
+ public void testGetType() {
+ System.out.println("getType");
+
+ SimpleOpenOfficeOrgProperty instance = new SimpleOpenOfficeOrgProperty(
+ "a name", "a value", "a description", m_objectHelper.getMockNbNodeObject(), null);
+
+ int expResult = NbNodeObject.PROPERTY_TYPE;
+ int result = instance.getType();
+ assertEquals(expResult, result);
+ }
+
+}