Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
7d65134e
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看板
提交
7d65134e
编写于
1月 26, 2017
作者:
M
mcherkas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8161195: Regression: closed/javax/swing/text/FlowView/LayoutTest.java
Reviewed-by: serb
上级
0b9ef5a4
变更
5
展开全部
显示空白变更内容
内联
并排
Showing
5 changed file
with
1284 addition
and
2 deletion
+1284
-2
src/windows/native/sun/windows/awt_Component.cpp
src/windows/native/sun/windows/awt_Component.cpp
+4
-2
test/javax/swing/regtesthelpers/JRobot.java
test/javax/swing/regtesthelpers/JRobot.java
+294
-0
test/javax/swing/regtesthelpers/SwingTestHelper.java
test/javax/swing/regtesthelpers/SwingTestHelper.java
+862
-0
test/javax/swing/regtesthelpers/Test.java
test/javax/swing/regtesthelpers/Test.java
+34
-0
test/javax/swing/text/FlowView/LayoutTest.java
test/javax/swing/text/FlowView/LayoutTest.java
+90
-0
未找到文件。
src/windows/native/sun/windows/awt_Component.cpp
浏览文件 @
7d65134e
...
@@ -3813,10 +3813,12 @@ MsgRouting AwtComponent::WmImeNotify(WPARAM subMsg, LPARAM bitsCandType)
...
@@ -3813,10 +3813,12 @@ MsgRouting AwtComponent::WmImeNotify(WPARAM subMsg, LPARAM bitsCandType)
if
(
!
m_useNativeCompWindow
)
{
if
(
!
m_useNativeCompWindow
)
{
if
(
subMsg
==
IMN_OPENCANDIDATE
)
{
if
(
subMsg
==
IMN_OPENCANDIDATE
)
{
m_bitsCandType
=
subMsg
;
m_bitsCandType
=
subMsg
;
}
else
if
(
subMsg
!=
IMN_SETCANDIDATEPOS
)
{
InquireCandidatePosition
();
}
else
if
(
subMsg
==
IMN_OPENSTATUSWINDOW
||
subMsg
==
WM_IME_STARTCOMPOSITION
)
{
m_bitsCandType
=
0
;
m_bitsCandType
=
0
;
}
InquireCandidatePosition
();
InquireCandidatePosition
();
}
return
mrConsume
;
return
mrConsume
;
}
}
return
mrDoDefault
;
return
mrDoDefault
;
...
...
test/javax/swing/regtesthelpers/JRobot.java
0 → 100644
浏览文件 @
7d65134e
/*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* JRobot is a wrapper around java.awt.Robot that provides some convenience
* methods.
* <p>When using jtreg you would include this class via something like:
* <pre>
* @library ../../../regtesthelpers
* @build JRobot
* </pre>
*
*/
import
java.awt.AWTException
;
import
java.awt.Component
;
import
java.awt.Dimension
;
import
java.awt.EventQueue
;
import
java.awt.Point
;
import
java.awt.Rectangle
;
import
java.awt.event.InputEvent
;
import
java.awt.event.KeyEvent
;
import
javax.swing.SwingUtilities
;
public
class
JRobot
extends
java
.
awt
.
Robot
{
private
static
int
DEFAULT_DELAY
=
550
;
private
static
int
INTERNAL_DELAY
=
250
;
private
int
delay
;
private
boolean
delaysEnabled
;
protected
JRobot
(
boolean
enableDelays
)
throws
AWTException
{
super
();
delaysEnabled
=
enableDelays
;
setAutoWaitForIdle
(
enableDelays
);
if
(
enableDelays
)
{
setAutoDelay
(
INTERNAL_DELAY
);
setDelay
(
DEFAULT_DELAY
);
}
}
/**
* Return a JRobot. Delays are enabled by default.
* @return a JRobot
*/
public
static
JRobot
getRobot
()
{
return
getRobot
(
true
);
}
/**
* Create a JRobot. The parameter controls whether delays are enabled.
* @param enableDelays controls whether delays are enabled.
* @return a JRobot
*/
public
static
JRobot
getRobot
(
boolean
enableDelays
)
{
JRobot
robot
=
null
;
try
{
robot
=
new
JRobot
(
enableDelays
);
}
catch
(
AWTException
e
)
{
System
.
err
.
println
(
"Coudn't create Robot, details below"
);
throw
new
Error
(
e
);
}
return
robot
;
}
/**
* Press and release a key.
* @param keycode which key to press. For example, KeyEvent.VK_DOWN
*/
public
void
hitKey
(
int
keycode
)
{
keyPress
(
keycode
);
keyRelease
(
keycode
);
delay
();
}
/**
* Press and release a key with modifiers.
* @param keys keys to press. Keys are pressed in order they are passed as
* parameters to this method. All keys except the last one are considered
* modifiers. For example, to press Ctrl+Shift+T, call:
* hitKey(KeyEvent.VK_CONTROL, KeyEvent.VK_SHIFT, KeyEvent.VK_T);
*/
public
void
hitKey
(
int
...
keys
)
{
for
(
int
i
=
0
;
i
<
keys
.
length
;
i
++)
{
keyPress
(
keys
[
i
]);
}
for
(
int
i
=
keys
.
length
-
1
;
i
>=
0
;
i
--)
{
keyRelease
(
keys
[
i
]);
}
delay
();
}
/**
* Move mouse cursor to the center of the Component.
* @param c Component the mouse is placed over
*/
public
void
moveMouseTo
(
Component
c
)
{
Point
p
=
c
.
getLocationOnScreen
();
Dimension
size
=
c
.
getSize
();
p
.
x
+=
size
.
width
/
2
;
p
.
y
+=
size
.
height
/
2
;
mouseMove
(
p
.
x
,
p
.
y
);
delay
();
}
/**
* Move mouse smoothly from (x0, y0) to (x1, y1).
*/
public
void
glide
(
int
x0
,
int
y0
,
int
x1
,
int
y1
)
{
float
dmax
=
(
float
)
Math
.
max
(
Math
.
abs
(
x1
-
x0
),
Math
.
abs
(
y1
-
y0
));
float
dx
=
(
x1
-
x0
)
/
dmax
;
float
dy
=
(
y1
-
y0
)
/
dmax
;
mouseMove
(
x0
,
y0
);
for
(
int
i
=
1
;
i
<=
dmax
;
i
++)
{
mouseMove
((
int
)(
x0
+
dx
*
i
),
(
int
)(
y0
+
dy
*
i
));
}
delay
();
}
/**
* Perform a mouse click, i.e. press and release mouse button(s).
* @param buttons mouse button(s).
* For example, MouseEvent.BUTTON1_MASK
*/
public
void
clickMouse
(
int
buttons
)
{
mousePress
(
buttons
);
mouseRelease
(
buttons
);
delay
();
}
/**
* Perform a click with the first mouse button.
*/
public
void
clickMouse
()
{
clickMouse
(
InputEvent
.
BUTTON1_MASK
);
}
/**
* Click in the center of the given Component
* @param c the Component to click on
* @param buttons mouse button(s).
*/
public
void
clickMouseOn
(
Component
c
,
int
buttons
)
{
moveMouseTo
(
c
);
clickMouse
(
buttons
);
}
/**
* Click the first mouse button in the center of the given Component
* @param c the Component to click on
*/
public
void
clickMouseOn
(
Component
c
)
{
clickMouseOn
(
c
,
InputEvent
.
BUTTON1_MASK
);
}
/**
* Return whether delays are enabled
* @return whether delays are enabled
*/
public
boolean
getDelaysEnabled
()
{
return
delaysEnabled
;
}
/**
* Delay execution by delay milliseconds
*/
public
void
delay
()
{
delay
(
delay
);
}
/**
* Return the delay amount, in milliseconds
*/
public
int
getDelay
()
{
return
delay
;
}
/**
* Set the delay amount, in milliseconds
*/
public
void
setDelay
(
int
delay
)
{
this
.
delay
=
delay
;
}
/**
* Waits until all events currently on the event queue have been processed.
* Does nothing if called on EDT
*/
public
synchronized
void
waitForIdle
()
{
if
(!
EventQueue
.
isDispatchThread
())
{
super
.
waitForIdle
();
}
}
/**
* Calculate the center of the Rectangle passed, and return them
* in a Point object.
* @param r a non-null Rectangle
* @return a new Point object containing coordinates of r's center
*/
public
Point
centerOf
(
Rectangle
r
)
{
return
new
Point
(
r
.
x
+
r
.
width
/
2
,
r
.
y
+
r
.
height
/
2
);
}
/**
* Calculate the center of the Rectangle passed, and store it in p.
* @param r a non-null Rectangle
* @param p a non-null Point that receives coordinates of r's center
* @return p
*/
public
Point
centerOf
(
Rectangle
r
,
Point
p
)
{
p
.
x
=
r
.
x
+
r
.
width
/
2
;
p
.
y
=
r
.
y
+
r
.
height
/
2
;
return
p
;
}
/**
* Convert a rectangle from coordinate system of Component c to
* screen coordinate system.
* @param r a non-null Rectangle
* @param c a Component whose coordinate system is used for conversion
*/
public
void
convertRectToScreen
(
Rectangle
r
,
Component
c
)
{
Point
p
=
new
Point
(
r
.
x
,
r
.
y
);
SwingUtilities
.
convertPointToScreen
(
p
,
c
);
r
.
x
=
p
.
x
;
r
.
y
=
p
.
y
;
}
/**
* Compares two rectangles pixel-by-pixel.
* @param r0 the first area
* @param r1 the second area
* return true if all pixels in the two areas are identical
*/
public
boolean
compareRects
(
Rectangle
r0
,
Rectangle
r1
)
{
int
xShift
=
r1
.
x
-
r0
.
x
;
int
yShift
=
r1
.
y
-
r0
.
y
;
for
(
int
y
=
r0
.
y
;
y
<
r0
.
y
+
r0
.
height
;
y
++)
{
for
(
int
x
=
r0
.
x
;
x
<
r0
.
x
+
r0
.
width
;
x
++)
{
if
(!
comparePixels
(
x
,
y
,
x
+
xShift
,
y
+
yShift
))
{
return
false
;
}
}
}
return
true
;
}
/**
* Compares colors of two points on the screen.
* @param p0 the first point
* @param p1 the second point
* return true if the two points have the same color
*/
public
boolean
comparePixels
(
Point
p0
,
Point
p1
)
{
return
comparePixels
(
p0
.
x
,
p0
.
y
,
p1
.
x
,
p1
.
y
);
}
/**
* Compares colors of two points on the screen.
* @param x0 the x coordinate of the first point
* @param y0 the y coordinate of the first point
* @param x1 the x coordinate of the second point
* @param y1 the y coordinate of the second point
* return true if the two points have the same color
*/
public
boolean
comparePixels
(
int
x0
,
int
y0
,
int
x1
,
int
y1
)
{
return
(
getPixelColor
(
x0
,
y0
).
equals
(
getPixelColor
(
x1
,
y1
)));
}
}
test/javax/swing/regtesthelpers/SwingTestHelper.java
0 → 100644
浏览文件 @
7d65134e
此差异已折叠。
点击以展开。
test/javax/swing/regtesthelpers/Test.java
0 → 100644
浏览文件 @
7d65134e
/*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
METHOD
)
public
@interface
Test
{
int
value
();
boolean
onEDT
()
default
true
;
}
\ No newline at end of file
test/javax/swing/text/FlowView/LayoutTest.java
0 → 100644
浏览文件 @
7d65134e
/*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
@bug 6452106 6606443 8161195
@author Peter Zhelezniakov
@library ../../regtesthelpers
@build Test JRobot SwingTestHelper
@run main/timeout=300 LayoutTest
*/
import
javax.swing.text.*
;
import
javax.swing.*
;
import
java.awt.event.*
;
import
java.awt.*
;
public
class
LayoutTest
extends
SwingTestHelper
{
JTextPane
text
;
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
new
LayoutTest
().
run
(
args
);
}
protected
Component
createContentPane
()
{
return
text
=
new
JTextPane
();
}
@Test
(
value
=
10
,
onEDT
=
true
)
private
void
onEDT10
()
{
requestAndWaitForFocus
(
text
);
}
@Test
(
value
=
100
,
onEDT
=
true
)
private
void
prepare6452106
()
{
text
.
setText
(
"This is easily generated on my\nmachine"
);
Document
doc
=
text
.
getDocument
();
// wrap the long paragraph
Dimension
d
=
text
.
getPreferredSize
();
Dimension
size
=
new
Dimension
(
d
.
width
*
2
/
3
,
d
.
height
*
5
);
window
.
setSize
(
size
);
// place caret at the end of 2nd line
Element
p1
=
doc
.
getDefaultRootElement
().
getElement
(
0
);
int
pos
=
p1
.
getEndOffset
();
text
.
setCaretPosition
(
pos
-
1
);
}
@Test
(
value
=
110
,
onEDT
=
false
)
private
void
test6452106
()
{
robot
.
setDelay
(
300
);
robot
.
hitKey
(
KeyEvent
.
VK_DELETE
);
robot
.
hitKey
(
KeyEvent
.
VK_SPACE
);
robot
.
hitKey
(
KeyEvent
.
VK_SPACE
);
}
@Test
(
value
=
200
,
onEDT
=
true
)
private
void
prepare6606443
()
{
text
.
setText
(
"This is easily\ngenerated\non my machine"
);
text
.
setSelectionStart
(
15
);
text
.
setSelectionEnd
(
24
);
}
@Test
(
value
=
210
,
onEDT
=
false
)
private
void
test6606443
()
{
robot
.
hitKey
(
KeyEvent
.
VK_ENTER
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录