"""Tests for the hand_tracking.tracker module."""

import pytest
import sys
import os
import numpy as np

# Add src to path for imports
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src'))


class TestHandTracker:
    """Test suite for HandTracker class."""

    @pytest.fixture
    def mock_model_path(self):
        """Fixture for model path."""
        return "model.p"

    def test_labels_dict_exists(self):
        """Test that LABELS_DICT is properly defined."""
        from hand_tracking.tracker import HandTracker
        assert hasattr(HandTracker, 'LABELS_DICT')
        assert len(HandTracker.LABELS_DICT) == 25
        assert HandTracker.LABELS_DICT[0] == 'Hi'
        assert HandTracker.LABELS_DICT[24] == 'Y'

    def test_labels_dict_mapping(self):
        """Test label mappings."""
        from hand_tracking.tracker import HandTracker
        labels = HandTracker.LABELS_DICT
        # Verify all expected letters and gestures are present
        expected_chars = ['Hi', 'A', 'B', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
                         'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
                         'U', 'V', 'W', 'X', 'Y']
        actual_chars = list(labels.values())
        assert actual_chars == expected_chars

    def test_prediction_result_structure(self):
        """Test that prediction result has expected structure."""
        # This is a placeholder test that validates the expected output structure
        expected_keys = {'character', 'landmarks', 'bbox'}
        # In actual testing, we would create a mock result
        assert True  # Placeholder


class TestRunHandTracking:
    """Test suite for run_hand_tracking function."""

    def test_function_exists(self):
        """Test that run_hand_tracking function exists."""
        from hand_tracking.tracker import run_hand_tracking
        assert callable(run_hand_tracking)

    def test_function_signature(self):
        """Test run_hand_tracking has expected parameters."""
        from hand_tracking.tracker import run_hand_tracking
        import inspect
        sig = inspect.signature(run_hand_tracking)
        params = list(sig.parameters.keys())
        assert 'video_source' in params
        assert 'model_path' in params
