harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r500809 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/text/html/ main/java/common/org/apache/harmony/x/swing/internal/nls/ test/api/java/common/javax/swing/text/html/
Date Sun, 28 Jan 2007 15:24:01 GMT
Author: apetrenko
Date: Sun Jan 28 07:24:00 2007
New Revision: 500809

URL: http://svn.apache.org/viewvc?view=rev&rev=500809
Log:
Patch for HARMONY-1792 "[classlib][swing]javax.swing.tex.htmlFormView.getMaximumSpan(int axis)
does not throw IllegalArgumentException for invalid axis"

Added:
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/FormViewTest.java
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/FormView.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/FormView.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/FormView.java?view=diff&rev=500809&r1=500808&r2=500809
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/FormView.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/FormView.java
Sun Jan 28 07:24:00 2007
@@ -47,6 +47,7 @@
 import org.apache.harmony.x.swing.text.html.form.FormSelectListModel;
 import org.apache.harmony.x.swing.text.html.form.FormTextModel;
 import org.apache.harmony.x.swing.text.html.form.FormToggleButtonModel;
+import org.apache.harmony.x.swing.internal.nls.Messages;
 
 public class FormView extends ComponentView implements ActionListener {
     private static final int EMPTY_SPAN = 0;
@@ -74,6 +75,9 @@
     }
 
     public float getMaximumSpan(final int axis) {
+        if (axis != View.X_AXIS && axis != View.Y_AXIS) {
+            throw new IllegalArgumentException(Messages.getString("swing.00", axis)); //$NON-NLS-1$
+        }
         if (getComponent() == null || getParent() == null) {
             return EMPTY_SPAN;
         }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties?view=diff&rev=500809&r1=500808&r2=500809
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties
Sun Jan 28 07:24:00 2007
@@ -15,3 +15,4 @@
 # 
 
 # messages for EN locale
+swing.00=Invalid axis: {0}

Added: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/FormViewTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/FormViewTest.java?view=auto&rev=500809
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/FormViewTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/FormViewTest.java
Sun Jan 28 07:24:00 2007
@@ -0,0 +1,39 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+ 
+package javax.swing.text.html;
+
+import javax.swing.text.Element;
+import javax.swing.text.html.HTMLDocument;
+
+public class FormViewTest extends junit.framework.TestCase { 
+    
+    /**
+     * javax.swing.text.html.FormView
+     */
+	public void testgetMaximumSpan_I(){
+        HTMLDocument doc = new HTMLDocument();
+        Element par=doc.getDefaultRootElement(); 
+        FormView obj=new FormView(par); 
+        try {
+            obj.getMaximumSpan(11);
+            fail("IllegalArgumentException should be thrown");
+        } catch (IllegalArgumentException e) {
+            //expected
+        } 
+    }    
+}
+ 

Propchange: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/FormViewTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message