1 /*
   2  * Copyright (c) 2007, 2017 Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.jemmy;
  24 
  25 
  26 import org.testng.annotations.Test;
  27 
  28 import static org.testng.Assert.assertEquals;
  29 
  30 /**
  31  *
  32  * @author mrkam
  33  */
  34 public class RectangleTest {
  35 
  36     /**
  37      * Test of parseRectangle method, of class Rectangle.
  38      */
  39     @Test
  40     public void testParseRectangle() {
  41         System.out.println("parseRectangle");
  42         Rectangle[] rr = new Rectangle [] {
  43             new Rectangle(),
  44             new Rectangle(new Dimension(15.0, 16.1)),
  45             new Rectangle(new Point(-3, 0.0)),
  46             new Rectangle(new Rectangle(8, 9, 5, 6.3)),
  47             new Rectangle(new Point(2.0 / 3.0, Math.PI),
  48                     new Dimension(Math.E, Double.NaN)),
  49             new Rectangle(4, Integer.MAX_VALUE),
  50             new Rectangle(Double.NEGATIVE_INFINITY, Double.MIN_NORMAL,
  51                     Double.MAX_VALUE, Double.POSITIVE_INFINITY),
  52             new Rectangle(Integer.MIN_VALUE, 12345, -999, 0)
  53         };
  54         for(Rectangle r : rr) {
  55             String str = r.toString();
  56             Rectangle expResult = r;
  57             Rectangle result = Rectangle.parseRectangle(str);
  58             assertEquals(result, expResult);
  59         }
  60     }
  61 }
  62