def test_UI_GIVEN_vector_updated_WHEN_saving_view_changes_THEN_model_is_updated(
    qtbot, component, model
):
    x = 1
    y = 2
    z = 3
    angle = 90

    transform = component.add_rotation(angle=angle, axis=QVector3D(x, y, z))
    transform.values = create_corresponding_value_dataset(angle)

    view = EditRotation(parent=None, transformation=transform, model=model)
    qtbot.addWidget(view)

    new_x = 4
    new_y = 5
    new_z = 6

    view.transformation_frame.x_spinbox.setValue(new_x)
    view.transformation_frame.y_spinbox.setValue(new_y)
    view.transformation_frame.z_spinbox.setValue(new_z)

    view.save_all_changes()

    assert transform.vector == QVector3D(new_x, new_y, new_z)
def test_UI_GIVEN_new_values_are_provided_WHEN_save_changes_is_called_THEN_transformation_changed_signal_is_called_to_update_3d_view(
    qtbot, component, model
):
    x = 1
    y = 2
    z = 3
    angle = 90

    transform = component.add_rotation(angle=angle, axis=QVector3D(x, y, z))
    transform.values = create_corresponding_value_dataset(angle)

    view = EditRotation(parent=None, transformation=transform, model=model)
    model.signals.transformation_changed = Mock()
    qtbot.addWidget(view)

    new_x = 4

    view.transformation_frame.x_spinbox.setValue(new_x)
    view.save_all_changes()
    assert transform.vector == QVector3D(new_x, y, z)