1 /* 2 * Copyright (c) 2011, 2013, 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. Oracle designates this 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 test.javafx.scene.input; 27 28 import org.junit.Ignore; 29 import org.junit.Test; 30 31 32 @Ignore("Pasteboard removed, need to move these tests elsewhere") 33 public class PasteboardTest { 34 35 @Test 36 public void testDefaultPasteboard() { 37 // Pasteboard pb = new Pasteboard(); 38 // assertNull(pb.getContentType()); 39 // assertNull(pb.getContent()); 40 // assertNull(pb.getContent(null)); 41 // assertNull(pb.getContent(DataFormat.DATA)); 42 // assertNull(pb.getContent()); 43 // 44 // assertFalse(pb.hasAnyContent()); 45 // assertFalse(pb.hasContent(DataFormat.DATA)); 46 // assertFalse(pb.hasImage()); 47 // assertFalse(pb.hasImages()); 48 // assertFalse(pb.hasFile()); 49 // assertFalse(pb.hasString()); 50 } 51 52 @Test 53 public void testPasteboardString() { 54 // Pasteboard pb = new Pasteboard(); 55 // assertFalse(pb.hasAnyContent()); 56 // assertFalse(pb.hasContent(DataFormat.TEXT)); 57 // assertFalse(pb.hasString()); 58 // 59 // // put in new string to pasteboard 60 // pb.placeString("text"); 61 // assertTrue(pb.hasAnyContent()); 62 // assertTrue(pb.hasContent(DataFormat.TEXT)); 63 // assertTrue(pb.hasString()); 64 // assertEquals("text", pb.getString()); 65 // 66 // // replace it with a different string 67 // pb.placeString("newText"); 68 // assertTrue(pb.hasAnyContent()); 69 // assertTrue(pb.hasContent(DataFormat.TEXT)); 70 // assertTrue(pb.hasString()); 71 // assertEquals("newText", pb.getString()); 72 // 73 // // A String is DataFormat.TEXT, it may or may not be plain text, so 74 // // after placing a string, this should be false. 75 // assertFalse(pb.hasContent(DataFormat.PLAIN_TEXT)); 76 // 77 // pb.clear(); 78 // 79 // assertFalse(pb.hasAnyContent()); 80 // assertFalse(pb.hasContent(DataFormat.TEXT)); 81 // assertFalse(pb.hasString()); 82 } 83 84 /* 85 * This test depends on StubToolkit.loadImage working, which at this point 86 * it doesn't. 87 */ 88 89 // public function testPasteboardImage() { 90 // var pb = Pasteboard { }; 91 // assertFalse(pb.hasAnyContent()); 92 // assertFalse(pb.hasContent(DataFormat.TEXT)); 93 // assertFalse(pb.hasContent(DataFormat.IMAGE)); 94 // assertFalse(pb.hasString()); 95 // assertFalse(pb.hasImage()); 96 // 97 // // create an image - even if the URL isn't valid 98 // var image = Image { 99 // url: "{__DIR__}JavaFX.png" 100 // } 101 // 102 // assertNotNull(image); 103 // 104 // pb.placeImage(image); 105 // assertTrue(pb.hasAnyContent()); 106 // assertTrue(pb.hasContent(DataFormat.IMAGE)); 107 // assertEquals(image, pb.getImage()); 108 // 109 // assertFalse(pb.hasImages()); 110 // 111 // // as much as we'd like to know that it is a PNG image, we can't be 112 // // certain - all we know is that the image is a DataFormat.IMAGE 113 // assertFalse(pb.hasContent(DataFormat.IMAGE_PNG)); 114 // assertFalse(pb.hasString()); 115 // 116 // pb.clear(); 117 // assertFalse(pb.hasAnyContent()); 118 // assertFalse(pb.hasContent(DataFormat.TEXT)); 119 // assertFalse(pb.hasContent(DataFormat.IMAGE)); 120 // assertFalse(pb.hasString()); 121 // assertFalse(pb.hasImage()); 122 // } 123 } 124