maverig.tests

maverig.tests.test_modePanelPresenter

class maverig.tests.test_modePanelPresenter.TestModePanelPresenter(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_remove_selected_component_and_restore_default_components()

Removes a component and restores the default components. The list of hided components in the config gets cleared.

test_hide_selected_component()

Hides a component.

test_show_invisible_components()
test_selection_mode_btn_clicked()

Switches the mode between Selection Mode and Component Mode, if the Selection Mode Button is clicked

test_hand_mode_btn_clicked()

Switches the mode between Hand Mode and Component Mode, if the Hand Mode Button is clicked

test_comp_btn_created()

Adds created button to buttons dict.

test_comp_btn_clicked()

Switches the mode between Component Mode and Selection Mode, if one Component Button is clicked

test_drag_started()

Switches the mode to component mode when a component is dragged.

test_on_change_visibility_triggered()

Triggers the visibility of the component panel

test_on_mode()

react on model mode changes and update the view buttons accordingly

test_program_mode()

react on model program mode changes

maverig.tests.test_consolePresenter

class maverig.tests.test_consolePresenter.TestConsolePresenter(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_on_change_visibility_triggered()

Triggers the visibility of the console panel.

test_on_console_clear_triggered()

Clear console

test_program_mode()

react on model program mode changes

test_on_output()

Appends the given output to the console output.

maverig.tests.test_event

class maverig.tests.test_event.TestEvent(methodName='runTest')

Bases: unittest.case.TestCase

test_handle()
test_unhandle()
test_fire()
on_data_changed(param1, param2)

maverig.tests.test_groupPresenter

class maverig.tests.test_groupPresenter.TestGroupPresenter(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_ep()

Returns the element port to a virtual point.

test_vp()

Returns the virtual point to an element port.

test_raster_snap_v_points()

Returns a list of virtual points that may snap to the raster.

test_init_scene_mapping()

Adds view items to the scene, sets related elem_id as tooltip for easier handling of errors and triggers scene mapping.

test_remove()

Removes this whole group. Unsubscribes model events.

test_snap_zone()

Returns a list of nearby virtual points (of other groups) sorted by distance (from near to far).

test_can_dock()

Returns if virtual point from_vp can dock with virtual point to_vp if docking is accepted and from_vp is not docked to another virtual point already. A virtual point (e.g. endpoint) can have one outgoing connection only but may have several ingoing connections (e.g. node).

test_to_dockables()

Returns a list of virtual points from to_vps to which the virtual point from_vp can dock-out.

test_from_dockables()

Returns a list of virtual points from from_vps to which the virtual point to_vp can dock-in.

test_connectables()

virtual points of other_vps where vp can dock-in or -out

test_new_connectables()

Returns a list of virtual points from other_vps to which the virtual point vp can dock-in or dock-out if they are not docked already.

test_non_connectable()

Returns a list of virtual points from other_vps to which the virtual point vp can’t dock.

test_dock()

Docks virtual points and applies docking in model.

test_undock()

Undocks virtual points and applies undocking in model.

test_check_snap_permission()

Checks whether the view has permission to snap. Optionally validates snap restrictions.

test_on_position_changed()

Applies docking/undocking of the view within snap zone. Sets v_point position in model.

test_validation()

Updates the views validity.

test_snap_dock()

Snaps the view to the raster.

test_raster_snap()

Snaps the view to the raster if raster mode is enabled.

test_avoid_invalid_positions()

Avoids invalid positions by moving the view back to last valid positions.

test_on_mouse_released()

Applies raster snapping to the view if view is released by the mouse.

test_on_elements()

Reacts on changes on elements count and removes himself if view isn’t present anymore.

test_on_positions()

Reacts on position changes.

test_on_drag()

Reacts on drag and drop.

test_on_selection()

Reacts on selection changes. Updates the views z-mode and visibility state.

test_on_dockings()

Reacts on view docking.

test_on_mode()

Reacts on mode changes. Updates the state of the view.

test_on_param()

Reacts on parameter changes.

test_change_ev_icon()

Changes the icon of an electric vehicle depending on state of charge and plugged-in state.

maverig.tests.test_menuBarPresenter

class maverig.tests.test_menuBarPresenter.TestMenusBarPresenter(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_on_back_to_start_triggered()

Set simulated progress-visualisation to 0.

test_on_reduce_speed_triggered()

Set simulated progress-visualisation slower in speed.

test_on_run_triggered()

Runs the simulation.

test_on_stop_triggered()

Stops the simulation.

test_on_pause_triggered()

Pauses the simulation.

test_on_increase_speed_triggered()

Set simulated progress-visualisation faster in speed.

test_on_forward_to_end_triggered()

Set simulated progress-visualisation to the end of simulation.

test_on_set_time_triggered()

Sets the start time and the duration of the simulation via a dialog.

test_on_go_to_triggered()

Go to an specific simulation time position

test_on_hand_mode_triggered()

Toggles the hand mode for shifting the scenario.

test_on_selection_mode_triggered()

Toggles the hand mode for element selection.

test_on_raster_mode_triggered()

Toggles raster mode for element snapping

test_on_elements()

Reacts on changes of the elements count and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

test_on_mode()

Reacts on model changes of the current mode and toggles the checked state of the selection mode and hand mode.

test_on_drag()
test_on_vid_speed()
test_on_program_mode()

Reacts on model changes of the current program mode and adjust the ui to reflect the program mode composition, simulation or simulation paused.

test_on_selection()

Reacts on model changes of the current selection and toggles the state of the cut, copy and delete actions.

test_on_clipboard()

Reacts on model changes of the clipboard and toggles the state of the paste action.

maverig.tests.test_model

class maverig.tests.test_model.TestModel(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_switch_modes()

Switches between the composition modes.

test_is_selectable()

Checks for an item if it is selectable or not.

test_init_history()

Init the history if an empty scene is open.

test_add_history_point()

Changes history after an action.

test_undo()

Undo the last performed action.

test_redo()

Recover the last undone action.

test_copy_to_clipboard()

Copies all elements of the elem_ids list to an internal clipboard.

test_paste_from_clipboard()

Paste all elements from internal clipboard and return the new elem_ids only dockings inside of clipboard will be maintained.

test_create_element()

Creates an element.

test_delete_element()

Deletes an element.

test_get_shared_published_params()

Return a list of composed parameter instances which are contained in each element of elem_ids, e.g.:

[NumResidents(), NumHouseHolds() ...]
  • parameter.value: the parameter value of the first element of elem_ids
  • parameter.shared_values: a list of values according to each element in elem_ids
test_get_param_value()

Get value of parameter with param_name in element elem_id return None if param_name does not exist.

test_get_selected()

Get value of parameter with param_name in element elem_id return None if param_name does not exist.

test_set_selected()

Sets selected-flag to marked elements.

test_docking_port()

Get the docking_port of an element.

test_get_pos()

Get the position of an element.

test_set_pos()

Set the position of an element.

test_dockings_out()

Return an array of outgoing element ports.

test_dockings_in()

Return an array of outgoing element ports.

test_can_dock()

Tests if one component may dock to another.

test_dock()

Docks branch elements to other elements, if allowed.

test_undock()

Undocks docked components.

test_update()

Fires all events with pending demands.

test_update_all()

Fires all events.

test_deselect_all_elems()

Deselect all elements.

test_copy()

Return new flat copied model including scenario, components and simulators descriptions and no connected events.

test_changes_count()

Return an int value representing the current model state changes counter.

test_get_simulator()

Return the simulator of the given element.

test_get_icon_color()

Return the color od the given icon.

test_set_param_value()

Sets a parameter of an element to an given value.

test_get_attr_values()

Return values of an attribute in a specific timestamp area.

test_get_attr_value()

Return a value of an attribute on an specific timestamp.

test_get_u_heat_value()

Return the u_heat value from an element on a specific timestamp.

test_get_i_heat_value()

Return the i_heat value from an element on a specific timestamp.

test_get_p_level()

Return the p_level from an element on a specific timestamp.

test_get_state_of_charge()

Return the state of charge from an element on a specific timestamp.

test_attr_is_multivalue()

Return True if an attribute is available in elem_ids.

test_param_is_multivalue()

Return whether parmeter values differ in elements of elem_ids.

test_docking_attrs()

Return a set of valid attribute connection tuples from one element to another.

test_handle_scenario_error()

Creates output and error events and selects elements in elem_ids for visual feedback of scenario errors.

test_validate_scenario()

Validates the scenario.

test_get_shared_published_attrs()

Return a filtered list of published attribute names which are contained in each element of elem_ids.

maverig.tests.test_progressPresenter

class maverig.tests.test_progressPresenter.TestProgressPresenter(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_on_slider_moved()

Sets simulation data index to current slider position. Keeps slider position valid if the mosaik simulation progress isn’t as far as the position. The model performs lazy updates on the UI through the refresh_timer to prevent application from speed and graph animation issues.

test_on_change_visibility_triggered()

Toggles the visibility of the progress bar. Saves the visibility state in the config.

test_on_change_dateformat()

Toggles displaying of the date.

test_on_screen_dateformat()

Reacts on changes of the date display. Displays the date as calendar date or as countdown.

test_on_progress()

Applies the current progress to the progress bar.

test_on_sim()

Reacts on simulation data index changes. Updates the slider position and the date.

test_on_program_mode()

React on model program mode changes.

test_run_slider()

Starts the progress slider.

test_stop_slider()

Stops the progress slider.

test_run_iteration()

Updates the simulation data index which is responsible for moving the progress slider.

maverig.tests.test_propertyPanelPresenter

class maverig.tests.test_propertyPanelPresenter.TestPropertyPanelPresenter(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_on_change_visibility_triggered()

Test the hidden feature of the property panel.

test_check_spinbox()

Check that the spinbox switch to the right value.

test_value_changed()

Test if a wrong value für an element is set in the model.

test_on_selection()

Check that the right widgets are placed in the property panel when selecting an element.

test_on_param()

Check that the right widgets are placed and up to date when changing a value of an element.

test_on_program_mode()

React on model program mode changes.

maverig.tests.test_scenarioPanelPresenter

class maverig.tests.test_scenarioPanelPresenter.TestScenarioPanelPresenter(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_adjust_scene_rect()

Fits the size of the scene to the items_bounding_rect.

test_element_at()

Returns element at mouse position.

test_group_presenters()

Returns a set of all group presenters.

test_groups()

Returns a set of all groups.

test_mouse_clicked()

Create an element on clicking left mouse button switch between selection and component mode on clicking right mouse button.

test_damped_mouse_pos()

Returns the damped mouse position if it is out of frame rect.

test_mouse_moved()

Set mouse position based on damped mouse position.

test_mouse_released()

Draw second endpoint of line or transformer.

test_zoom()

Handles zooming functionality.

test_zoom_fit()

Fits all elements into the view.

test_delete_selected_elements()

Deletes all selected elements.

test_copy_selected_elements()

Copy all selected elements.

test_cut_selected_elements()

Cut all selected elements.

test_paste_elements()

Paste and select inserted elements.

test_select_all_elements()

Selects all elements.

test_select_all_active_elements()

Selects all elements depending on the current active mode.

test_on_mode()

Reacts on model mode changes and updates the view, which component is allowed to be created and selected.

test_on_elements()

Updates the view items when number of model elements has changed.

test_run_force_layout()

Run the force atlas algorithm.

maverig.tests.test_settingsPresenter

class maverig.tests.test_settingsPresenter.TestSettingsPresenter(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_install_language()

Sets chosen language if it is changed by user. This is handled separately to prevent handling of unnecessary events in whole application if the language hasn’t been changed.

test_apply_setting()

Applies the given setting.

maverig.tests.test_statusBarPresenter

class maverig.tests.test_statusBarPresenter.TestStatusBarPresenter(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_on_change_visibility_triggered()

Triggers the visibility of the status bar.

test_on_mode()

Reacts on mode changes. Displays the chosen mode in the status bar.

test_on_vid_speed_event()

Reacts on changes of the progress slider speed. Displays the current speed in the status bar.

test_on_program_mode()

Reacts on program mode changes. The status bar is visible in every program mode if the user didn’t hide it.

test_error()

Sets the given message in the status bar.

test_info()

Sets the given message in the status bar.

test_success()

Sets the given message in the status bar.

test_reset()

Resets the state of the status bar.

maverig.tests.test_toolbarPresenter

class maverig.tests.test_toolbarPresenter.TestToolBarPresenter(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_on_elements()

Reacts on changes of the elements count and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

test_on_selection()

Reacts on model changes of the current selection and toggles the state of the delete action.

test_on_drag()

Set the current mode

test_on_sim()

Reacts on changes of the simulation time and speed parameters and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

test_on_vid_speed()

Reacts on changes of the progress slider speed and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

test_on_program_mode()

Reacts on program mode changes and toggles the state (checked/unchecked/enabled/disabled) of the depending actions.

maverig.tests.test_vPoint

class maverig.tests.test_vPoint.TestVPoint(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_set_pos()
test_move_pos()
test_follow_follows()

self keeps hold of v_point. adjust self when v_point position change applies to trigger. self will change it’s position with given reason

test_unfollow()
test_fix()

self keeps hold of v_point and vice versa

test_unfix()