Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8246348: Crash in libpango on Ubuntu 20.04 with some unicode chars #249

Closed
wants to merge 8 commits into from
@@ -26,7 +26,6 @@
package test.com.sun.javafx.text;

import javafx.scene.text.Font;
import com.sun.javafx.text.TextRun;

import com.sun.javafx.font.PGFont;
import com.sun.javafx.geom.RectBounds;
@@ -36,8 +35,6 @@
import com.sun.javafx.scene.text.FontHelper;
import com.sun.javafx.font.CharToGlyphMapper;
import com.sun.javafx.text.PrismTextLayout;
import com.sun.javafx.text.GlyphLayout;
import com.sun.javafx.text.TextRun;

import org.junit.Ignore;
import org.junit.Test;
@@ -98,21 +95,6 @@ private void verifyComplex(PrismTextLayout layout, boolean... complex) {
}
}

@Ignore() // ignored since StubFontLoader used in tests return fonts with null resources
@Test public void utf16chars() {
GlyphLayout layout = GlyphLayout.getInstance();
assertNotNull(layout);
char[] text = new char[5];
text[0] = 0xD83D;
text[1] = 0xDC68;
text[2] = 0xD83C;
text[3] = 0xDFFE;
text[4] = 0x17FF;
TextRun run = new TextRun(0, 5, (byte)0, true, 0, null, 0, false);
PGFont font = (PGFont) FontHelper.getNativeFont(Font.getDefault());
layout.layout(run, font, null, text);
}

@SuppressWarnings("deprecation")
@Ignore("JDK-8087615")
@Test public void buildRuns() {
@@ -34,6 +34,7 @@
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

import org.junit.Test;
import org.junit.AfterClass;
@@ -73,56 +74,38 @@
pane = new VBox(10);
Scene scene = new Scene(pane, 400, 200);
stage.setScene(scene);
stage.addEventHandler(WindowEvent.WINDOW_SHOWN, e -> Platform.runLater(launchLatch::countDown));
stage.show();
launchLatch.countDown();
}
}

@BeforeClass
public static void setupOnce() {
public static void setupOnce() throws Exception {
// Start the Application
new Thread(() -> Application.launch(MyApp.class, (String[]) null)).start();

try {
if (!launchLatch.await(TIMEOUT, TimeUnit.MILLISECONDS)) {
throw new AssertionFailedError("Timeout waiting for Application to launch");
}
} catch (InterruptedException ex) {
AssertionFailedError err = new AssertionFailedError("Unexpected exception");
err.initCause(ex);
throw err;
}

assertTrue("Timeout waiting for Application to launch",

Check failure on line 86 in tests/system/src/test/java/test/com/sun/javafx/font/freetype/PangoTest.java

openjdk / jcheck

Whitespace error

Column 63: trailing whitespace
launchLatch.await(TIMEOUT, TimeUnit.MILLISECONDS));
assertEquals(0, launchLatch.getCount());
}



@AfterClass
public static void teardownOnce() {
Platform.exit();
}

private void addTextToPane(Text text) {
private void addTextToPane(Text text) throws Exception {
final CountDownLatch rDone = new CountDownLatch(1);
Platform.runLater(() -> {
text.layoutYProperty().addListener(inv -> {
rDone.countDown();
});
pane.getChildren().add(text);
});

try {
if (!rDone.await(TIMEOUT, TimeUnit.MILLISECONDS)) {
throw new AssertionFailedError("Timeout waiting for runLater");
}
} catch (InterruptedException ex) {
throw new AssertionFailedError("Unexpected exception waiting for runLater");
}
assertTrue("Timeout waiting for runLater", rDone.await(TIMEOUT, TimeUnit.MILLISECONDS));
}

@Test
public void testZeroChar() {
public void testZeroChar() throws Exception {
String FULL_UNICODE_SET;
StringBuilder builder = new StringBuilder();
for (int character = 0; character < 10000; character++) {
@@ -135,7 +118,7 @@
}

@Test
public void testSurrogatePair() {
public void testSurrogatePair() throws Exception {
StringBuilder builder = new StringBuilder();
builder.append(Character.toChars(55358));
builder.append(Character.toChars(56605));
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.