-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b20
-
b68
-
generic
-
generic
-
Verified
JCK: JCK-runtime-6b b07
J2SE: FAIL - 7 b20 PASS 7 b19 6u4 b03
Platform[s]: FAIL - All
switch/Mode: FAIL - default
Test api/javax_swing/text/LabelView/index.html#getXXX[LabelView0004] fails since JDK 7. the problem is getBreakWeight starts to return View.BadBreakWeight.
Steps to reproduce:
run the following code:
import java.awt.*;
import javax.swing.*;
import java.io.PrintWriter;
import javax.swing.*;
import javax.swing.text.*;
public class Test {
/* standalone interface */
public static void main(String argv[]) {
System.out.println(" === public int getBreakWeight(int axis, float pos, float len) === ");
Element element = new StubElement("StubElement");
LabelView c = new LabelView(element);
int axis = View.X_AXIS;
float pref = c.getPreferredSpan(axis); // To update metrics parameters.
int pos = 0;
int len = 2;
int weight = c.getBreakWeight(axis, pos, len);
if (!(weight == View.BadBreakWeight)) {
System.out.println(" Should return " + View.BadBreakWeight);
System.out.println(" but has returned " + weight);
System.out.println("public int getBreakWeight(int axis, float pos, float len) Test Failed");
}
pos = 23;
len = 48;
weight = c.getBreakWeight(axis, pos, len);
if (weight == View.BadBreakWeight) {
System.out.println(" Should return value more then " + View.BadBreakWeight);
System.out.println(" but has returned " + weight);
System.out.println("public int getBreakWeight(int axis, float pos, float len) Test Failed");
}
System.out.println("OKAY");
}
}
class StubElement implements Element {
Document document = new DefaultStyledDocument();
String context;
public SimpleAttributeSet attr;
public StubElement(String context) {
this.context = context;
attr = new SimpleAttributeSet();
document = new DefaultStyledDocument();
try {
document.insertString(0, context, new SimpleAttributeSet());
} catch (BadLocationException e) {}
}
public Document getDocument() {
return document;
}
public Element getParentElement() {
return null;
}
public String getName() {
return "StubElement";
}
public AttributeSet getAttributes() {
return attr;
}
public int getStartOffset() {
return 0;
}
public int getEndOffset() {
return document.getLength();
}
public int getElementIndex(int offset) {
return 0;
}
public int getElementCount() {
return 1;
}
public Element getElement(int index) {
return this;
}
public boolean isLeaf() {
return true;
}
/**
* Return the difference between getStartOffset() and
* getEndOffset().
*/
public int getLineLimit() {
return getEndOffset() - getStartOffset();
}
}
J2SE: FAIL - 7 b20 PASS 7 b19 6u4 b03
Platform[s]: FAIL - All
switch/Mode: FAIL - default
Test api/javax_swing/text/LabelView/index.html#getXXX[LabelView0004] fails since JDK 7. the problem is getBreakWeight starts to return View.BadBreakWeight.
Steps to reproduce:
run the following code:
import java.awt.*;
import javax.swing.*;
import java.io.PrintWriter;
import javax.swing.*;
import javax.swing.text.*;
public class Test {
/* standalone interface */
public static void main(String argv[]) {
System.out.println(" === public int getBreakWeight(int axis, float pos, float len) === ");
Element element = new StubElement("StubElement");
LabelView c = new LabelView(element);
int axis = View.X_AXIS;
float pref = c.getPreferredSpan(axis); // To update metrics parameters.
int pos = 0;
int len = 2;
int weight = c.getBreakWeight(axis, pos, len);
if (!(weight == View.BadBreakWeight)) {
System.out.println(" Should return " + View.BadBreakWeight);
System.out.println(" but has returned " + weight);
System.out.println("public int getBreakWeight(int axis, float pos, float len) Test Failed");
}
pos = 23;
len = 48;
weight = c.getBreakWeight(axis, pos, len);
if (weight == View.BadBreakWeight) {
System.out.println(" Should return value more then " + View.BadBreakWeight);
System.out.println(" but has returned " + weight);
System.out.println("public int getBreakWeight(int axis, float pos, float len) Test Failed");
}
System.out.println("OKAY");
}
}
class StubElement implements Element {
Document document = new DefaultStyledDocument();
String context;
public SimpleAttributeSet attr;
public StubElement(String context) {
this.context = context;
attr = new SimpleAttributeSet();
document = new DefaultStyledDocument();
try {
document.insertString(0, context, new SimpleAttributeSet());
} catch (BadLocationException e) {}
}
public Document getDocument() {
return document;
}
public Element getParentElement() {
return null;
}
public String getName() {
return "StubElement";
}
public AttributeSet getAttributes() {
return attr;
}
public int getStartOffset() {
return 0;
}
public int getEndOffset() {
return document.getLength();
}
public int getElementIndex(int offset) {
return 0;
}
public int getElementCount() {
return 1;
}
public Element getElement(int index) {
return this;
}
public boolean isLeaf() {
return true;
}
/**
* Return the difference between getStartOffset() and
* getEndOffset().
*/
public int getLineLimit() {
return getEndOffset() - getStartOffset();
}
}
- relates to
-
JDK-6423287 PargraphView returns wrong minimum span
-
- Closed
-
-
JDK-6978666 closed/javax/swing/text/html/TableView/4813831/bug4813831.java failed
-
- Closed
-
-
JDK-6751407 GlyphView.getMinimumSpan return value is not the minimum span
-
- Closed
-
-
JDK-7042142 The View#getMinimumSpan doesn' work correctly for three non-breakable views in a line
-
- Closed
-
-
JDK-4644241 Need API to set BreakIterator of JTextComponent
-
- Open
-