modules/graphics/src/test/java/javafx/scene/shape/SVGPathTest.java

Print this page
rev 6167 : RT-35330 [Monocle] Remove StubToolkit and replace it with headless glass implementation


   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.scene.shape;
  27 

  28 import com.sun.javafx.geom.Path2D;
  29 import com.sun.javafx.pgstub.SVGPathImpl;
  30 import com.sun.javafx.sg.prism.NGNode;
  31 import com.sun.javafx.sg.prism.NGSVGPath;
  32 import javafx.beans.property.SimpleStringProperty;
  33 import javafx.beans.property.StringProperty;
  34 import javafx.scene.NodeTest;

  35 import org.junit.Test;
  36 
  37 import static org.junit.Assert.*;
  38 
  39 public class SVGPathTest {
  40     



  41     @Test public void testBoundPropertySync_Content() throws Exception {
  42         StubSVGPath svgPath = new StubSVGPath();
  43         svgPath.setContent("M40,60 C42,48 44,30 25,32");
  44 
  45         StringProperty content = new SimpleStringProperty();
  46         svgPath.contentProperty().bind(content);
  47         String s = "M11,11 C22,22 33,33";
  48         content.set(s);
  49         NodeTest.syncNode(svgPath);
  50 
  51         SVGPathImpl geometry = ((StubNGSVGPath) svgPath.impl_getPeer()).geometry;
  52         assertEquals(s, geometry.getContent());
  53     }
  54 
  55     @Test
  56     public void testDefaultValues() {
  57         StubSVGPath svgPath = new StubSVGPath();
  58         assertEquals("", svgPath.getContent());
  59         assertEquals("", svgPath.contentProperty().get());
  60         assertEquals(FillRule.NON_ZERO, svgPath.getFillRule());




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.scene.shape;
  27 
  28 import com.sun.javafx.FXUnit;
  29 import com.sun.javafx.geom.Path2D;
  30 import com.sun.javafx.pgstub.SVGPathImpl;
  31 import com.sun.javafx.sg.prism.NGNode;
  32 import com.sun.javafx.sg.prism.NGSVGPath;
  33 import javafx.beans.property.SimpleStringProperty;
  34 import javafx.beans.property.StringProperty;
  35 import javafx.scene.NodeTest;
  36 import org.junit.Rule;
  37 import org.junit.Test;
  38 
  39 import static org.junit.Assert.*;
  40 
  41 public class SVGPathTest {
  42 
  43     @Rule
  44     public FXUnit fx = new FXUnit();
  45     
  46     @Test public void testBoundPropertySync_Content() throws Exception {
  47         StubSVGPath svgPath = new StubSVGPath();
  48         svgPath.setContent("M40,60 C42,48 44,30 25,32");
  49 
  50         StringProperty content = new SimpleStringProperty();
  51         svgPath.contentProperty().bind(content);
  52         String s = "M11,11 C22,22 33,33";
  53         content.set(s);
  54         NodeTest.syncNode(svgPath);
  55 
  56         SVGPathImpl geometry = ((StubNGSVGPath) svgPath.impl_getPeer()).geometry;
  57         assertEquals(s, geometry.getContent());
  58     }
  59 
  60     @Test
  61     public void testDefaultValues() {
  62         StubSVGPath svgPath = new StubSVGPath();
  63         assertEquals("", svgPath.getContent());
  64         assertEquals("", svgPath.contentProperty().get());
  65         assertEquals(FillRule.NON_ZERO, svgPath.getFillRule());