alwaysFalse() {
+ return (unused) -> false;
+ }
+}
diff --git a/openhtmltopdf-examples/src/main/resources/visualtest/expected/text/columns-floats-unbalanced.pdf b/openhtmltopdf-examples/src/main/resources/visualtest/expected/text/columns-floats-unbalanced.pdf
new file mode 100644
index 000000000..54bc6f095
Binary files /dev/null and b/openhtmltopdf-examples/src/main/resources/visualtest/expected/text/columns-floats-unbalanced.pdf differ
diff --git a/openhtmltopdf-examples/src/main/resources/visualtest/expected/text/columns-nested-unbalanced.pdf b/openhtmltopdf-examples/src/main/resources/visualtest/expected/text/columns-nested-unbalanced.pdf
new file mode 100644
index 000000000..1d75ad5b9
Binary files /dev/null and b/openhtmltopdf-examples/src/main/resources/visualtest/expected/text/columns-nested-unbalanced.pdf differ
diff --git a/openhtmltopdf-examples/src/main/resources/visualtest/expected/text/columns-simple-unbalanced.pdf b/openhtmltopdf-examples/src/main/resources/visualtest/expected/text/columns-simple-unbalanced.pdf
new file mode 100644
index 000000000..109d45715
Binary files /dev/null and b/openhtmltopdf-examples/src/main/resources/visualtest/expected/text/columns-simple-unbalanced.pdf differ
diff --git a/openhtmltopdf-examples/src/main/resources/visualtest/html/text/columns-floats-unbalanced.html b/openhtmltopdf-examples/src/main/resources/visualtest/html/text/columns-floats-unbalanced.html
new file mode 100644
index 000000000..2709441d9
--- /dev/null
+++ b/openhtmltopdf-examples/src/main/resources/visualtest/html/text/columns-floats-unbalanced.html
@@ -0,0 +1,73 @@
+
+
+
+
+
+Column Support
+
+
Chapter 1
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse volutpat feugiat massa vitae congue.
+Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed non blandit nisl,
+id scelerisque sem.
+
+
Chapter 2
+
+Pellentesque sagittis maximus elit et eleifend. Mauris vitae eros quis eros bibendum bibendum.
+Cras sed massa lectus. Suspendisse mollis mi id tortor commodo, in semper eros gravida. Integer pulvinar nulla urna,
+vel sagittis leo maximus id. Nam sit amet arcu non justo molestie interdum. Phasellus gravida nisi ut bibendum feugiat.
+
+
Chapter 3
+
+This is a left float.
+
+Aenean ultricies augue vitae quam viverra, et maximus tortor eleifend.
+Duis quis venenatis turpis, eu sollicitudin magna. Proin ullamcorper sem vitae sem facilisis
+luctus. Mauris sed lectus ac nulla placerat pellentesque ut vel diam. Sed vulputate ornare sem vel placerat.
+
+
+
+Nam auctor libero ante, et volutpat arcu dictum ac.
+Class aptent taciti sociosqu ad litora torquent per conubia nostra,
+per inceptos himenaeos. Nullam non sodales augue, in efficitur turpis. Duis maximus a orci in consequat.
+
+
Chapter 4
+
+Mauris luctus nec ex et volutpat. Nullam mollis luctus ultrices. Sed malesuada porttitor dui et blandit.
+Fusce ultrices metus sem, sed vehicula sem hendrerit vel. Phasellus sed turpis eget urna luctus sagittis in eget mauris.
+Vivamus rhoncus cursus lectus vel commodo. Nunc vulputate commodo porta. Nunc eget augue nec nisl hendrerit tincidunt sit
+amet sed urna.
+
+
+
diff --git a/openhtmltopdf-examples/src/main/resources/visualtest/html/text/columns-nested-unbalanced.html b/openhtmltopdf-examples/src/main/resources/visualtest/html/text/columns-nested-unbalanced.html
new file mode 100644
index 000000000..9e79c87a3
--- /dev/null
+++ b/openhtmltopdf-examples/src/main/resources/visualtest/html/text/columns-nested-unbalanced.html
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse volutpat feugiat massa vitae congue.
+Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed non blandit nisl,
+id scelerisque sem.
+
+
+Pellentesque sagittis maximus elit et eleifend. Mauris vitae eros quis eros bibendum bibendum.
+Cras sed massa lectus. Suspendisse mollis mi id tortor commodo, in semper eros gravida. Integer pulvinar nulla urna,
+vel sagittis leo maximus id. Nam sit amet arcu non justo molestie interdum. Phasellus gravida nisi ut bibendum feugiat.
+
+
+- One
+- Two
+- Three
+- Four
+- Five
+- Vivamus rhoncus cursus lectus vel commodo. Nunc vulputate commodo porta. Nunc eget augue nec nisl hendrerit tincidunt sit
+amet sed urna.
+
+
+
+In vitae nulla nec sapien imperdiet interdum eget et sem.
+
+
+Aenean ultricies augue vitae quam viverra, et maximus tortor eleifend. Duis quis venenatis turpis, eu sollicitudin magna.
+Proin ullamcorper sem vitae sem facilisis luctus. Mauris sed lectus ac nulla placerat pellentesque ut vel diam.
+Sed vulputate ornare sem vel placerat.
+
+
+Nam auctor libero ante, et volutpat arcu dictum ac. Class aptent taciti sociosqu ad litora torquent per conubia nostra,
+per inceptos himenaeos. Nullam non sodales augue, in efficitur turpis. Duis maximus a orci in consequat.
+Mauris luctus nec ex et volutpat. Nullam mollis luctus ultrices. Sed malesuada porttitor dui et blandit.
+
+
+
+
diff --git a/openhtmltopdf-examples/src/main/resources/visualtest/html/text/columns-simple-unbalanced.html b/openhtmltopdf-examples/src/main/resources/visualtest/html/text/columns-simple-unbalanced.html
new file mode 100644
index 000000000..bf9fbdf42
--- /dev/null
+++ b/openhtmltopdf-examples/src/main/resources/visualtest/html/text/columns-simple-unbalanced.html
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse volutpat feugiat massa vitae congue.
+Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed non blandit nisl,
+id scelerisque sem. Pellentesque sagittis maximus elit et eleifend. Mauris vitae eros quis eros bibendum bibendum.
+Cras sed massa lectus. Suspendisse mollis mi id tortor commodo, in semper eros gravida. Integer pulvinar nulla urna,
+vel sagittis leo maximus id. Nam sit amet arcu non justo molestie interdum. Phasellus gravida nisi ut bibendum feugiat.
+In vitae nulla nec sapien imperdiet interdum eget et sem. Aenean ultricies augue vitae quam viverra, et
+maximus tortor eleifend. Duis quis venenatis turpis, eu sollicitudin magna. Proin ullamcorper sem vitae sem facilisis
+luctus. Mauris sed lectus ac nulla placerat pellentesque ut vel diam. Sed vulputate ornare sem vel placerat.
+Nam auctor libero ante, et volutpat arcu dictum ac. Class aptent taciti sociosqu ad litora torquent per conubia nostra,
+per inceptos himenaeos. Nullam non sodales augue, in efficitur turpis. Duis maximus a orci in consequat.
+Mauris luctus nec ex et volutpat. Nullam mollis luctus ultrices. Sed malesuada porttitor dui et blandit.
+Fusce ultrices metus sem, sed vehicula sem hendrerit vel. Phasellus sed turpis eget urna luctus sagittis in eget mauris.
+Vivamus rhoncus cursus lectus vel commodo. Nunc vulputate commodo porta. Nunc eget augue nec nisl hendrerit tincidunt sit
+amet sed urna.
+
+
+
diff --git a/openhtmltopdf-examples/src/test/java/com/openhtmltopdf/visualregressiontests/TextVisualRegressionTest.java b/openhtmltopdf-examples/src/test/java/com/openhtmltopdf/visualregressiontests/TextVisualRegressionTest.java
index 684ee4bce..7adb5b889 100644
--- a/openhtmltopdf-examples/src/test/java/com/openhtmltopdf/visualregressiontests/TextVisualRegressionTest.java
+++ b/openhtmltopdf-examples/src/test/java/com/openhtmltopdf/visualregressiontests/TextVisualRegressionTest.java
@@ -614,4 +614,30 @@ public void testJustifySpaceAtEnd() throws IOException {
assertTrue(vtester.runTest("text-justify-space-at-end", WITH_COLLAPSED_LINE_BREAKER));
}
+ /**
+ * Tests that flowing columns containing only text in unbalanced mode
+ * are correctly laid out.
+ */
+ @Test
+ public void testColumnsSimpleUnbalanced() throws IOException {
+ assertTrue(run("columns-simple-unbalanced"));
+ }
+
+ /**
+ * Tests columns with nested content such as paragraphs, lists and span.
+ */
+ @Test
+ public void testColumnsNestedUnbalanced() throws IOException {
+ assertTrue(run("columns-nested-unbalanced"));
+ }
+
+ /**
+ * Tests columns containing floated and clear elements.
+ * Also tests explicit column breaks.
+ */
+ @Test
+ public void testColumnsFloatsUnbalanced() throws IOException {
+ assertTrue(run("columns-floats-unbalanced"));
+ }
+
}