Skip to content

Commit 1723bd3

Browse files
Vaivaswat2244SteftervSableRaf
authored
pr05 Visual Regression Testing #1: Initial Visual Testing Framework (#1261)
* Update README.md * added the image comparator which is the pixel matching algorithm * added build.gradle file * added the test runner * added the simple test * Revise README for Jetpack Compose migration strategy Updated README to reflect migration to Jetpack Compose and strategy for replacing JEditTextArea with RSyntaxTextArea. Added insights on LSP-based editor research and the need for user feedback on Tweak Mode and autocompletion features. * fixing the build issues * added junit as dependency * removing custom class implementation * inclding visual-tests in settings * fixed the overlapping cmd * cleaning * adding packages * added updated screenshot structure * refactoring * added tests in suits * removed simple test * deleting earlier files * updated the core/gradle file * added the infrastructure * added some tests ported by p5js * removing test rendering suite and its test file * added screenshots * config files * fixed the pixeldensity to 1 * Revert "fixed the pixeldensity to 1" This reverts commit 66071ac. * fixed pixeldensity to 1 * Configure dependencyUpdates task in build.gradle.kts Add configuration for dependencyUpdates task to manage non-stable versions. * removing rendering gradient screenshot * General cleanup of `Base` I started cleaning up some of `Base`'s startup sequence for clarity of what is being started when. Nowhere near completion and I think a lot of this class will need to be refactored in the future. Also removed some of the timing measurement comments Added some comments to the Processing CLI class * Move contributor list to CONTRIBUTORS.md (#1313) Created CONTRIBUTORS.md and updated .all-contributorsrc to reference the new file instead of README.md. This will reduce the size of the README and improve loading times. * Update BUILD.md with build failure troubleshooting Added troubleshooting steps for build failures related to permissions. * fixing the build issues * inclding visual-tests in settings * updated the core/gradle file * config files * Configure dependencyUpdates task in build.gradle.kts Add configuration for dependencyUpdates task to manage non-stable versions. * fix rebasing --------- Co-authored-by: Stef Tervelde <[email protected]> Co-authored-by: Raphaël de Courville <[email protected]>
1 parent c1d6313 commit 1723bd3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1443
-498
lines changed

.all-contributorsrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"projectName": "processing4",
33
"projectOwner": "processing",
44
"files": [
5-
"README.md"
5+
"CONTRIBUTORS.md"
66
],
77
"imageSize": 120,
88
"contributorsPerLine": 6,

BUILD.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,16 @@ You may see this warning in IntelliJ:
163163
> `Duplicate content roots detected: '.../processing4/java/src'`
164164
165165
This happens because multiple modules reference the same source folder. It’s safe to ignore.
166+
167+
168+
### Build Failed
169+
170+
If the build fails with `Permission denied` or `Could not copy file` errors, try cleaning the project.
171+
172+
Run:
173+
174+
```bash
175+
./gradlew clean
176+
```
177+
178+
Then, rebuild the project.

CONTRIBUTORS.md

Lines changed: 258 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 2 additions & 259 deletions
Large diffs are not rendered by default.

app/src/processing/app/Base.java

Lines changed: 178 additions & 188 deletions
Large diffs are not rendered by default.

app/src/processing/app/Processing.kt

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ import java.util.prefs.Preferences
1919
import kotlin.concurrent.thread
2020

2121

