author | yan |
Tue, 23 Jun 2015 11:59:27 +0300 | |
changeset 31448 | 1066345d2a8a |
parent 25569 | 2bea87828632 |
permissions | -rw-r--r-- |
25569
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
1 |
/* |
31448
1066345d2a8a
8076468: Add @modules to tests in jdk_desktop test group
yan
parents:
25569
diff
changeset
|
2 |
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. |
25569
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
4 |
* |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
10 |
* |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
15 |
* accompanied this code). |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
16 |
* |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
20 |
* |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
23 |
* questions. |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
24 |
*/ |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
25 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
26 |
import java.awt.datatransfer.DataFlavor; |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
27 |
import java.awt.datatransfer.SystemFlavorMap; |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
28 |
import java.util.*; |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
29 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
30 |
/* |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
31 |
* @test |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
32 |
* @summary To test SystemFlavorMap methods |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
33 |
* List getFlavorsForNative(String nat) |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
34 |
* List getNativesForFlavor(DataFlavor flav) |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
35 |
* with valid natives and DataFlavors, including null. |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
36 |
* This test will verify that the returned mappings |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
37 |
* include all entries and that the correct order is |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
38 |
* maintained. |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
39 |
* @author Rick Reynaga (rick.reynaga@eng.sun.com) area=Clipboard |
31448
1066345d2a8a
8076468: Add @modules to tests in jdk_desktop test group
yan
parents:
25569
diff
changeset
|
40 |
* @modules java.datatransfer |
25569
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
41 |
* @run main ManyFlavorMapTest |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
42 |
*/ |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
43 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
44 |
public class ManyFlavorMapTest { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
45 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
46 |
SystemFlavorMap flavorMap; |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
47 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
48 |
Map mapFlavors; |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
49 |
Map mapNatives; |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
50 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
51 |
Hashtable hashFlavors; |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
52 |
Hashtable hashNatives; |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
53 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
54 |
public static void main (String[] args) { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
55 |
new ManyFlavorMapTest().doTest(); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
56 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
57 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
58 |
public void doTest() { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
59 |
flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap(); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
60 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
61 |
// Get SystemFlavorMap Maps of String Natives and DataFlavors |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
62 |
mapFlavors = flavorMap.getNativesForFlavors(null); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
63 |
mapNatives = flavorMap.getFlavorsForNatives(null); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
64 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
65 |
hashFlavors = new Hashtable(mapFlavors); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
66 |
hashNatives = new Hashtable(mapNatives); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
67 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
68 |
// Assertion: Verify getNativesForFlavors(null) is returning the full list |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
69 |
// of String Native entries |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
70 |
List listNatives = flavorMap.getNativesForFlavor(null); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
71 |
verifyListAllNativeEntries(listNatives); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
72 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
73 |
// Assertion: Verify getFlavorsForNatives(null) is returning the full list |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
74 |
// of DataFlavor entries |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
75 |
List listFlavors = flavorMap.getFlavorsForNative(null); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
76 |
verifyListAllDataFlavorEntries(listFlavors); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
77 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
78 |
// Assertion: Verify getNativesForFlavor(DataFlavor flav) is returning the list |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
79 |
// of Native Strings (for all supported DataFlavors) |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
80 |
// |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
81 |
// Verify that the first list item is the most preferred Native |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
82 |
verifyListNativeEntries(); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
83 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
84 |
// Assertion: Verify getFlavorsForNative(String nat) is returning the list |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
85 |
// of DataFlavors(for all supported natives) |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
86 |
// |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
87 |
// Verify that the first list item is the most preferred DataFlavor |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
88 |
verifyListDataFlavorEntries(); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
89 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
90 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
91 |
// Verify getFlavorsForNative(String nat) is returning the list |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
92 |
// of DataFlavors(for all supported natives) |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
93 |
public void verifyListDataFlavorEntries() { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
94 |
// Enumerate through all natives |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
95 |
for (Enumeration e = hashNatives.keys() ; e.hasMoreElements() ;) { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
96 |
String key = (String)e.nextElement(); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
97 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
98 |
// SystemFlavorMap preferred value |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
99 |
DataFlavor value = (DataFlavor)hashNatives.get(key); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
100 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
101 |
java.util.List listFlavors = flavorMap.getFlavorsForNative(key); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
102 |
Vector vectorFlavors = new Vector(listFlavors); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
103 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
104 |
// First element should be preferred value |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
105 |
DataFlavor prefFlavor = (DataFlavor)vectorFlavors.firstElement(); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
106 |
if ( value != prefFlavor ) { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
107 |
throw new RuntimeException("\n*** Error in verifyListDataFlavorEntries()" + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
108 |
"\nAPI Test: List getFlavorsForNative(String nat)" + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
109 |
"\native: " + key + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
110 |
"\nSystemFlavorMap preferred native: " + value.getMimeType() + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
111 |
"\nList first entry: " + prefFlavor.getMimeType() + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
112 |
"\nTest failed because List first entry does not match preferred"); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
113 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
114 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
115 |
System.out.println("*** native size = " + hashNatives.size()); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
116 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
117 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
118 |
// Verify getNativesForFlavor(DataFlavor flav) is returning the list |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
119 |
// of Native Strings (for all supported DataFlavors) |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
120 |
public void verifyListNativeEntries() { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
121 |
// Enumerate through all DataFlavors |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
122 |
for (Enumeration e = hashFlavors.keys() ; e.hasMoreElements() ;) { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
123 |
DataFlavor key = (DataFlavor)e.nextElement(); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
124 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
125 |
// SystemFlavorMap preferred value |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
126 |
String value = (String)hashFlavors.get(key); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
127 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
128 |
java.util.List listNatives = flavorMap.getNativesForFlavor(key); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
129 |
Vector vectorNatives = new Vector(listNatives); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
130 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
131 |
// First element should be preferred value |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
132 |
String prefNative = (String)vectorNatives.firstElement(); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
133 |
if ( value != prefNative ) { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
134 |
throw new RuntimeException("\n*** Error in verifyListNativeEntries()" + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
135 |
"\nAPI Test: List getNativesForFlavor(DataFlavor flav)" + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
136 |
"\nDataFlavor: " + key.getMimeType() + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
137 |
"\nSystemFlavorMap preferred native: " + value + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
138 |
"\nList first entry: " + prefNative + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
139 |
"\nTest failed because List first entry does not match preferred"); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
140 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
141 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
142 |
System.out.println("*** DataFlavor size = " + hashFlavors.size()); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
143 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
144 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
145 |
// Compare List of Natives with list from SystemFlavorMap |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
146 |
// |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
147 |
// Verification will be done by comparing the two results as sets |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
148 |
public void verifyListAllNativeEntries(java.util.List listNatives) { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
149 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
150 |
HashSet hashSetMap = new HashSet(mapNatives.keySet()); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
151 |
HashSet hashSetList = new HashSet(listNatives); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
152 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
153 |
System.out.println("*** hashSetMap size = " + hashSetMap.size()); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
154 |
System.out.println("*** hashSetList size = " + hashSetList.size()); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
155 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
156 |
if (!hashSetMap.equals(hashSetList)) { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
157 |
throw new RuntimeException("\n*** Error in verifyListAllNativeEntries()" + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
158 |
"\nAPI Test: List getNativesForFlavor(null)" + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
159 |
"\nTest failed because the returned List does not exactly" + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
160 |
"\nmatch objects returned from SystemFlavorMap."); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
161 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
162 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
163 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
164 |
// Compare List of DataFlavors with list from SystemFlavorMap |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
165 |
// |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
166 |
// Verification will be done by comparing the two results as sets |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
167 |
public void verifyListAllDataFlavorEntries(java.util.List listFlavors) { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
168 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
169 |
HashSet hashSetMap = new HashSet(mapFlavors.keySet()); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
170 |
HashSet hashSetList = new HashSet(listFlavors); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
171 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
172 |
System.out.println("*** hashSetMap size = " + hashSetMap.size()); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
173 |
System.out.println("*** hashSetList size = " + hashSetList.size()); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
174 |
|
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
175 |
if (!hashSetMap.equals(hashSetList)) { |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
176 |
throw new RuntimeException("\n*** Error in verifyListAllDataFlavorEntries()" + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
177 |
"\nAPI Test: List getFlavorsForNative(null)" + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
178 |
"\nTest failed because the returned List does not exactly" + |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
179 |
"\nmatch objects returned from SystemFlavorMap."); |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
180 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
181 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
182 |
} |
2bea87828632
8048246: Move AWT_DnD/Clipboard/Automated functional tests to OpenJDK
yan
parents:
diff
changeset
|
183 |