RFR: 8319844 : Text/TextFlow.hitTest() is incorrect in RTL orientation [v13]
John Hendrikx
jhendrikx at openjdk.org
Thu Feb 29 17:36:00 UTC 2024
On Thu, 29 Feb 2024 15:59:58 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> I disagree on this. The code is complicated and full of branches. Manual testing is very error prone. However, since you restored most of the code to its original (which wasn't tested either) I could live with it. Still, here's a small test that you could use to verify correct hits:
>>
>>
>> /*
>> * Copyright (c) 2012, 2023, 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.
>> */
>>
>> package test.com.sun.javafx.text;
>>
>> import static org.junit.Assume.assumeTrue;
>> import static org.junit.jupiter.api.Assertions.assertEquals;
>>
>> import org.junit.jupiter.api.Test;
>>
>> import com.sun.javafx.font.PGFont;
>> import com.sun.javafx.geom.RectBounds;
>> import com.sun.javafx.scene.text.FontHelper;
>> import com.sun.javafx.scene.text.TextLayout.Hit;
>> import com.sun.javafx.scene.text.TextSpan;
>> import com.sun.javafx.text.PrismTextLayout;
>>
>> import javafx.scene.text.Font;
>>
>> public class TextLayoutTest {
>> private final PrismTextLayout layout = new PrismTextLayout();
>> private final PGFont arialFont = (PGFont) FontHelper.getNativeFont(Font.font("Arial", 12));
>>
>> record TestSpan(String text, Object font) implements TextSpan {
>> @Override
>> public String getText() {
>> return text;
>> }
>>
>> @Override
>> public Object getFont() {
>> retur...
>
> @hjohn how do you get this coverage diagram?
>
> The BreakIterator is a part of the existing code, we should probably have this discussion outside of this PR. I agree, there might be a situation when the app wants to select a specific locale for the text component instead of relying on the default locale.
@andy-goryachev-oracle The coverage comes from EclEmma, an Eclipse plugin. Once installed, there is another way to run tests called `Coverage as...` just above `Run as...`. It's very useful to use it on a JUnit test to see if there are major branches you missed in testing that may require additional cases.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1323#discussion_r1507945798
More information about the openjfx-dev
mailing list