Skip to content

Commit

Permalink
add test for newStyleFromCurrent()
Browse files Browse the repository at this point in the history
  • Loading branch information
koentsje committed Apr 9, 2014
1 parent 0afbf29 commit 01d902c
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,24 @@ public void testRestoreCursor() {
Assert.assertTrue(cursorMoved);
}

@Test
public void testNewStyleFromCurrent() {
documentImpl.delegateDocument = testDocument;
StyleRange oldRange = new StyleRange(5, 10, ColorConstants.BLUE, ColorConstants.CYAN);
oldRange.font = FontManager.INSTANCE.getItalicBold();
StyleImpl oldStyle = new StyleImpl(oldRange);
documentImpl.currentStyle = oldStyle;
Style style = documentImpl.newStyleFromCurrent();
Assert.assertTrue(style instanceof StyleImpl);
StyleImpl styleImpl = (StyleImpl)style;
Assert.assertEquals(0, styleImpl.getLength());
Assert.assertEquals(15, styleImpl.getStart());
StyleRange styleRange = styleImpl.styleRange;
Assert.assertEquals(ColorConstants.BLUE, styleRange.foreground);
Assert.assertEquals(ColorConstants.CYAN, styleRange.background);
Assert.assertEquals(FontManager.INSTANCE.getItalicBold(), styleRange.font);
Assert.assertEquals(15, styleRange.start);
Assert.assertEquals(0, styleRange.length);
}

}

0 comments on commit 01d902c

Please sign in to comment.