Validate grid width bounds and qualify Archiver window and document states in IntelliJ
This commit is contained in:
@@ -5,6 +5,33 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class GridDockDocumentTest {
|
||||
@Test
|
||||
void columnBoundsIncludeDefaultsResetsAndKnownPartsOfDynamicWidths() throws Exception {
|
||||
var doc =
|
||||
new GridDockDocument(
|
||||
"<?import de.neitzel.fx.view.*?><DataGridColumn width='230' minimumWidth='200'/>");
|
||||
var col = doc.xml.elements.getFirst();
|
||||
assertThrows(IllegalArgumentException.class, () -> doc.set(col, "width", ""));
|
||||
assertThrows(IllegalArgumentException.class, () -> doc.set(col, "minimumWidth", "300"));
|
||||
assertThrows(IllegalArgumentException.class, () -> doc.set(col, "maximumWidth", "100"));
|
||||
assertThrows(IllegalArgumentException.class, () -> doc.set(col, "width", "%size"));
|
||||
assertDoesNotThrow(() -> doc.set(col, "maximumWidth", "230"));
|
||||
assertDoesNotThrow(() -> doc.set(col, "minimumWidth", ""));
|
||||
var dynamic =
|
||||
new GridDockDocument(
|
||||
"<?import de.neitzel.fx.view.*?><DataGridColumn width='%start' maximumWidth='200'/>");
|
||||
var bound = dynamic.xml.elements.getFirst();
|
||||
assertTrue(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> dynamic.set(bound, "minimumWidth", "201"))
|
||||
.getMessage()
|
||||
.contains("%start (resolved at runtime)"));
|
||||
assertEquals(
|
||||
dynamic.xml.text.replace("200", "210"),
|
||||
dynamic.xml.source.apply(dynamic.set(bound, "maximumWidth", "210")));
|
||||
assertThrows(IllegalArgumentException.class, () -> dynamic.set(bound, "width", ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
void dockMinimaAllowZeroWithoutChangingGridColumnRules() throws Exception {
|
||||
var source =
|
||||
|
||||
Reference in New Issue
Block a user