Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c32d33f9
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看板
提交
c32d33f9
编写于
3月 03, 2011
作者:
A
alexp
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
3faf0839
9980c573
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
204 addition
and
8 deletion
+204
-8
src/share/classes/javax/swing/text/html/CSSBorder.java
src/share/classes/javax/swing/text/html/CSSBorder.java
+9
-8
test/javax/swing/regtesthelpers/Util.java
test/javax/swing/regtesthelpers/Util.java
+75
-0
test/javax/swing/text/CSSBorder/6796710/bug6796710.java
test/javax/swing/text/CSSBorder/6796710/bug6796710.java
+120
-0
未找到文件。
src/share/classes/javax/swing/text/html/CSSBorder.java
浏览文件 @
c32d33f9
...
...
@@ -203,10 +203,11 @@ class CSSBorder extends AbstractBorder {
public
void
paintBorder
(
Component
c
,
Graphics
g
,
int
x
,
int
y
,
int
width
,
int
height
)
{
assert
(
g
instanceof
Graphics2D
)
:
"need Graphics2D instanse"
;
Graphics2D
g2
=
(
Graphics2D
)
g
;
Color
savedColor
=
g2
.
getColor
();
Shape
savedClip
=
g2
.
getClip
();
if
(!(
g
instanceof
Graphics2D
))
{
return
;
}
Graphics2D
g2
=
(
Graphics2D
)
g
.
create
();
int
[]
widths
=
getWidths
();
...
...
@@ -238,16 +239,16 @@ class CSSBorder extends AbstractBorder {
BorderPainter
painter
=
getBorderPainter
(
i
);
double
angle
=
i
*
Math
.
PI
/
2
;
g2
.
setClip
(
g
.
getClip
());
// Restore initial clip
g2
.
translate
(
intCorners
[
i
][
0
],
intCorners
[
i
][
1
]);
g2
.
rotate
(
angle
);
g2
.
setC
lip
(
shape
);
painter
.
paint
(
shape
,
g
,
color
,
i
);
g2
.
c
lip
(
shape
);
painter
.
paint
(
shape
,
g
2
,
color
,
i
);
g2
.
rotate
(-
angle
);
g2
.
translate
(-
intCorners
[
i
][
0
],
-
intCorners
[
i
][
1
]);
}
}
g2
.
setColor
(
savedColor
);
g2
.
setClip
(
savedClip
);
g2
.
dispose
();
}
...
...
test/javax/swing/regtesthelpers/Util.java
0 → 100644
浏览文件 @
c32d33f9
/*
* Copyright (c) 2011, 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
javax.swing.*
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
/**
* <p>This class contains utilities useful for regression testing.
* <p>When using jtreg you would include this class via something like:
* <pre>
*
* @library ../../regtesthelpers
* @build Util
* </pre>
*/
public
class
Util
{
/**
* 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
static
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 bufferedImages pixel-by-pixel.
* return true if all pixels in the two areas are identical
*/
public
static
boolean
compareBufferedImages
(
BufferedImage
bufferedImage0
,
BufferedImage
bufferedImage1
)
{
int
width
=
bufferedImage0
.
getWidth
();
int
height
=
bufferedImage0
.
getHeight
();
if
(
width
!=
bufferedImage1
.
getWidth
()
||
height
!=
bufferedImage1
.
getHeight
())
{
return
false
;
}
for
(
int
y
=
0
;
y
<
height
;
y
++)
{
for
(
int
x
=
0
;
x
<
width
;
x
++)
{
if
(
bufferedImage0
.
getRGB
(
x
,
y
)
!=
bufferedImage1
.
getRGB
(
x
,
y
))
{
return
false
;
}
}
}
return
true
;
}
}
test/javax/swing/text/CSSBorder/6796710/bug6796710.java
0 → 100644
浏览文件 @
c32d33f9
/*
* Copyright (c) 2011, 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 6796710
* @summary Html content in JEditorPane is overlapping on swing components while resizing the application.
* @library ../../../regtesthelpers
* @build Util
* @author Pavel Porvatov
@run main bug6796710
*/
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
public
class
bug6796710
{
// The page is inlined because we want to be sure that the JEditorPane filled synchronously
public
static
final
String
TEXT
=
"<html>"
+
"<body>"
+
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\">"
+
" <tbody>"
+
" <tr>"
+
" <td>Col1</td>"
+
" <td>Col2</td>"
+
" <td>Col3</td>"
+
" </tr>"
+
" <tr>"
+
" <td>1. It's a regression from CR 4419748. The problem is in the CSSBorder#paintBorder, which ignores clip area while painting.</td>"
+
" <td>2. It's a regression from CR 4419748. The problem is in the CSSBorder#paintBorder, which ignores clip area while painting.</td>"
+
" <td>3. It's a regression from CR 4419748. The problem is in the CSSBorder#paintBorder, which ignores clip area while painting.</td>"
+
" </tr>"
+
" </tbody>"
+
"</table>"
+
"</body>"
+
"</html>"
;
private
static
Robot
robot
;
private
static
JFrame
frame
;
private
static
JPanel
pnBottom
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
robot
=
new
Robot
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
frame
=
new
JFrame
();
pnBottom
=
new
JPanel
();
pnBottom
.
add
(
new
JLabel
(
"Some label"
));
pnBottom
.
add
(
new
JButton
(
"A button"
));
JEditorPane
editorPane
=
new
JEditorPane
();
editorPane
.
setContentType
(
"text/html"
);
editorPane
.
setText
(
TEXT
);
editorPane
.
setEditable
(
false
);
JPanel
pnContent
=
new
JPanel
(
new
BorderLayout
());
pnContent
.
add
(
new
JScrollPane
(
editorPane
),
BorderLayout
.
CENTER
);
pnContent
.
add
(
pnBottom
,
BorderLayout
.
SOUTH
);
frame
.
setContentPane
(
pnContent
);
frame
.
setSize
(
400
,
600
);
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
frame
.
setVisible
(
true
);
}
});
robot
.
waitForIdle
();
BufferedImage
bufferedImage
=
getPnBottomImage
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
frame
.
setSize
(
400
,
150
);
}
});
robot
.
waitForIdle
();
if
(!
Util
.
compareBufferedImages
(
bufferedImage
,
getPnBottomImage
()))
{
throw
new
RuntimeException
(
"The test failed"
);
}
System
.
out
.
println
(
"The test bug6796710 passed."
);
}
private
static
BufferedImage
getPnBottomImage
()
{
Rectangle
rect
=
pnBottom
.
getBounds
();
Util
.
convertRectToScreen
(
rect
,
pnBottom
.
getParent
());
return
robot
.
createScreenCapture
(
rect
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录