author | goetz |
Tue, 14 Jun 2016 10:44:59 +0200 | |
changeset 39056 | d99e63b6d962 |
parent 28995 | 097f07e8324e |
permissions | -rw-r--r-- |
28995
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
1 |
/* |
39056
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
28995
diff
changeset
|
2 |
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. |
28995
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
4 |
* |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
8 |
* |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
13 |
* accompanied this code). |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
14 |
* |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
18 |
* |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
21 |
* questions. |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
22 |
*/ |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
23 |
|
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
24 |
import java.awt.DisplayMode; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
25 |
import java.awt.Frame; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
26 |
import java.awt.GraphicsDevice; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
27 |
import java.util.ArrayList; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
28 |
import java.util.Random; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
29 |
|
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
30 |
import static java.awt.DisplayMode.REFRESH_RATE_UNKNOWN; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
31 |
|
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
32 |
/** |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
33 |
* @test |
39056
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
28995
diff
changeset
|
34 |
* @key headful |
28995
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
35 |
* @bug 6430607 |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
36 |
* @summary Test that we throw an exception for incorrect display modes |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
37 |
* @author Dmitri.Trembovetski@Sun.COM area=FullScreen |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
38 |
* @run main/othervm NonExistentDisplayModeTest |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
39 |
* @run main/othervm -Dsun.java2d.noddraw=true NonExistentDisplayModeTest |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
40 |
* @run main/othervm -Dsun.java2d.opengl=true NonExistentDisplayModeTest |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
41 |
*/ |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
42 |
public class NonExistentDisplayModeTest { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
43 |
|
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
44 |
public static void main(String[] args) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
45 |
new NonExistentDisplayModeTest().start(); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
46 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
47 |
|
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
48 |
private void start() { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
49 |
Frame f = new Frame("Testing, please wait.."); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
50 |
f.pack(); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
51 |
GraphicsDevice gd = f.getGraphicsConfiguration().getDevice(); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
52 |
if (!gd.isFullScreenSupported()) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
53 |
System.out.println("Exclusive FS mode not supported, test passed."); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
54 |
f.dispose(); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
55 |
return; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
56 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
57 |
|
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
58 |
gd.setFullScreenWindow(f); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
59 |
if (!gd.isDisplayChangeSupported()) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
60 |
System.out.println("DisplayMode change not supported, test passed."); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
61 |
f.dispose(); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
62 |
return; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
63 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
64 |
|
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
65 |
DisplayMode dms[] = gd.getDisplayModes(); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
66 |
ArrayList<DisplayMode> dmList = new ArrayList<DisplayMode>(dms.length); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
67 |
for (DisplayMode dm : dms) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
68 |
dmList.add(dm); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
69 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
70 |
|
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
71 |
ArrayList<DisplayMode> nonExistentDms = createNonExistentDMList(dmList); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
72 |
|
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
73 |
for (DisplayMode dm : nonExistentDms) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
74 |
boolean exThrown = false; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
75 |
try { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
76 |
System.out.printf("Testing mode: (%4dx%4d) depth=%3d rate=%d\n", |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
77 |
dm.getWidth(), dm.getHeight(), |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
78 |
dm.getBitDepth(), dm.getRefreshRate()); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
79 |
gd.setDisplayMode(dm); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
80 |
} catch (IllegalArgumentException e) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
81 |
exThrown = true; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
82 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
83 |
if (!exThrown) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
84 |
gd.setFullScreenWindow(null); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
85 |
f.dispose(); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
86 |
throw new |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
87 |
RuntimeException("Failed: No exception thrown for dm "+dm); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
88 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
89 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
90 |
gd.setFullScreenWindow(null); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
91 |
f.dispose(); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
92 |
System.out.println("Test passed."); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
93 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
94 |
|
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
95 |
private static final Random rnd = new Random(); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
96 |
private ArrayList<DisplayMode> |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
97 |
createNonExistentDMList(ArrayList<DisplayMode> dmList) |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
98 |
{ |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
99 |
ArrayList<DisplayMode> newList = |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
100 |
new ArrayList<DisplayMode>(dmList.size()); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
101 |
// vary one parameter at a time |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
102 |
int param = 0; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
103 |
for (DisplayMode dm : dmList) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
104 |
param = ++param % 3; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
105 |
switch (param) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
106 |
case 0: { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
107 |
DisplayMode newDM = deriveSize(dm); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
108 |
if (!dmList.contains(newDM)) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
109 |
newList.add(newDM); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
110 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
111 |
break; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
112 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
113 |
case 1: { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
114 |
DisplayMode newDM = deriveDepth(dm); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
115 |
if (!dmList.contains(newDM)) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
116 |
newList.add(newDM); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
117 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
118 |
break; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
119 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
120 |
case 2: { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
121 |
if (dm.getRefreshRate() != REFRESH_RATE_UNKNOWN) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
122 |
DisplayMode newDM = deriveRR(dm); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
123 |
if (!dmList.contains(newDM)) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
124 |
newList.add(newDM); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
125 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
126 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
127 |
break; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
128 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
129 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
130 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
131 |
return newList; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
132 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
133 |
|
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
134 |
private static DisplayMode deriveSize(DisplayMode dm) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
135 |
int w = dm.getWidth() / 7; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
136 |
int h = dm.getHeight() / 3; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
137 |
return new DisplayMode(w, h, dm.getBitDepth(), dm.getRefreshRate()); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
138 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
139 |
private static DisplayMode deriveRR(DisplayMode dm) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
140 |
return new DisplayMode(dm.getWidth(), dm.getHeight(), |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
141 |
dm.getBitDepth(), 777); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
142 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
143 |
private static DisplayMode deriveDepth(DisplayMode dm) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
144 |
int depth; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
145 |
if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI) { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
146 |
depth = 77; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
147 |
} else { |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
148 |
depth = DisplayMode.BIT_DEPTH_MULTI; |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
149 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
150 |
return new DisplayMode(dm.getWidth(), dm.getHeight(), |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
151 |
depth, dm.getRefreshRate()); |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
152 |
} |
097f07e8324e
7185221: [macosx] Regtest should not throw exception if a suitable display mode found
serb
parents:
diff
changeset
|
153 |
} |