- Create an action to the toolbar in order to open script editor
Details
- Reviewers
tdeschastres fabienboco bensi remibenoit franckarrecot theovaucher - Maniphest Tasks
- Restricted Maniphest Task
Diff Detail
- Repository
- R4 Zanshin
- Lint
Lint Skipped - Unit
Unit Tests Skipped
src/widgets/applicationcomponents.cpp | ||
---|---|---|
171 | Please put that on several lines to avoid it being too long. e.g. line breacks after each , | |
269 | I'd also raise and activate to make sure it comes on top if it was already opened. | |
src/widgets/applicationcomponents.h | ||
68 | Please remove that empty line. | |
tests/units/widgets/applicationcomponentstest.cpp | ||
520 | Please also add a test checking the script editor window is brought up when the action is triggered. |
tests/units/widgets/applicationcomponentstest.cpp | ||
---|---|---|
520 | Sure, but how? I tried to trigger the action with action->trigger() but it raise an exception. Maybe set a ScriptEditorStub? And set it in ApplicationComponents? |
tests/units/widgets/applicationcomponentstest.cpp | ||
---|---|---|
520 | Assert you mean? You might need to include QtTestGui instead of QtTest. Now the test with running on a QCoreApplication, since a widget will be involved you likely want a QApplication. |
So, when I trigger the action, the test failed. And when I comment this line:
"m_scriptEditor->setScriptHandler(Utils::DependencyManager::globalInstance().create<Scripting::ScriptHandler>());" (applicationcomponents.cpp#273)
Then the test passed.
I don't know how to fix this. Can you help me please?
The problem is that you ask the dependency manager a ScriptHandler implementation but none has been provided. You need to configure the dependency manager to provide a stub ScriptHandler in the test, likely you miss something like:
Utils::DependencyManager::globalInstance().add<Scripting::ScriptHandler, StubScriptHandler>()
Assuming tests pass.
Sorry for not replying earlier, I got very busy and then we got troubles with the CI, it's all almost solved now so I think this patch can finally go in.