use of com.intellij.testFramework.MockFontLayoutService in project intellij-community by JetBrains.
the class AbstractEditorTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
FontLayoutService.setInstance(new MockFontLayoutService(TEST_CHAR_WIDTH, TEST_LINE_HEIGHT, TEST_DESCENT));
}
use of com.intellij.testFramework.MockFontLayoutService in project intellij-community by JetBrains.
the class EditorPaintingTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
FontLayoutService.setInstance(new MockFontLayoutService(BitmapFont.CHAR_WIDTH, BitmapFont.CHAR_HEIGHT, BitmapFont.CHAR_DESCENT));
}
use of com.intellij.testFramework.MockFontLayoutService in project intellij-community by JetBrains.
the class ComplexTextFragmentTest method assertCaretPositionsForGlyphVector.
private static void assertCaretPositionsForGlyphVector(MyGlyphVector gv, int... expectedPositions) {
FontLayoutService.setInstance(new MockFontLayoutService(TEST_CHAR_WIDTH, TEST_LINE_HEIGHT, TEST_DESCENT) {
@NotNull
@Override
public GlyphVector layoutGlyphVector(@NotNull Font font, @NotNull FontRenderContext fontRenderContext, @NotNull char[] chars, int start, int end, boolean isRtl) {
return gv;
}
});
try {
int length = gv.getNumChars();
char[] text = new char[length];
FontInfo fontInfo = new FontInfo(Font.MONOSPACED, 1, Font.PLAIN, false, new FontRenderContext(null, false, false));
ComplexTextFragment fragment = new ComplexTextFragment(text, 0, length, (gv.getLayoutFlags() & GlyphVector.FLAG_RUN_RTL) != 0, fontInfo);
int[] charPositions = new int[length];
for (int i = 0; i < length; i++) {
charPositions[i] = (int) fragment.visualColumnToX(0, i + 1);
}
assertArrayEquals(expectedPositions, charPositions);
} finally {
FontLayoutService.setInstance(null);
}
}
Aggregations