mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-22 04:55:10 +00:00
Merge branch 'plantuml:master' into ImproveDoc
This commit is contained in:
commit
5fd1fb06de
12
BUILDING.md
12
BUILDING.md
@ -107,3 +107,15 @@ ant
|
||||
```
|
||||
|
||||
If you have Ant set up correctly and the prerequisites are met, the build process should start, and the project will be built based on the instructions in the `build.xml`.
|
||||
|
||||
|
||||
## About the `graphviz.dat` file
|
||||
|
||||
Within certain PlantUML releases, we've incorporated an embedded, compiled version of GraphViz specifically tailored for Windows. This initiative was taken to streamline the user experience for our Windows users, eliminating the need for them to undertake separate installations or configurations.
|
||||
|
||||
This version of GraphViz is a product of the [graphviz-distributions project](https://github.com/plantuml/graphviz-distributions). For efficient distribution, it is compressed using Brotli and subsequently stored within the [graphviz.dat file](https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/windowsdot).
|
||||
|
||||
If you're not on a Windows platform (e.g., Linux users), you can safely remove this file. However, for Windows users, removing it implies you'd need to install GraphViz independently.
|
||||
|
||||
To streamline our distribution process and given the existing six PlantUML versions resulting from varied licensing, we chose not to double this count to 12 with a dichotomy of versions containing the embedded GraphViz and those without. Instead, all our distributions, barring the LGPL one, come with the embedded GraphViz. For those who prefer a version without the embedded GraphViz, the LGPL distribution would be the go-to choice.
|
||||
|
||||
|
@ -13,6 +13,7 @@ plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
signing
|
||||
// id("com.adarshr.test-logger") version "3.2.0"
|
||||
}
|
||||
|
||||
group = "net.sourceforge.plantuml"
|
||||
@ -28,9 +29,14 @@ java {
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.apache.ant:ant:1.10.13")
|
||||
|
||||
testImplementation("io.github.glytching:junit-extensions:2.6.0")
|
||||
testImplementation("org.assertj:assertj-core:3.24.2")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
|
||||
testImplementation("org.mockito:mockito-core:4.+")
|
||||
testImplementation("org.mockito:mockito-junit-jupiter:4.+")
|
||||
testImplementation("org.scilab.forge:jlatexmath:1.0.7")
|
||||
|
||||
"pdfRuntimeOnly"("org.apache.xmlgraphics:fop:2.8")
|
||||
"pdfRuntimeOnly"("org.apache.xmlgraphics:batik-all:1.16")
|
||||
}
|
||||
|
81
docs/TESTING.md
Normal file
81
docs/TESTING.md
Normal file
@ -0,0 +1,81 @@
|
||||
# Testing PlantUML
|
||||
|
||||
## Prerequisites
|
||||
|
||||
See the [Building page](../BUILDING.md) and especilay the paragraph [Building PlantUML with Gradle](../BUILDING.md#building-plantuml-with-gradle).
|
||||
|
||||
## Running Tests
|
||||
|
||||
### Run all tests, for all licences
|
||||
|
||||
To run the tests included with the project, use the following command:
|
||||
|
||||
```sh
|
||||
gradle test
|
||||
```
|
||||
|
||||
### Run a specific test, for only one licence
|
||||
|
||||
Comment those lines on [`settings.gradle.kts`](../settings.gradle.kts):
|
||||
|
||||
https://github.com/plantuml/plantuml/blob/a327d636a7fcc7f05a88b796a2838da16e2ba3e3/settings.gradle.kts#L12-L16
|
||||
|
||||
Then you can run a specific test _(e.g. the `aTestClass` Class)_:
|
||||
```sh
|
||||
gradle test --tests aTestClass
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
After successfully building and testing the project, you are ready to start [contributing](../CONTRIBUTING.md) to PlantUML!
|
||||
If you have any changes to contribute, please submit a pull request through the [PlantUML GitHub repository](https://github.com/plantuml/plantuml).
|
||||
|
||||
|
||||
## Test Directory Architecture
|
||||
|
||||
- [test/](../test)
|
||||
- [com/plantuml/wasm](../test/com/plantuml/wasm)
|
||||
- [net/sourceforge/plantuml](../test/net/sourceforge/plantuml)
|
||||
- [nonreg](../test/nonreg)
|
||||
|
||||
```mermaid
|
||||
%%{ init : { "flowchart" : { "curve" : "stepBefore" }}}%%
|
||||
graph LR
|
||||
T["test/"]
|
||||
T -->|"Unit Test\n(of src/com/plantuml/api/cheerpj)"| W["com/plantuml/wasm"]
|
||||
T -->|"Unit Test\n(of src/net/sourceforge/plantuml)"| U["net/sourceforge/plantuml"]
|
||||
T -->|"Non-regression Test"| N[nonreg]
|
||||
```
|
||||
|
||||
## Additional Resources
|
||||
|
||||
### Gradle
|
||||
- site: [Gradle](https://gradle.org)
|
||||
- doc: [Gradle User Guide](https://docs.gradle.org/current/userguide/userguide.html)
|
||||
- src: [:octocat:Gradle](https://github.com/gradle/gradle)
|
||||
|
||||
### Gradle Plugins
|
||||
- site: [Gradle Plugins Search](https://plugins.gradle.org)
|
||||
- A "gradle test logger plugin"
|
||||
- src: [:octocat:radarsh/gradle-test-logger-plugin](https://github.com/radarsh/gradle-test-logger-plugin)
|
||||
|
||||
### JUnit
|
||||
- site: [JUnit5](https://junit.org/junit5/)
|
||||
- doc: [JUnit User Guide](https://junit.org/junit5/docs/current/user-guide/)
|
||||
- src: [:octocat:JUnit-team](https://github.com/junit-team)
|
||||
|
||||
### JUnit extensions
|
||||
- doc: [JUnit extensions](https://junit.org/junit5/docs/current/user-guide/#extensions)
|
||||
- The "Glytching" JUnit extensions
|
||||
- doc: [Glytching JUnit extensions](https://glytching.github.io/junit-extensions/)
|
||||
- doc: [`randomBeans` doc](https://glytching.github.io/junit-extensions/randomBeans)
|
||||
- src: [:octocat:glytching/junit-extensions](https://github.com/glytching/junit-extensions)
|
||||
|
||||
### AssertJ
|
||||
- doc: [AssertJ](https://assertj.github.io/doc/)
|
||||
- src: [:octocat:AssertJ](https://github.com/assertj/assertj)
|
||||
|
||||
### Mockito
|
||||
- site: [Mockito](https://site.mockito.org)
|
||||
- doc: [Mockito doc.](https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html)
|
||||
- src: [:octocat:Mockito](https://github.com/mockito/mockito)
|
18
src/net/sourceforge/plantuml/activitydiagram/readme.md
Normal file
18
src/net/sourceforge/plantuml/activitydiagram/readme.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Directory Documentation for `activitydiagram`
|
||||
|
||||
## Description
|
||||
This package provides classes used to manage [Activity Diagram (legacy)](https://plantuml.com/activity-diagram-legacy)
|
||||
|
||||
For new syntax see [`activitydiagram3`](../activitydiagram3)
|
||||
and [Activity Diagram (New Syntax)](https://plantuml.com/activity-diagram-beta)
|
||||
|
||||
## Link
|
||||
- [Activity Diagram (legacy)](https://plantuml.com/activity-diagram-legacy)
|
||||
- [Activity Diagram (New Syntax)](https://plantuml.com/activity-diagram-beta)
|
||||
|
||||
## Reference
|
||||
|
||||
## Credit
|
||||
|
||||
## Misc.
|
||||
|
@ -662,7 +662,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit
|
||||
return colorSet;
|
||||
}
|
||||
|
||||
public void setStartingDate(Day start) {
|
||||
public void setProjectStartingDate(Day start) {
|
||||
openClose.setStartingDay(start);
|
||||
this.min = start;
|
||||
}
|
||||
|
@ -50,11 +50,11 @@ public class SentenceTaskEndsAbsolute extends SentenceSimple {
|
||||
public CommandExecutionResult execute(GanttDiagram project, Object subject, Object complement) {
|
||||
final Task task = (Task) subject;
|
||||
final Day end = (Day) complement;
|
||||
// final Day startingDate = project.getStartingDate();
|
||||
// if (startingDate == null) {
|
||||
// return CommandExecutionResult.error("No starting date for the project");
|
||||
// }
|
||||
final Day startingDate = project.getStartingDate();
|
||||
if (startingDate.getAbsoluteDayNum() == 0)
|
||||
return CommandExecutionResult.error("No starting date for the project");
|
||||
task.setEnd(end);
|
||||
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
|
@ -56,10 +56,10 @@ public class SentenceTaskStarts extends SentenceSimple {
|
||||
HColor color = null;
|
||||
when = (TaskInstant) complement;
|
||||
task.setStart(when.getInstantPrecise());
|
||||
if (when.isTask()) {
|
||||
if (when.isTask())
|
||||
project.addContraint(new GanttConstraint(project.getIHtmlColorSet(), project.getCurrentStyleBuilder(), when,
|
||||
new TaskInstant(task, TaskAttribute.START), color));
|
||||
}
|
||||
|
||||
return CommandExecutionResult.ok();
|
||||
|
||||
};
|
||||
|
@ -50,10 +50,10 @@ public class SentenceTaskStartsAbsolute extends SentenceSimple {
|
||||
public CommandExecutionResult execute(GanttDiagram project, Object subject, Object complement) {
|
||||
final Task task = (Task) subject;
|
||||
final Day start = (Day) complement;
|
||||
// final Day startingDate = project.getStartingDate();
|
||||
// if (startingDate == null) {
|
||||
// return CommandExecutionResult.error("No starting date for the project");
|
||||
// }
|
||||
final Day startingDate = project.getStartingDate();
|
||||
if (startingDate.getAbsoluteDayNum() == 0)
|
||||
project.setProjectStartingDate(start);
|
||||
|
||||
task.setStart(start);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class SubjectProject implements Subject {
|
||||
public CommandExecutionResult execute(GanttDiagram project, Object subject, Object complement) {
|
||||
final Day start = (Day) complement;
|
||||
assert project == subject;
|
||||
project.setStartingDate(start);
|
||||
project.setProjectStartingDate(start);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
|
122
test/net/sourceforge/plantuml/utils/LineLocationImplTest.java
Normal file
122
test/net/sourceforge/plantuml/utils/LineLocationImplTest.java
Normal file
@ -0,0 +1,122 @@
|
||||
package net.sourceforge.plantuml.utils;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import io.github.glytching.junit.extension.random.Random;
|
||||
import io.github.glytching.junit.extension.random.RandomBeansExtension;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.jupiter.api.extension.Extensions;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
@Extensions({
|
||||
@ExtendWith(MockitoExtension.class),
|
||||
@ExtendWith(RandomBeansExtension.class)
|
||||
})
|
||||
|
||||
class LineLocationImplTest {
|
||||
@Mock
|
||||
private LineLocation parent;
|
||||
@Mock
|
||||
private LineLocation parent2;
|
||||
|
||||
@Random
|
||||
private String desc;
|
||||
@Random
|
||||
private String desc2;
|
||||
|
||||
@Test
|
||||
void ctorDestArgMustNotBeNull() {
|
||||
assertDoesNotThrow(() -> new LineLocationImpl(desc, null));
|
||||
assertThrows(NullPointerException.class, () -> new LineLocationImpl(null, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
void initialPositionIsNegativeOne() {
|
||||
LineLocation loc = new LineLocationImpl(desc, null);
|
||||
assertEquals(-1, loc.getPosition());
|
||||
}
|
||||
|
||||
@Test
|
||||
void parentSameAsProvided() {
|
||||
LineLocation loc = new LineLocationImpl(desc, parent);
|
||||
assertSame(parent, loc.getParent());
|
||||
}
|
||||
|
||||
@Test
|
||||
void descriptionSameAsProvided() {
|
||||
LineLocation loc = new LineLocationImpl(desc, parent);
|
||||
assertEquals(desc, loc.getDescription());
|
||||
}
|
||||
|
||||
@Test
|
||||
void toStringIsAConcatenationofDescAndPosition() {
|
||||
LineLocationImpl loc = new LineLocationImpl(desc, parent);
|
||||
assertEquals(desc + " : -1", loc.toString());
|
||||
assertEquals(desc + " : 0", loc.oneLineRead().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
void oneLineReadMovesToNextLine() {
|
||||
LineLocationImpl loc = new LineLocationImpl(desc, parent);
|
||||
|
||||
for (int i = 1; i < 5; ++i) {
|
||||
LineLocationImpl next = loc.oneLineRead();
|
||||
assertEquals(desc, next.getDescription());
|
||||
assertSame(parent, next.getParent());
|
||||
assertEquals(-1 + i, next.getPosition());
|
||||
loc = next;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void comparisonStandardLibraryAlwaysDifferent() {
|
||||
LineLocationImpl loc1 = new LineLocationImpl(desc, parent);
|
||||
LineLocationImpl loc2 = new LineLocationImpl("<" + desc2, parent);
|
||||
|
||||
assertEquals(1, loc1.compareTo(loc2));
|
||||
assertEquals(-1, loc2.compareTo(loc1));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {"", "<"})
|
||||
void comparisonDisregardsDescription(String prefix) {
|
||||
LineLocationImpl loc1 = new LineLocationImpl(prefix + desc, parent);
|
||||
LineLocationImpl loc2 = new LineLocationImpl(prefix + desc2, parent);
|
||||
|
||||
assertEquals(0, loc1.compareTo(loc2));
|
||||
assertEquals(0, loc2.compareTo(loc1));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {"", "<"})
|
||||
void comparisonDisregardsParent(String prefix) {
|
||||
LineLocationImpl loc1 = new LineLocationImpl(prefix + desc, parent);
|
||||
LineLocationImpl loc2 = new LineLocationImpl(prefix + desc, parent2);
|
||||
|
||||
assertEquals(0, loc1.compareTo(loc2));
|
||||
assertEquals(0, loc2.compareTo(loc1));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {"", "<"})
|
||||
void comparisonLooksAtPositionOnly(String prefix) {
|
||||
LineLocationImpl loc1 = new LineLocationImpl(prefix + desc, parent);
|
||||
LineLocationImpl loc2 = loc1.oneLineRead();
|
||||
LineLocationImpl loc3 = loc2.oneLineRead();
|
||||
|
||||
assertEquals(-1, loc1.compareTo(loc2));
|
||||
assertEquals(1, loc2.compareTo(loc1));
|
||||
|
||||
assertEquals(-2, loc1.compareTo(loc3));
|
||||
assertEquals(2, loc3.compareTo(loc1));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user