Search in sources :

Example 56 with StyleRange

use of org.eclipse.swt.custom.StyleRange in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_custom_StyleRange method test_equalsLjava_lang_Object.

@Test
public void test_equalsLjava_lang_Object() {
    StyleRange styleRangeA = new StyleRange(5, 10, getColor(RED), getColor(BLUE), SWT.BOLD);
    StyleRange styleRangeB = new StyleRange(5, 10, getColor(RED), getColor(BLUE), SWT.BOLD);
    StyleRange styleRangeC = new StyleRange(5, 10, getColor(BLUE), getColor(BLUE), SWT.BOLD);
    StyleRange styleRangeD = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.BOLD);
    StyleRange styleRangeE = new StyleRange(5, 11, getColor(RED), getColor(BLUE), SWT.BOLD);
    StyleRange styleRangeF = new StyleRange(5, 11, getColor(RED), getColor(RED), SWT.BOLD);
    StyleRange styleRangeG = new StyleRange(5, 11, getColor(RED), getColor(BLUE), SWT.NORMAL);
    assertTrue(":d:", styleRangeA.equals(styleRangeB));
    assertTrue(":d:", !styleRangeA.equals(styleRangeC));
    assertTrue(":d:", !styleRangeA.equals(styleRangeD));
    assertTrue(":d:", !styleRangeA.equals(styleRangeE));
    assertTrue(":d:", !styleRangeA.equals(styleRangeF));
    assertTrue(":d:", !styleRangeA.equals(styleRangeG));
}
Also used : StyleRange(org.eclipse.swt.custom.StyleRange) Test(org.junit.Test)

Example 57 with StyleRange

use of org.eclipse.swt.custom.StyleRange in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_custom_StyleRange method test_isUnstyled.

@Test
public void test_isUnstyled() {
    StyleRange styleRangeA = new StyleRange(5, 10, null, null, SWT.NORMAL);
    StyleRange styleRangeB = new StyleRange(5, 10, getColor(RED), null, SWT.NORMAL);
    StyleRange styleRangeC = new StyleRange(5, 10, null, null, SWT.BOLD);
    StyleRange styleRangeD = new StyleRange(6, 10, null, getColor(BLUE), SWT.NORMAL);
    StyleRange styleRangeE = new StyleRange(5, 10, null, null);
    assertTrue(":e:", styleRangeA.isUnstyled());
    assertTrue(":e:", !styleRangeB.isUnstyled());
    assertTrue(":e:", !styleRangeC.isUnstyled());
    assertTrue(":e:", !styleRangeD.isUnstyled());
    assertTrue(":e:", styleRangeE.isUnstyled());
}
Also used : StyleRange(org.eclipse.swt.custom.StyleRange) Test(org.junit.Test)

Example 58 with StyleRange

use of org.eclipse.swt.custom.StyleRange in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_custom_StyleRange method test_toString.

@Test
public void test_toString() {
    StyleRange styleRange = new StyleRange(6, 10, null, getColor(BLUE), SWT.NORMAL);
    styleRange.toString();
}
Also used : StyleRange(org.eclipse.swt.custom.StyleRange) Test(org.junit.Test)

Example 59 with StyleRange

use of org.eclipse.swt.custom.StyleRange in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_custom_StyleRange method test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI.

@Test
public void test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI() {
    StyleRange styleRange = new StyleRange(5, 10, getColor(RED), getColor(BLUE), SWT.BOLD);
    assertTrue(":c:", styleRange.start == 5);
    assertTrue(":c:", styleRange.length == 10);
    assertTrue(":c:", styleRange.foreground == getColor(RED));
    assertTrue(":c:", styleRange.background == getColor(BLUE));
    assertTrue(":c:", styleRange.fontStyle == SWT.BOLD);
}
Also used : StyleRange(org.eclipse.swt.custom.StyleRange) Test(org.junit.Test)

Example 60 with StyleRange

use of org.eclipse.swt.custom.StyleRange in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_custom_StyleRange method test_similarToLorg_eclipse_swt_custom_StyleRange.

@Test
public void test_similarToLorg_eclipse_swt_custom_StyleRange() {
    StyleRange styleRangeA = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.NORMAL);
    StyleRange styleRangeB = new StyleRange(5, 5, getColor(RED), getColor(BLUE), SWT.NORMAL);
    StyleRange styleRangeC = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.NORMAL);
    StyleRange styleRangeD = new StyleRange(6, 10, getColor(BLUE), getColor(BLUE), SWT.NORMAL);
    StyleRange styleRangeE = new StyleRange(6, 10, getColor(RED), getColor(RED), SWT.NORMAL);
    StyleRange styleRangeF = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.BOLD);
    assertTrue(":f:", styleRangeA.similarTo(styleRangeB));
    assertTrue(":f:", styleRangeA.similarTo(styleRangeC));
    assertTrue(":f:", !styleRangeA.similarTo(styleRangeD));
    assertTrue(":f:", !styleRangeA.similarTo(styleRangeE));
    assertTrue(":f:", !styleRangeA.similarTo(styleRangeF));
}
Also used : StyleRange(org.eclipse.swt.custom.StyleRange) Test(org.junit.Test)

Aggregations

StyleRange (org.eclipse.swt.custom.StyleRange)145 Point (org.eclipse.swt.graphics.Point)52 Test (org.junit.Test)39 ArrayList (java.util.ArrayList)25 Color (org.eclipse.swt.graphics.Color)22 StyledText (org.eclipse.swt.custom.StyledText)13 Font (org.eclipse.swt.graphics.Font)10 GlyphMetrics (org.eclipse.swt.graphics.GlyphMetrics)10 Matcher (java.util.regex.Matcher)9 FontData (org.eclipse.swt.graphics.FontData)8 RGB (org.eclipse.swt.graphics.RGB)8 Rectangle (org.eclipse.swt.graphics.Rectangle)7 IOException (java.io.IOException)5 TextPresentation (org.eclipse.jface.text.TextPresentation)5 Image (org.eclipse.swt.graphics.Image)5 Control (org.eclipse.swt.widgets.Control)5 Position (org.eclipse.jface.text.Position)4 TextStyle (org.eclipse.swt.graphics.TextStyle)4 BufferedReader (java.io.BufferedReader)3 InputStreamReader (java.io.InputStreamReader)3