Skip to content

Commit 3ba0d2b

Browse files
committed
Fix DocumentationCoverageTest after slim README rewrite
CI was red after v1.5.0 because four section-anchored guards in DocumentationCoverageTest expected README sections that the slim landing-page rewrite removed: - readmeQuickStartShouldUseCanonicalDsl anchored on "### Built-in templates (compose-first)" - readmeLinePrimitiveSectionShouldUseCanonicalDsl anchored on "## Line primitive" - readmeTableSectionShouldUseCanonicalDsl anchored on "## Table component" - readmeContainerGuidanceShouldPreferCanonicalDsl anchored on "### 4. Containers express structure" Those sections were intentionally cut to slim README from 778 → 151 lines; their content lives in docs/recipes/{tables,shapes,themes}.md and examples/README.md now. Replaced the four section-specific tests with one consolidated guard (readmeShouldUseCanonicalDslAndAvoidLegacyApis) that scans the whole README: - Asserts canonical-DSL fingerprints (GraphCompose.document, DocumentSession, document.pageFlow, BusinessTheme) appear at least once - Asserts no legacy markers anywhere in the README — same blocklist as before plus PdfComposer / TemplateBuilder / MainPageCV / MainPageCvDTO / ModuleYml so the guard now matches what CanonicalSurfaceGuardTest enforces for documentation files Net test delta: -4 + 1 = -3 tests. Suite count drops 675 → 672. README footer claim updated to match. JitPack publishes via -DskipTests (jitpack.yml), so the v1.5.0 artifact is unaffected — this is a CI-only hotfix.
1 parent 9daba12 commit 3ba0d2b

2 files changed

Lines changed: 29 additions & 70 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Most Java PDF libraries hand you low-level drawing commands. GraphCompose gives
2727
- **Atomic pagination, no manual paging.** Tables split row-by-row, rows are atomic, layer stacks are atomic.
2828
- **Designer-grade output.** Page backgrounds, section bands, soft panels, accent strips, column spans, layered hero blocks, fluent rich text, and a tokenised `BusinessTheme` are all first-class — not workarounds.
2929
- **PDFBox rendering, isolated.** PDF backend lives behind a single backend interface. The DOCX backend (Apache POI) is ready for callers who need an editable file.
30-
- **Tested at every layer.** 675 green tests on `develop` (525 → 675 across v1.5), including cinematic-feature tests, shape-as-container clip-path invariants, transform CTM checks, table row-span / zebra / repeated-header tests, public-API leak guards, and a `PdfVisualRegression` harness.
30+
- **Tested at every layer.** 672 green tests on `develop` (525 → 672 across v1.5), including cinematic-feature tests, shape-as-container clip-path invariants, transform CTM checks, table row-span / zebra / repeated-header tests, public-API leak guards, and a `PdfVisualRegression` harness.
3131

3232
The current release is **v1.5.0** — the "intuitive" release. v1.5 turns the surface intuitive: shape-as-container with clip path, rotate / scale + per-layer z-index, advanced tables (row span, zebra, totals, repeating header), and two new theme-driven cinematic templates (`InvoiceTemplateV2`, `ProposalTemplateV2`). v1.5 is fully source-compatible with v1.4 — every public record gained back-compat constructors that default the new fields. See [`docs/migration-v1-4-to-v1-5.md`](docs/migration-v1-4-to-v1-5.md).
3333

src/test/java/com/demcha/documentation/DocumentationCoverageTest.java

Lines changed: 28 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -136,77 +136,36 @@ void highLevelApiAnchorsShouldRetainMethodJavadocs() throws IOException {
136136
}
137137

