Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMickael Istria2019-06-27 08:54:24 -0400
committerMickael Istria2019-06-27 16:47:40 -0400
commit42e1162be185ee9d256a21b48da94cd1df2de7eb (patch)
treee4dbec464e72cb1decb73355ebb310f5adb28444 /tests
parent4bff3373b6baf7e60d237024daf4d907c442052d (diff)
downloadeclipse.platform.swt-42e1162be185ee9d256a21b48da94cd1df2de7eb.tar.gz
eclipse.platform.swt-42e1162be185ee9d256a21b48da94cd1df2de7eb.tar.xz
eclipse.platform.swt-42e1162be185ee9d256a21b48da94cd1df2de7eb.zip
Bug 547532 - [StyledText] GlyphMetrics on tab alter
bounds Change-Id: I90c0acf10bfbef66fd6583c528b149f243cf6dc9 Signed-off-by: Mickael Istria <mistria@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java
index ea07d58f73..2614882a52 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java
@@ -5360,5 +5360,20 @@ public void test_consistency_DragDetect () {
consistencyEvent(30, 10, 50, 0, ConsistencyUtility.MOUSE_DRAG);
}
+@Test
+public void test_GlyphMetricsOnTab() {
+ text.setTabs(4);
+ text.setText("\tabcdefghijkl");
+ Rectangle boundsWithoutGlyphMetrics = text.getTextBounds(0, text.getText().length() - 1);
+ int tabWidthWithoutGlyphMetrics = text.getTextBounds(0, 0).width;
+ StyleRange range = new StyleRange(0, 1, null, null);
+ range.metrics = new GlyphMetrics(0, 0, 100);
+ text.setStyleRange(range);
+ int tabWidthWithGlyphMetrics = text.getTextBounds(0, 0).width;
+ assertEquals(range.metrics.width, tabWidthWithGlyphMetrics);
+ Rectangle boundsWithGlyphMetrics = text.getTextBounds(0, text.getText().length() - 1);
+ assertEquals("Style should change text bounds", boundsWithoutGlyphMetrics.width - tabWidthWithoutGlyphMetrics + tabWidthWithGlyphMetrics, boundsWithGlyphMetrics.width);
+}
+
}

Back to the top