選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

TestJDK12.java 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi;
  16. import org.junit.Test;
  17. import java.awt.Graphics2D;
  18. import java.awt.RenderingHints;
  19. import java.awt.font.TextLayout;
  20. import java.awt.image.BufferedImage;
  21. import java.text.AttributedString;
  22. /**
  23. * Minimal Test-Class found when running the Apache POI regression tests.
  24. *
  25. * This reproduces a crash introduced in JDK 12-ea+28 and JDK 13-ea+4
  26. *
  27. * This works in recent JDK 8, JDK 11 and at least up to JDK 12-ea+20
  28. *
  29. * https://bugs.openjdk.java.net/browse/JDK-8217768
  30. *
  31. * Should be fixed in JDK 12-ea+29 and JDK 13-ea+5
  32. */
  33. public class TestJDK12 {
  34. @Test
  35. public void test() throws Exception {
  36. BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
  37. Graphics2D graphics = img.createGraphics();
  38. graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  39. graphics.scale(200, 1);
  40. new TextLayout(new AttributedString("agriculture").getIterator(), graphics.getFontRenderContext());
  41. graphics.dispose();
  42. img.flush();
  43. }
  44. }