source: trunk/tests/SWT/java/SWT001.java@ 12

Last change on this file since 12 was 12, checked in by lpino, 18 years ago
  • Initial commit
File size: 4.9 KB
Line 
1/*
2 * SWT001.java
3 */
4
5/*
6 * Copyright (c) 2002, 2004 EclipseOS2 Team.
7 * This file is made available under the terms of the Common Public License v1.0
8 * which accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/cpl-v10.html
10 */
11
12import java.io.*;
13
14import org.eclipse.swt.*;
15import org.eclipse.swt.graphics.*;
16import org.eclipse.swt.widgets.*;
17import org.eclipse.swt.internal.*;
18import org.eclipse.swt.internal.pm.*;
19
20public class SWT001 extends SWTTestCase{
21
22static {
23 STEP= "001";
24 TEST = null;
25 DESC = "SWT Internals";
26}
27
28public static void main (String[] args) {
29 go (new SWT001());
30}
31
32protected void exec() {
33 System.out.println( "OBJECTIVE: o.e.swt.internal.Library AAALLLLLL" );
34 System.out.println( "-------------------------------------------\n" );
35 System.out.println( "java.library.path = " + System.getProperty( "java.library.path" ) + '\n' );
36 System.out.println( "Trying to load SWT native library...\n" );
37 Library.loadLibrary( "swt" );
38
39 System.out.println( "OBJECTIVE: o.e.swt.internal.Callback.getPlatform()" );
40 System.out.println( "-------------------------------------------\n" );
41 System.out.println( "o.e.swt.internal.Callback.getPlatform() = " + Callback.getPlatform ());
42 System.out.println( "o.e.swt.SWT.getPlatform() = " + SWT.getPlatform () );
43 System.out.println();
44
45 System.out.println( "OBJECTIVE: OS/2 version info (o.e.swt.internal.OS constants)" );
46 System.out.println( "-------------------------------------------\n" );
47 System.out.println( "IsWarp3 = "+OS.IsWarp3 );
48 System.out.println( "IsWarp4 = "+OS.IsWarp4 );
49 System.out.println( "IsAurora = "+OS.IsAurora );
50 System.out.println( "OS2_MAJOR = "+OS.OS2_MAJOR+", OS2_MINOR = "+OS.OS2_MINOR+
51 ", OS2_REVISION = "+OS.OS2_REVISION );
52 System.out.println();
53
54 System.out.println( "OBJECTIVE: o.e.swt.internal.OS.WinAlarm()" );
55 System.out.println( "-------------------------------------------\n" );
56 try {
57 System.out.println( "o.e.swt.internal.OS.WinAlarm(OS.WA_WARNING) = " + OS.WinAlarm (OS.HWND_DESKTOP, OS.WA_WARNING) );
58 Thread.currentThread ().sleep (500);
59 System.out.println( "o.e.swt.internal.OS.WinAlarm(OS.WA_NOTE) = " + OS.WinAlarm (OS.HWND_DESKTOP, OS.WA_NOTE) );
60 Thread.currentThread ().sleep (500);
61 System.out.println( "o.e.swt.internal.OS.WinAlarm(OS.WA_ERROR) = " + OS.WinAlarm (OS.HWND_DESKTOP, OS.WA_ERROR) );
62 Thread.currentThread ().sleep (500);
63 System.out.println( "o.e.swt.internal.OS.WinAlarm(4) = " + OS.WinAlarm (OS.HWND_DESKTOP, 4) );
64 } catch (InterruptedException x) {
65 }
66 System.out.println();
67
68 System.out.println( "OBJECTIVE: PM initialization sequences" );
69 System.out.println( "-------------------------------------------\n" );
70 int hab = OS.WinInitialize (0);
71 System.out.println( "o.e.swt.internal.OS.WinInitalize(0) = " + hab );
72 System.out.println( "o.e.swt.internal.OS.WinGetLastError(hab) = " + OS.WinGetLastError (hab) );
73 int hmq = OS.WinCreateMsgQueue (hab, 0);
74 System.out.println( "o.e.swt.internal.OS.WinCreateMsgQueue(hmq) = " + hmq );
75 System.out.println( "o.e.swt.internal.OS.WinGetLastError(hab) = " + OS.WinGetLastError (hab) );
76 System.out.println( "o.e.swt.internal.OS.WinDestroyMsgQueue(hmq) = " + OS.WinDestroyMsgQueue (hmq) );
77 System.out.println( "o.e.swt.internal.OS.WinTerminate(hab) = " + OS.WinTerminate (hab) );
78 System.out.println();
79
80 System.out.println( "OBJECTIVE: o.e.swt.internal.OS.DosGetInfoBlocks()" );
81 System.out.println( "-------------------------------------------\n" );
82 int[] ptib = new int[1];
83 int[] ppib = new int[1];
84 TIB tib = new TIB();
85 PIB pib = new PIB();
86 System.out.println( "o.e.swt.internal.OS.DosGetInfoBlocks() = " + OS.DosGetInfoBlocks (ptib, ppib) );
87 OS.objcpy (tib, ptib[0]);
88 OS.objcpy (pib, ppib[0]);
89 System.out.println( "pib.pib_ulpid = " + pib.pib_ulpid );
90 System.out.println( "pib.pib_ulppid = " + pib.pib_ulppid );
91 System.out.println( "pib.pib_hmte = " + pib.pib_hmte );
92 System.out.println( "pib.pib_ultype = " + pib.pib_ultype );
93 System.out.println( "tib.tib_pstack = " + tib.tib_pstack );
94 System.out.println( "tib.tib_version = " + tib.tib_version );
95 System.out.println( "tib.tib_ordinal = " + tib.tib_ordinal );
96 System.out.println( "tib.tib_ptib2.tib2_ultid = " + tib.tib_ptib2.tib2_ultid );
97 System.out.println( "tib.tib_ptib2.tib2_ulpri = " + tib.tib_ptib2.tib2_ulpri );
98 System.out.println("// setting MAX_PRIORITY for a thread...");
99 int pri = Thread.currentThread().getPriority();
100 Thread.currentThread().setPriority (Thread.MAX_PRIORITY);
101 OS.objcpy (tib, ptib[0]);
102 System.out.println( "tib.tib_ptib2.tib2_ulpri = " + tib.tib_ptib2.tib2_ulpri);
103 Thread.currentThread().setPriority (pri);
104 System.out.println();
105}
106
107}
108
Note: See TracBrowser for help on using the repository browser.