"""."""

from kinematic_tracker.association.association_metric import AssociationMetric
from matplotlib.backend_bases import KeyEvent

from association_studio.app.front import AssociationStudioFrontend
from association_studio.app.show_coo_mode import ShowCooMode


def test_coo_mode(front: AssociationStudioFrontend, key_event: KeyEvent) -> None:
    front.on_key(key_event)
    assert front.back.show_coo_mode == ShowCooMode.TRANSLATION
    assert front.text.get_text() == 'xy 0.300 0.700'


def test_metric(front: AssociationStudioFrontend, key_event: KeyEvent) -> None:
    key_event.key = 'm'
    front.on_key(key_event)
    assert front.back.metric_mode.metric == AssociationMetric.MAHALANOBIS
    assert front.ax_boxes.get_title() == 'mahalanobis 0.9821'
