Skip to content

Fix world scripting APIs without the editor - #4612

Merged
bjorn merged 3 commits into
mapeditor:masterfrom
Shubham-Padkonde:fix/cli-worlds
Sep 21, 2026
Merged

bjorn merged 3 commits into
mapeditor:masterfrom
Shubham-Padkonde:fix/cli-worlds

Conversation

@Shubham-Padkonde

@Shubham-Padkonde Shubham-Padkonde commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4584.

Command-line scripts can load worlds through WorldManager, but tiled.worlds returns an empty list because it unnecessarily requires a GUI DocumentManager. The same GUI guard prevents worldsChanged from being forwarded. loadWorld also discards loading errors.

Read worlds and connect their change notification independently of the GUI, and propagate load failures as script errors. Document the error behavior. Add a scripting test target that runs the public JavaScript API without creating a DocumentManager, covering load/unload visibility, change notifications, and a missing world file.

Validation on Ubuntu 22.04, Qt 6.2.4, GCC 11:

  • All three new regression cases fail on the original code and pass with the fix (QtTest reports 5 passes including setup/cleanup).
  • Built the Tiled application and all five test executables.
  • A real tiled -e script verified load/unload visibility, notifications, and a catchable missing-file error.
  • Across the five test executables: 60 passed, 1 failed, including setup/cleanup. The failure is test_Properties::loadCircularReference at its membersA.contains("b") assertion. That executable and its libtiled dependency are unchanged and do not link the modified libtilededitor library. Map reader, staggered renderer, automapping, and the new scripting suite pass.

The Qbs aggregate test runner could not locate the local shared libraries in this build environment. The counts above come from running the same built executables with explicit library paths and each suite's expected working directory.

Upstream CI: Ubuntu, macOS, Windows Qt 6, documentation, and CodeQL checks passed. The ARM64 snap job failed while installing kde-qt6-core24-sdk from latest/stable, before compiling this change (job log). AppVeyor is still pending.

Prepared with Codex assistance, including implementation, regression tests, and this description.

@bjorn
bjorn merged commit ed0b433 into mapeditor:master Sep 21, 2026
16 of 17 checks passed
@bjorn

bjorn commented Sep 21, 2026

Copy link
Copy Markdown
Member

Thanks, fix looks good! :-)

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor Author

Pleasure to contribute, btw can I get chance for GSoc 2027, If possible I will be start contributing from today itself.

@bjorn

bjorn commented Sep 25, 2026

Copy link
Copy Markdown
Member

Pleasure to contribute, btw can I get chance for GSoc 2027, If possible I will be start contributing from today itself.

I still need to decide whether to apply again to participate, it depends on how much time I expect to be able to dedicate to it. And when we do apply, we'd also still need to be accepted into the program by Google. And when that happens, we can expect a few dozen student applications like we got the last 2 times. In that case, I can only wish you good luck for now.

You're welcome to keep contributing useful PRs like this, but I don't think it's a good idea to do it just because you're trying to do GSoC with us next year. Better to learn, have fun and help others! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

api: tiled.loadWorld() fails in scripts

2 participants