Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Thienel2015-12-16 20:06:47 +0000
committerFlorian Thienel2015-12-16 20:12:02 +0000
commit1df876cf5531709fd15df68ae5e056d8906f6ff5 (patch)
treecfa19442e1d1edc42bdaf30039e82bc191be0d01 /org.eclipse.vex.core.tests
parenteaca2d212cc1e58de9a35e3232eb0267755fca49 (diff)
downloadorg.eclipse.mylyn.docs.vex-1df876cf5531709fd15df68ae5e056d8906f6ff5.tar.gz
org.eclipse.mylyn.docs.vex-1df876cf5531709fd15df68ae5e056d8906f6ff5.tar.xz
org.eclipse.mylyn.docs.vex-1df876cf5531709fd15df68ae5e056d8906f6ff5.zip
add support for the text-align property
Signed-off-by: Florian Thienel <florian@thienel.org>
Diffstat (limited to 'org.eclipse.vex.core.tests')
-rw-r--r--org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/boxes/TestLineArrangement.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/boxes/TestLineArrangement.java b/org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/boxes/TestLineArrangement.java
index 2591082e..d180a3d7 100644
--- a/org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/boxes/TestLineArrangement.java
+++ b/org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/boxes/TestLineArrangement.java
@@ -18,6 +18,7 @@ import java.util.Arrays;
import java.util.List;
import org.eclipse.vex.core.internal.core.FontSpec;
+import org.eclipse.vex.core.internal.core.TextAlign;
import org.eclipse.vex.core.internal.layout.FakeGraphics;
import org.junit.Before;
import org.junit.Test;
@@ -42,26 +43,26 @@ public class TestLineArrangement {
@Test
public void givenAllBoxesFitIntoOneLine_shouldArrangeBoxesInOneLine() throws Exception {
- lines.arrangeBoxes(graphics, joinableBoxes.listIterator(), 210);
+ lines.arrangeBoxes(graphics, joinableBoxes.listIterator(), 210, TextAlign.LEFT);
assertEquals(1, lines.getLines().size());
}
@Test
public void givenJoinableBoxes_whenBoxesFitIntoSameLine_shouldJoinBoxes() throws Exception {
- lines.arrangeBoxes(graphics, joinableBoxes.listIterator(), 210);
+ lines.arrangeBoxes(graphics, joinableBoxes.listIterator(), 210, TextAlign.LEFT);
assertEquals(1, joinableBoxes.size());
}
@Test
public void givenUnjoinableBoxes_whenBoxesFitIntoSameLane_shouldNotJoinBoxes() throws Exception {
- lines.arrangeBoxes(graphics, unjoinableBoxes.listIterator(), 210);
+ lines.arrangeBoxes(graphics, unjoinableBoxes.listIterator(), 210, TextAlign.LEFT);
assertEquals(3, unjoinableBoxes.size());
}
@Test
public void givenUnjoinableBoxFollowedByJoinableBoxWithoutProperSplitPointAtLineEnd_whenAdditionalBoxWithoutProperSplitPointDoesNotFitIntoLine_shouldWrapCompleteJoinedBoxIntoNextLine() throws Exception {
final List<IInlineBox> boxes = boxes(square(10), staticText("L"), staticText("or"));
- lines.arrangeBoxes(graphics, boxes.listIterator(), 18);
+ lines.arrangeBoxes(graphics, boxes.listIterator(), 18, TextAlign.LEFT);
assertEquals(2, boxes.size());
assertEquals("Lor", ((StaticText) boxes.get(1)).getText());
@@ -70,7 +71,7 @@ public class TestLineArrangement {
@Test
public void givenUnjoinableBoxFollowedByJoinableBoxWithoutProperSplitPointAtLineEnd_whenAdditionalBoxWithoutProperSplitPointDoesNotFitIntoLine_shouldRemoveOriginalLastBox() throws Exception {
final List<IInlineBox> boxes = boxes(square(10), staticText("L"), staticText("or"));
- lines.arrangeBoxes(graphics, boxes.listIterator(), 18);
+ lines.arrangeBoxes(graphics, boxes.listIterator(), 18, TextAlign.LEFT);
for (final IInlineBox box : boxes) {
if (box.getWidth() == 0) {
@@ -85,7 +86,7 @@ public class TestLineArrangement {
layout(boxes);
final int widthOfHeadBoxes = boxes.get(0).getWidth() + boxes.get(1).getWidth();
- lines.arrangeBoxes(graphics, boxes.listIterator(), widthOfHeadBoxes + 1);
+ lines.arrangeBoxes(graphics, boxes.listIterator(), widthOfHeadBoxes + 1, TextAlign.LEFT);
assertEquals(1, lines.getLines().size());
assertEquals(boxes.get(2), lines.getLines().iterator().next().getLastChild());
@@ -97,7 +98,7 @@ public class TestLineArrangement {
layout(boxes);
final int widthOfHeadBoxes = boxes.get(0).getWidth() + boxes.get(1).getWidth();
- lines.arrangeBoxes(graphics, boxes.listIterator(), widthOfHeadBoxes + 1);
+ lines.arrangeBoxes(graphics, boxes.listIterator(), widthOfHeadBoxes + 1, TextAlign.LEFT);
assertEquals(1, lines.getLines().size());
assertEquals(boxes.get(2), lines.getLines().iterator().next().getLastChild());
@@ -109,7 +110,7 @@ public class TestLineArrangement {
layout(boxes);
final int widthOfHeadBoxes = boxes.get(0).getWidth() + boxes.get(1).getWidth();
- lines.arrangeBoxes(graphics, boxes.listIterator(), widthOfHeadBoxes + 10);
+ lines.arrangeBoxes(graphics, boxes.listIterator(), widthOfHeadBoxes + 10, TextAlign.LEFT);
assertEquals(2, lines.getLines().size());
assertEquals(" ", ((StaticText) lines.getLines().iterator().next().getLastChild()).getText());
@@ -122,7 +123,7 @@ public class TestLineArrangement {
layout(boxes);
final int widthOfHeadBoxes = boxes.get(0).getWidth() + boxes.get(1).getWidth();
- lines.arrangeBoxes(graphics, boxes.listIterator(), widthOfHeadBoxes + x);
+ lines.arrangeBoxes(graphics, boxes.listIterator(), widthOfHeadBoxes + x, TextAlign.LEFT);
assertEquals("x = " + x, 2, lines.getLines().size());
assertEquals("x = " + x, " ", ((StaticText) lines.getLines().iterator().next().getLastChild()).getText());

Back to the top