Skip to content

Commit 1c7e616

Browse files
committed
Use JUnit4 and skip DXVA tests without a physical monitor.
1 parent ea2ccff commit 1c7e616

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

contrib/platform/nbproject/project.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ dist.jar=${dist.dir}/jna-platform.jar
1818
dist.javadoc.dir=${dist.dir}/javadoc
1919
file.reference.jna.jar=../../build/jna.jar
2020
file.reference.jna-test.jar=../../build/jna-test.jar
21-
libs.junit.classpath=../../lib/junit.jar
21+
libs.junit.classpath=\
22+
../../lib/junit.jar:\
23+
../../lib/hamcrest-core-1.3.jar
2224
jar.compress=false
2325
javac.classpath=\
2426
${file.reference.jna.jar}:\

contrib/platform/test/com/sun/jna/platform/win32/Dxva2Test.java

+20-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
package com.sun.jna.platform.win32;
1818

19-
import junit.framework.TestCase;
19+
import org.junit.*;
20+
import static org.junit.Assert.*;
21+
import static org.junit.Assume.*;
2022

2123
import com.sun.jna.Memory;
2224
import com.sun.jna.platform.win32.Dxva2;
@@ -41,12 +43,12 @@
4143
/**
4244
* @author Martin Steiger
4345
*/
44-
public class Dxva2Test extends TestCase {
46+
public class Dxva2Test {
4547

4648
private int monitorCount;
4749
private PHYSICAL_MONITOR[] physMons;
4850

49-
@Override
51+
@Before
5052
public void setUp()
5153
{
5254
HMONITOR hMonitor = User32.INSTANCE.MonitorFromPoint(new POINT(0, 0), WinUser.MONITOR_DEFAULTTOPRIMARY);
@@ -56,15 +58,17 @@ public void setUp()
5658

5759
monitorCount = pdwNumberOfPhysicalMonitors.getValue().intValue();
5860
physMons = new PHYSICAL_MONITOR[monitorCount];
59-
assertTrue(Dxva2.INSTANCE.GetPhysicalMonitorsFromHMONITOR(hMonitor, monitorCount, physMons).booleanValue());
61+
62+
assumeTrue(Dxva2.INSTANCE.GetPhysicalMonitorsFromHMONITOR(hMonitor, monitorCount, physMons).booleanValue());
6063
}
6164

62-
@Override
65+
@After
6366
public void tearDown()
6467
{
65-
assertTrue(Dxva2.INSTANCE.DestroyPhysicalMonitors(monitorCount, physMons).booleanValue());
68+
Dxva2.INSTANCE.DestroyPhysicalMonitors(monitorCount, physMons);
6669
}
6770

71+
@Test
6872
public void testGetMonitorTechnologyType()
6973
{
7074
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
@@ -75,6 +79,7 @@ public void testGetMonitorTechnologyType()
7579
Dxva2.INSTANCE.GetMonitorTechnologyType(hPhysicalMonitor, techType);
7680
}
7781

82+
@Test
7883
public void testGetMonitorCapabilities()
7984
{
8085
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
@@ -86,6 +91,7 @@ public void testGetMonitorCapabilities()
8691
Dxva2.INSTANCE.GetMonitorCapabilities(hPhysicalMonitor, caps, temps);
8792
}
8893

94+
@Test
8995
public void testGetMonitorBrightness()
9096
{
9197
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
@@ -98,6 +104,7 @@ public void testGetMonitorBrightness()
98104
Dxva2.INSTANCE.GetMonitorBrightness(hPhysicalMonitor, pdwMinimumBrightness, pdwCurrentBrightness, pdwMaximumBrightness);
99105
}
100106

107+
@Test
101108
public void testGetMonitorContrast()
102109
{
103110
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
@@ -110,6 +117,7 @@ public void testGetMonitorContrast()
110117
Dxva2.INSTANCE.GetMonitorContrast(hPhysicalMonitor, pdwMinimumContrast, pdwCurrentContrast, pdwMaximumContrast);
111118
}
112119

120+
@Test
113121
public void testGetMonitorColorTemperature()
114122
{
115123
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
@@ -120,6 +128,7 @@ public void testGetMonitorColorTemperature()
120128
Dxva2.INSTANCE.GetMonitorColorTemperature(hPhysicalMonitor, pctCurrentColorTemperature);
121129
}
122130

131+
@Test
123132
public void testCapabilitiesRequestAndCapabilitiesReply()
124133
{
125134
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
@@ -134,6 +143,7 @@ public void testCapabilitiesRequestAndCapabilitiesReply()
134143
Dxva2.INSTANCE.CapabilitiesRequestAndCapabilitiesReply(hPhysicalMonitor, pszASCIICapabilitiesString, capStrLen);
135144
}
136145

146+
@Test
137147
public void testGetMonitorDisplayAreaPosition()
138148
{
139149
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
@@ -147,6 +157,7 @@ public void testGetMonitorDisplayAreaPosition()
147157
Dxva2.INSTANCE.GetMonitorDisplayAreaPosition(hPhysicalMonitor, ptPositionType, pdwMinimumPosition, pdwCurrentPosition, pdwMaximumPosition);
148158
}
149159

160+
@Test
150161
public void testGetMonitorDisplayAreaSize()
151162
{
152163
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
@@ -160,6 +171,7 @@ public void testGetMonitorDisplayAreaSize()
160171
Dxva2.INSTANCE.GetMonitorDisplayAreaSize(hPhysicalMonitor, ptSizeType, pdwMinimumSize, pdwCurrentSize, pdwMaximumSize);
161172
}
162173

174+
@Test
163175
public void testGetMonitorRedGreenOrBlueGain()
164176
{
165177
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
@@ -173,6 +185,7 @@ public void testGetMonitorRedGreenOrBlueGain()
173185
Dxva2.INSTANCE.GetMonitorRedGreenOrBlueGain(hPhysicalMonitor, ptGainType, pdwMinimumGain, pdwCurrentGain, pdwMaximumGain);
174186
}
175187

188+
@Test
176189
public void testGetMonitorRedGreenOrBlueDrive()
177190
{
178191
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
@@ -186,6 +199,7 @@ public void testGetMonitorRedGreenOrBlueDrive()
186199
Dxva2.INSTANCE.GetMonitorRedGreenOrBlueDrive(hPhysicalMonitor, ptDriveType, pdwMinimumDrive, pdwCurrentDrive, pdwMaximumDrive);
187200
}
188201

202+
@Test
189203
public void testGetTimingReport()
190204
{
191205
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;

lib/hamcrest-core-1.3.jar

44 KB
Binary file not shown.

0 commit comments

Comments
 (0)