22-
22+
/**
23+
* This function is the new modern entry point for Processing
24+
* It uses Clikt to provide a command line interface with subcommands
25+
*
26+
* If you want to add new functionality to the CLI, create a new subcommand
27+
* and add it to the list of subcommands below.
28+
*
29+
*/
2330
suspend fun main(args: Array<String>){
2431
Processing()
2532
.subcommands(
@@ -32,6 +39,10 @@ suspend fun main(args: Array<String>){
3239
.main(args)
3340
}
3441

42+
/**
43+
* The main Processing command, will open the ide if no subcommand is provided
44+
* Will also launch the `updateInstallLocations` function in a separate thread
45+
*/
3546
class Processing: SuspendingCliktCommand("processing"){
3647
val version by option("-v","--version")
3748
.flag()
@@ -61,7 +72,10 @@ class Processing: SuspendingCliktCommand("processing"){
6172
}
6273
}
6374

64-
75+
/**
76+
* A command to start the Processing Language Server
77+
* This is used by IDEs to provide language support for Processing sketches
78+
*/
6579
class LSP: SuspendingCliktCommand("lsp"){
6680
override fun help(context: Context) = "Start the Processing Language Server"
6781
override suspend fun run(){
@@ -79,6 +93,11 @@ class LSP: SuspendingCliktCommand("lsp"){
7993
}
8094
}
8195

96+
/**
97+
* A command to invoke the legacy CLI of Processing
98+
* This is mainly for backwards compatibility with existing scripts
99+
* that use the old CLI interface
100+
*/
82101
class LegacyCLI(val args: Array<String>): SuspendingCliktCommand("cli") {
83102
override val treatUnknownOptionsAsArgs = true
84103

@@ -99,6 +118,16 @@ class LegacyCLI(val args: Array<String>): SuspendingCliktCommand("cli") {
99118
}
100119
}
101120

121+
/**
122+
* Update the install locations in preferences
123+
* The install locations are stored in the preferences as a comma separated list of paths
124+
* Each path is followed by a caret (^) and the version of Processing at that location
125+
* This is used by other programs to find all installed versions of Processing
126+
* works from 4.4.6 onwards
127+
*
128+
* Example:
129+
* /path/to/processing-4.0^4.0,/path/to/processing-3.5.4^3.5.4
130+
*/
102131
fun updateInstallLocations(){
103132
val preferences = Preferences.userRoot().node("org/processing/app")
104133
val installLocations = preferences.get("installLocations", "")

app/src/processing/app/UpdateCheck.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ public class UpdateCheck {
6363

6464
static private final long ONE_DAY = 24 * 60 * 60 * 1000;
6565

66+
public static void doCheck(Base base) {
67+
new UpdateCheck(base);
68+
}
6669

6770
public UpdateCheck(Base base) {
6871
this.base = base;

app/src/processing/app/contrib/ContributionManager.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -694,15 +694,9 @@ static private void clearRestartFlags(File root) {
694694

695695

696696
static public void init(Base base) throws Exception {
697-
// long t1 = System.currentTimeMillis();
698-
// Moved here to make sure it runs on EDT [jv 170121]
699697
contribListing = ContributionListing.getInstance();
700-
// long t2 = System.currentTimeMillis();
701698
managerFrame = new ManagerFrame(base);
702-
// long t3 = System.currentTimeMillis();
703699
cleanup(base);
704-
// long t4 = System.currentTimeMillis();
705-
// System.out.println("ContributionManager.init() " + (t2-t1) + " " + (t3-t2) + " " + (t4-t3));
706700
}
707701

708702

app/src/processing/app/contrib/ManagerFrame.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,15 @@ public class ManagerFrame {
6161
public ManagerFrame(Base base) {
6262
this.base = base;
6363

64-
// TODO Optimize these inits... unfortunately it needs to run on the EDT,
65-
// and Swing is a piece of s*t, so it's gonna be slow with lots of contribs.
66-
// In particular, load everything and then fire the update events.
67-
// Also, don't pull all the colors over and over again.
68-
// long t1 = System.currentTimeMillis();
6964
librariesTab = new ContributionTab(this, ContributionType.LIBRARY);
70-
// long t2 = System.currentTimeMillis();
7165
modesTab = new ContributionTab(this, ContributionType.MODE);
72-
// long t3 = System.currentTimeMillis();
7366
toolsTab = new ContributionTab(this, ContributionType.TOOL);
74-
// long t4 = System.currentTimeMillis();
7567
examplesTab = new ContributionTab(this, ContributionType.EXAMPLES);
76-
// long t5 = System.currentTimeMillis();
7768
updatesTab = new UpdateContributionTab(this);
78-
// long t6 = System.currentTimeMillis();
7969

8070
tabList = new ContributionTab[] {
8171
librariesTab, modesTab, toolsTab, examplesTab, updatesTab
8272
};
83-
84-
// System.out.println("ManagerFrame.<init> " + (t2-t1) + " " + (t3-t2) + " " + (t4-t3) + " " + (t5-t4) + " " + (t6-t5));
8573
}
8674

8775

app/src/processing/app/syntax/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
# 🐉 Fixing this code: here be dragons. 🐉
1+
# Replacing our custom version of JEditTextArea
2+
3+
Since 2025 we have started a migration of Swing to Jetpack Compose and we will eventually need to replace the JEditTextArea as well.
4+
5+
I think a good current strategy would be to start using `RSyntaxTextArea` for an upcoming p5.js mode. `RSyntaxTextArea` is a better maintained and well rounded library. As noted below, a lot of the current state management of the PDE is interetwined with the JEditTextArea implementation. This will force us to decouple the state management out of the `JEditTextArea` whilst also trying to keep backwards compatibility alive for Tweak Mode and the current implementation of autocomplete.
6+
7+
I also did some more research into the potential of using a JS + LSP based editor within Jetpack Compose but as of writing (early 2025) the only way to do so would be to embed chromium into the PDE through something like [Java-CEF]([url](https://github.com/chromiumembedded/java-cef)) and it looks like a PoC for Jetpack Compose Desktop exists [here](https://github.com/JetBrains/compose-multiplatform/blob/9cd413a4ed125bee5b624550fbd40a05061e912a/experimental/cef/src/main/kotlin/org/jetbrains/compose/desktop/browser/BrowserView.kt). Moving the entire PDE into an electron app would be essentially a rewrite which currrently is not the target.
8+
9+
Considering the current direction of the build-in LSP within Processing, I would say that creating a LSP based editor would be a good strategy going forward.
10+
11+
Research needs to be done on how much the Tweak Mode and autocompletion are _actually_ being used. Currently both these features are quite hidden and I suspect that most users actually move on to more advanced use-cases before they even discover such things. I would like to make both of these features much more prominent within the PDE to test if they are a good value add.
12+
13+
### Ben Fry's notes
214

315
Every few years, we've looked at replacing this package with [RSyntaxArea](https://github.com/bobbylight/RSyntaxTextArea), most recently with two attempts during the course of developing [Processing 4](https://github.com/processing/processing4/wiki/Processing-4), but probably dating back to the mid-2000s.
416

0 commit comments

Comments
 (0)