138138
@Test
139-
void readmeQuickStartShouldUseCanonicalDsl() throws IOException {
139+
void readmeShouldUseCanonicalDslAndAvoidLegacyApis() throws IOException {
140140
String readme = Files.readString(PROJECT_ROOT.resolve("README.md"));
141-
int quickStart = readme.indexOf("## Quick start");
142-
int builtIns = readme.indexOf("### Built-in templates (compose-first)");
143-
assertThat(quickStart).isGreaterThanOrEqualTo(0);
144-
assertThat(builtIns).isGreaterThan(quickStart);
145-
146-
String quickStartSection = readme.substring(quickStart, builtIns);
147-
assertThat(quickStartSection).contains("GraphCompose.document(Path.of(\"output.pdf\"))");
148-
assertThat(quickStartSection).contains("document.pageFlow(page -> page");
149-
assertThat(quickStartSection).contains(".module(\"Summary\", module -> module.paragraph(\"Hello GraphCompose\"))");
150-
assertThat(quickStartSection).doesNotContain("import com.demcha.compose.engine");
151-
assertThat(quickStartSection).doesNotContain("document.dsl()");
152-
assertThat(quickStartSection).doesNotContain("try (PdfComposer composer = GraphCompose.pdf(");
153-
}
154-
155-
@Test
156-
void readmeLinePrimitiveSectionShouldUseCanonicalDsl() throws IOException {
157-
String readme = Files.readString(PROJECT_ROOT.resolve("README.md"));
158-
int linePrimitive = readme.indexOf("## Line primitive");
159-
int architecture = readme.indexOf("## Architecture at a glance");
160-
assertThat(linePrimitive).isGreaterThanOrEqualTo(0);
161-
assertThat(architecture).isGreaterThan(linePrimitive);
162-
163-
String linePrimitiveSection = readme.substring(linePrimitive, architecture);
164-
assertThat(linePrimitiveSection).contains("document.pageFlow()");
165-
assertThat(linePrimitiveSection).contains(".addDivider(");
166-
assertThat(linePrimitiveSection).contains(".addShape(");
167-
assertThat(linePrimitiveSection).contains("DocumentColor.ROYAL_BLUE");
168-
assertThat(linePrimitiveSection).doesNotContain("ComponentColor.");
169-
assertThat(linePrimitiveSection).doesNotContain("document.dsl()");
170-
assertThat(linePrimitiveSection).doesNotContain("composer.componentBuilder()");
171-
assertThat(linePrimitiveSection).doesNotContain("GraphCompose.pdf(");
172-
}
173141

174-
@Test
175-
void readmeTableSectionShouldUseCanonicalDsl() throws IOException {
176-
String readme = Files.readString(PROJECT_ROOT.resolve("README.md"));
177-
int tableComponent = readme.indexOf("## Table component");
178-
int linePrimitive = readme.indexOf("## Line primitive");
179-
assertThat(tableComponent).isGreaterThanOrEqualTo(0);
180-
assertThat(linePrimitive).isGreaterThan(tableComponent);
181-
182-
String tableSection = readme.substring(tableComponent, linePrimitive);
183-
assertThat(tableSection).contains("document.pageFlow()");
184-
assertThat(tableSection).contains(".addTable(");
185-
assertThat(tableSection).contains(".header(");
186-
assertThat(tableSection).contains(".rows(");
187-
assertThat(tableSection).contains("DocumentTableColumn.fixed(90)");
188-
assertThat(tableSection).doesNotContain("TableColumnLayout.");
189-
assertThat(tableSection).doesNotContain("TableCellLayoutStyle.");
190-
assertThat(tableSection).doesNotContain(".row(\"Role\", \"Owner\", \"Status\")");
191-
assertThat(tableSection).doesNotContain("document.dsl()");
192-
assertThat(tableSection).doesNotContain("composer.componentBuilder()");
193-
assertThat(tableSection).doesNotContain("GraphCompose.pdf(");
194-
}
195-
196-
@Test
197-
void readmeContainerGuidanceShouldPreferCanonicalDsl() throws IOException {
198-
String readme = Files.readString(PROJECT_ROOT.resolve("README.md"));
199-
int containers = readme.indexOf("### 4. Containers express structure");
200-
int templateLayer = readme.indexOf("### 5. The template layer is optional");
201-
assertThat(containers).isGreaterThanOrEqualTo(0);
202-
assertThat(templateLayer).isGreaterThan(containers);
203-
204-
String containersSection = readme.substring(containers, templateLayer);
205-
assertThat(containersSection).contains("document.pageFlow()");
206-
assertThat(containersSection).contains("section()");
207-
assertThat(containersSection).doesNotContain("vContainer(");
208-
assertThat(containersSection).doesNotContain("hContainer(");
209-
assertThat(containersSection).doesNotContain("moduleBuilder(");
142+
// Canonical-DSL fingerprints — the slim v1.5 landing README must
143+
// surface at least one example using the canonical authoring path.
144+
assertThat(readme).contains("GraphCompose.document(");
145+
assertThat(readme).contains("DocumentSession");
146+
assertThat(readme).contains("document.pageFlow(");
147+
assertThat(readme).contains("BusinessTheme");
148+
149+
// Legacy-API guard — the README may not advertise any retired
150+
// entry point, builder shape, or pre-canonical field-based CV
151+
// type, even if examples that demonstrate them still exist
152+
// elsewhere in the codebase.
153+
assertThat(readme)
154+
.doesNotContain("import com.demcha.compose.engine")
155+
.doesNotContain("document.dsl()")
156+
.doesNotContain("composer.componentBuilder()")
157+
.doesNotContain("GraphCompose.pdf(")
158+
.doesNotContain("PdfComposer")
159+
.doesNotContain("TemplateBuilder")
160+
.doesNotContain("ComponentColor.")
161+
.doesNotContain("TableColumnLayout.")
162+
.doesNotContain("TableCellLayoutStyle.")
163+
.doesNotContain("vContainer(")
164+
.doesNotContain("hContainer(")
165+
.doesNotContain("moduleBuilder(")
166+
.doesNotContain("MainPageCV")
167+
.doesNotContain("MainPageCvDTO")
168+
.doesNotContain("ModuleYml");
210169
}
211170

212171
@Test

0 commit comments

Comments
 (0)