Fix world scripting APIs without the editor - #4612
Conversation
|
Thanks, fix looks good! :-) |
|
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! :-) |
Fixes #4584.
Command-line scripts can load worlds through
WorldManager, buttiled.worldsreturns an empty list because it unnecessarily requires a GUIDocumentManager. The same GUI guard preventsworldsChangedfrom being forwarded.loadWorldalso 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:
tiled -escript verified load/unload visibility, notifications, and a catchable missing-file error.test_Properties::loadCircularReferenceat itsmembersA.contains("b")assertion. That executable and itslibtileddependency are unchanged and do not link the modifiedlibtilededitorlibrary. 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-sdkfromlatest/stable, before compiling this change (job log). AppVeyor is still pending.Prepared with Codex assistance, including implementation, regression tests, and this description.