Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
e46ecca8
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e46ecca8
编写于
10月 04, 2010
作者:
D
dav
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6847155: test/java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java fails
Reviewed-by: denis
上级
1c9d089c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
51 deletion
+49
-51
test/java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java
.../MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java
+49
-51
未找到文件。
test/java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java
浏览文件 @
e46ecca8
...
...
@@ -21,16 +21,15 @@ public class MouseModifiersUnitTest_Extra extends Frame {
static
final
int
SHIFT
=
1
;
static
final
int
CTRL
=
2
;
static
final
int
ALT
=
3
;
static
CheckingModifierAdapter
adapterTest1
;
static
CheckingModifierAdapter
adapterTest2
;
static
CheckingModifierAdapter
adapterTest3
;
static
CheckingModifierAdapter
adapterTest4
;
static
CheckingModifierAdapter
Extra
adapterTest1
;
static
CheckingModifierAdapter
Extra
adapterTest2
;
static
CheckingModifierAdapter
Extra
adapterTest3
;
static
CheckingModifierAdapter
Extra
adapterTest4
;
static
boolean
debug
=
true
;
//dump all errors (debug) or throw first(under jtreg) exception
static
boolean
autorun
=
false
;
//use robot or manual run
static
int
testModifier
=
NONE
;
static
int
[]
mouseButtons
;
static
int
[]
mouseButtonDownMasks
;
//an arrays representing a modifiersEx of extra mouse buttons while using ALT/CTRL/SHIFT or none of them
...
...
@@ -39,7 +38,6 @@ public class MouseModifiersUnitTest_Extra extends Frame {
static
int
[]
modifiersExStandardCTRL
;
static
int
[]
modifiersExStandardALT
;
// final static int [] mouseButtons = new int [] {MouseEvent.BUTTON1_MASK, MouseEvent.BUTTON2_MASK, MouseEvent.BUTTON3_MASK};
// BUTTON1, 2, 3 press-release.
final
static
int
modifiersStandard
=
0
;
//InputEvent.BUTTON_DOWN_MASK;
...
...
@@ -56,7 +54,7 @@ public class MouseModifiersUnitTest_Extra extends Frame {
if
(
modifiersEx
!=
curStandardExModifiers
[
index
]){
// System.out.println(">>>>>>>>>>>>>>> Pressed. modifiersEx "+modifiersEx +" : "+!= curStandardExModifiers");
MessageLogger
.
reportError
(
"Test failed : Pressed. modifiersEx != curStandardExModifiers
"
);
MessageLogger
.
reportError
(
"Test failed : Pressed. modifiersEx != curStandardExModifiers
. Got: "
+
modifiersEx
+
" , Expected: "
+
curStandardExModifiers
[
index
]
);
}
//check event.paramString() output
...
...
@@ -168,7 +166,7 @@ public class MouseModifiersUnitTest_Extra extends Frame {
}
if
(
modifiersEx
!=
curStandardExModifiers
[
index
]){
MessageLogger
.
reportError
(
"Test failed : Released. modifiersEx != curStandardExModifiers
"
);
MessageLogger
.
reportError
(
"Test failed : Released. modifiersEx != curStandardExModifiers
. Got: "
+
modifiersEx
+
" , Expected: "
+
curStandardExModifiers
[
index
]
);
}
//check event.paramString() output
...
...
@@ -191,7 +189,7 @@ public class MouseModifiersUnitTest_Extra extends Frame {
}
if
(
modifiersEx
!=
curStandardExModifiers
[
index
]){
MessageLogger
.
reportError
(
"Test failed : Clicked. modifiersEx != curStandardExModifiers
"
);
MessageLogger
.
reportError
(
"Test failed : Clicked. modifiersEx != curStandardExModifiers
. Got: "
+
modifiersEx
+
" , Expected: "
+
curStandardExModifiers
[
index
]
);
}
//check event.paramString() output
...
...
@@ -275,11 +273,11 @@ public class MouseModifiersUnitTest_Extra extends Frame {
this
.
addMouseListener
(
adapterTest1
);
robot
.
delay
(
1000
);
robot
.
mouseMove
(
getLocationOnScreen
().
x
+
getWidth
()/
2
,
getLocationOnScreen
().
y
+
getHeight
()/
2
);
for
(
int
i
=
3
;
i
<
mouseButtons
.
length
;
i
++){
System
.
out
.
println
(
"testNONE() => "
+
mouseButtons
[
i
]
);
robot
.
mousePress
(
mouseButtons
[
i
]);
for
(
int
i
=
3
;
i
<
mouseButton
DownMask
s
.
length
;
i
++){
System
.
out
.
println
(
"testNONE() => "
+
mouseButton
DownMask
s
[
i
]
);
robot
.
mousePress
(
mouseButton
DownMask
s
[
i
]);
robot
.
delay
(
100
);
robot
.
mouseRelease
(
mouseButtons
[
i
]);
robot
.
mouseRelease
(
mouseButton
DownMask
s
[
i
]);
}
robot
.
delay
(
1000
);
this
.
removeMouseListener
(
adapterTest1
);
...
...
@@ -289,12 +287,12 @@ public class MouseModifiersUnitTest_Extra extends Frame {
this
.
addMouseListener
(
adapterTest2
);
robot
.
delay
(
1000
);
robot
.
mouseMove
(
getLocationOnScreen
().
x
+
getWidth
()/
2
,
getLocationOnScreen
().
y
+
getHeight
()/
2
);
for
(
int
i
=
3
;
i
<
mouseButtons
.
length
;
i
++){
for
(
int
i
=
3
;
i
<
mouseButton
DownMask
s
.
length
;
i
++){
robot
.
keyPress
(
KeyEvent
.
VK_SHIFT
);
System
.
out
.
println
(
"testSHIFT() => "
+
mouseButtons
[
i
]
);
robot
.
mousePress
(
mouseButtons
[
i
]);
System
.
out
.
println
(
"testSHIFT() => "
+
mouseButton
DownMask
s
[
i
]
);
robot
.
mousePress
(
mouseButton
DownMask
s
[
i
]);
robot
.
delay
(
100
);
robot
.
mouseRelease
(
mouseButtons
[
i
]);
robot
.
mouseRelease
(
mouseButton
DownMask
s
[
i
]);
robot
.
keyRelease
(
KeyEvent
.
VK_SHIFT
);
}
robot
.
delay
(
1000
);
...
...
@@ -305,12 +303,12 @@ public class MouseModifiersUnitTest_Extra extends Frame {
this
.
addMouseListener
(
adapterTest3
);
robot
.
delay
(
1000
);
robot
.
mouseMove
(
getLocationOnScreen
().
x
+
getWidth
()/
2
,
getLocationOnScreen
().
y
+
getHeight
()/
2
);
for
(
int
i
=
3
;
i
<
mouseButtons
.
length
;
i
++){
for
(
int
i
=
3
;
i
<
mouseButton
DownMask
s
.
length
;
i
++){
robot
.
keyPress
(
KeyEvent
.
VK_CONTROL
);
System
.
out
.
println
(
"testCTRL() => "
+
mouseButtons
[
i
]
);
robot
.
mousePress
(
mouseButtons
[
i
]);
System
.
out
.
println
(
"testCTRL() => "
+
mouseButton
DownMask
s
[
i
]
);
robot
.
mousePress
(
mouseButton
DownMask
s
[
i
]);
robot
.
delay
(
100
);
robot
.
mouseRelease
(
mouseButtons
[
i
]);
robot
.
mouseRelease
(
mouseButton
DownMask
s
[
i
]);
robot
.
keyRelease
(
KeyEvent
.
VK_CONTROL
);
}
robot
.
delay
(
1000
);
...
...
@@ -321,12 +319,12 @@ public class MouseModifiersUnitTest_Extra extends Frame {
this
.
addMouseListener
(
adapterTest4
);
robot
.
delay
(
1000
);
robot
.
mouseMove
(
getLocationOnScreen
().
x
+
getWidth
()/
2
,
getLocationOnScreen
().
y
+
getHeight
()/
2
);
for
(
int
i
=
3
;
i
<
mouseButtons
.
length
;
i
++){
for
(
int
i
=
3
;
i
<
mouseButton
DownMask
s
.
length
;
i
++){
robot
.
keyPress
(
KeyEvent
.
VK_ALT
);
System
.
out
.
println
(
"testALT() => "
+
mouseButtons
[
i
]
);
robot
.
mousePress
(
mouseButtons
[
i
]);
System
.
out
.
println
(
"testALT() => "
+
mouseButton
DownMask
s
[
i
]
);
robot
.
mousePress
(
mouseButton
DownMask
s
[
i
]);
robot
.
delay
(
100
);
robot
.
mouseRelease
(
mouseButtons
[
i
]);
robot
.
mouseRelease
(
mouseButton
DownMask
s
[
i
]);
robot
.
keyRelease
(
KeyEvent
.
VK_ALT
);
}
robot
.
delay
(
1000
);
...
...
@@ -368,52 +366,52 @@ public class MouseModifiersUnitTest_Extra extends Frame {
}
public
static
void
initAdapters
(){
adapterTest1
=
new
CheckingModifierAdapter
(
NONE
);
adapterTest2
=
new
CheckingModifierAdapter
(
SHIFT
);
adapterTest3
=
new
CheckingModifierAdapter
(
CTRL
);
adapterTest4
=
new
CheckingModifierAdapter
(
ALT
);
adapterTest1
=
new
CheckingModifierAdapter
Extra
(
NONE
);
adapterTest2
=
new
CheckingModifierAdapter
Extra
(
SHIFT
);
adapterTest3
=
new
CheckingModifierAdapter
Extra
(
CTRL
);
adapterTest4
=
new
CheckingModifierAdapter
Extra
(
ALT
);
}
public
static
void
initVars
(){
int
[]
tmp
=
new
int
[
MouseInfo
.
getNumberOfButtons
()];
for
(
int
i
=
0
;
i
<
MouseInfo
.
getNumberOfButtons
();
i
++){
tmp
[
i
]
=
InputEvent
.
getMaskForButton
(
i
+
1
);
// System.out.println("TEST: "+tmp[i]);
//Init the array of the mouse button masks. It will be used for generating mouse events.
mouseButtonDownMasks
=
new
int
[
MouseInfo
.
getNumberOfButtons
()];
for
(
int
i
=
0
;
i
<
mouseButtonDownMasks
.
length
;
i
++){
mouseButtonDownMasks
[
i
]
=
InputEvent
.
getMaskForButton
(
i
+
1
);
System
.
out
.
println
(
"MouseArray [i] == "
+
mouseButtonDownMasks
[
i
]);
}
mouseButtons
=
Arrays
.
copyOf
(
tmp
,
tmp
.
length
);
for
(
int
i
=
0
;
i
<
mouseButtons
.
length
;
i
++){
System
.
out
.
println
(
"MouseArray [i] == "
+
mouseButtons
[
i
]);
}
mouseButtonDownMasks
=
Arrays
.
copyOf
(
tmp
,
tmp
.
length
);
// So we need to get the number of extra buttons on the mouse: "MouseInfo.getNumberOfButtons() - 3"
// and multyply on 3 because each button will generate three events : PRESS, RELEASE and CLICK.
tmp
=
new
int
[(
MouseInfo
.
getNumberOfButtons
()-
3
)*
3
];
Arrays
.
fill
(
tmp
,
0
);
int
[]
tmp
=
new
int
[(
MouseInfo
.
getNumberOfButtons
()-
3
)*
3
];
//Fill array of expected results for the case when mouse buttons are only used (no-modifier keys)
Arrays
.
fill
(
tmp
,
0
);
for
(
int
i
=
0
,
j
=
3
;
i
<
tmp
.
length
;
i
=
i
+
3
,
j
++){
tmp
[
i
]
=
mouseButtonDownMasks
[
j
];
}
modifiersExStandard
=
Arrays
.
copyOf
(
tmp
,
tmp
.
length
);
//Fill array of expected results for the case when mouse buttons are only used with SHIFT modifier key
Arrays
.
fill
(
tmp
,
InputEvent
.
SHIFT_DOWN_MASK
);
for
(
int
i
=
0
,
j
=
3
;
i
<
MouseInfo
.
getNumberOfButtons
();
i
=
i
+
3
,
j
++){
tmp
[
i
]
=
tmp
[
j
]
|
mouseButtonDownMasks
[
j
];
for
(
int
i
=
0
,
j
=
3
;
i
<
tmp
.
length
;
i
=
i
+
3
,
j
++){
System
.
out
.
println
(
"modifiersExStandardSHIFT FILLING : "
+
tmp
[
i
]
+
" + "
+
mouseButtonDownMasks
[
j
]);
tmp
[
i
]
=
tmp
[
i
]
|
mouseButtonDownMasks
[
j
];
}
modifiersExStandardSHIFT
=
Arrays
.
copyOf
(
tmp
,
tmp
.
length
);
//Fill array of expected results for the case when mouse buttons are only used with CTRL modifier key
Arrays
.
fill
(
tmp
,
InputEvent
.
CTRL_DOWN_MASK
);
for
(
int
i
=
0
,
j
=
3
;
i
<
MouseInfo
.
getNumberOfButtons
();
i
=
i
+
3
,
j
++){
tmp
[
i
]
=
tmp
[
j
]
|
mouseButtonDownMasks
[
j
];
for
(
int
i
=
0
,
j
=
3
;
i
<
tmp
.
length
;
i
=
i
+
3
,
j
++){
System
.
out
.
println
(
"modifiersExStandardCTRL FILLING : "
+
tmp
[
i
]
+
" + "
+
mouseButtonDownMasks
[
j
]);
tmp
[
i
]
=
tmp
[
i
]
|
mouseButtonDownMasks
[
j
];
}
modifiersExStandardCTRL
=
Arrays
.
copyOf
(
tmp
,
tmp
.
length
);
//Fill array of expected results for the case when mouse buttons are only used with ALT modifier key
Arrays
.
fill
(
tmp
,
InputEvent
.
ALT_DOWN_MASK
);
for
(
int
i
=
0
,
j
=
3
;
i
<
MouseInfo
.
getNumberOfButtons
();
i
=
i
+
3
,
j
++){
tmp
[
i
]
=
tmp
[
j
]
|
mouseButtonDownMasks
[
j
];
for
(
int
i
=
0
,
j
=
3
;
i
<
tmp
.
length
;
i
=
i
+
3
,
j
++){
System
.
out
.
println
(
"modifiersExStandardALT FILLING : "
+
tmp
[
i
]
+
" + "
+
mouseButtonDownMasks
[
j
]);
tmp
[
i
]
=
tmp
[
i
]
|
mouseButtonDownMasks
[
j
];
}
modifiersExStandardALT
=
Arrays
.
copyOf
(
tmp
,
tmp
.
length
);
}
...
...
@@ -436,9 +434,9 @@ public class MouseModifiersUnitTest_Extra extends Frame {
/* A class that invoke appropriate verification
* routine with current modifier.
*/
class
CheckingModifierAdapter
extends
MouseAdapter
{
class
CheckingModifierAdapter
Extra
extends
MouseAdapter
{
int
modifier
;
public
CheckingModifierAdapter
(
int
modifier
){
public
CheckingModifierAdapter
Extra
(
int
modifier
){
this
.
modifier
=
modifier
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录