wolfhece._builtin_plugins.grid_adder.tests.test_companion

Unit tests for GridAdderCompanion.

Running these tests

From the project root:

pytest wolfhece/_builtin_plugins/grid_adder/tests/ -v

Mocking strategy

The companion needs a WolfMapViewer instance but tests run headless (no wx.App, no OpenGL context).

viewer fixture

A MagicMock with xmin / xmax set. It records every call to add_object, set_status_text, etc.

dialogs fixture

A MagicMock injected as the DialogProvider so we control what ask_float returns without any wx dialog appearing.

Module Contents

wolfhece._builtin_plugins.grid_adder.tests.test_companion.viewer()[source]
wolfhece._builtin_plugins.grid_adder.tests.test_companion.dialogs()[source]
wolfhece._builtin_plugins.grid_adder.tests.test_companion._COMPANION_FILE[source]
wolfhece._builtin_plugins.grid_adder.tests.test_companion._spec = None[source]
wolfhece._builtin_plugins.grid_adder.tests.test_companion._mod = None[source]
wolfhece._builtin_plugins.grid_adder.tests.test_companion.GridAdderCompanion[source]
wolfhece._builtin_plugins.grid_adder.tests.test_companion._new_companion(viewer, dialogs)[source]
class wolfhece._builtin_plugins.grid_adder.tests.test_companion.TestGridAdderCompanion[source]

Behaviour tests — no wx, no OpenGL required.

test_construction(viewer, dialogs)[source]
test_start_calls_add_object_when_confirmed(viewer, dialogs)[source]

When the user confirms the dialog, add_object must be called once.

test_start_does_not_call_add_object_when_cancelled(viewer, dialogs)[source]

When the user cancels the dialog, add_object must NOT be called.

test_default_size_passed_to_dialog(viewer, dialogs)[source]

The dialog must be opened with the default cell size of 1000.

test_status_set_after_add(viewer, dialogs)[source]

A status message must be emitted after successfully adding the grid.

test_menu_build_idempotent(viewer, dialogs)[source]

Calling menu_build twice must not raise (guards run without wx).

test_on_add_delegates_to_start(viewer, dialogs)[source]

The menu handler _on_add must call _do_add_grid via start().