Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

2.0 KB
Raw Blame
"""Regression tests for removing the legacy procedural orb renderer."""
from __future__ import annotations

import pytest

import ui.orb.overlay as overlay_mod
from dodaios.core.config import UIConfig
from ui.orb.overlay import OrbOverlay

# The still-picture mascot; without a configured image the mascot is a pet.
pytestmark = pytest.mark.usefixtures("still_picture_mascot")


def test_ui_config_default_is_jarvis_bar_not_legacy_orb() -> None:
    # Default flipped to the slim jarvis bar; the legacy procedural "orb" is
    # still never the default. The mascot stays explicitly selectable.
    assert UIConfig().orb_style == "jarvis_bar"
    assert UIConfig().orb_style != "orb"
    assert UIConfig(orb_style="mascot").orb_style == "mascot"


def test_legacy_orb_style_is_coerced_to_mascot(monkeypatch: pytest.MonkeyPatch) -> None:
    monkeypatch.delenv("JARVIS_ORB_STYLE", raising=False)

    overlay = OrbOverlay(style="orb")

    assert overlay._style == "mascot"


def test_env_cannot_force_legacy_orb(monkeypatch: pytest.MonkeyPatch) -> None:
    monkeypatch.setenv("JARVIS_ORB_STYLE", "orb")

    overlay = OrbOverlay(style="mascot")

    assert overlay._style == "mascot"


def test_runtime_style_switch_cannot_select_legacy_orb(
    monkeypatch: pytest.MonkeyPatch,
) -> None:
    monkeypatch.delenv("JARVIS_ORB_STYLE", raising=False)
    overlay = OrbOverlay(style="mascot")

    overlay.set_style("orb")

    assert overlay._style == "mascot"


def test_missing_mascot_asset_does_not_fallback_to_legacy_orb(
    monkeypatch: pytest.MonkeyPatch,
    tmp_path,
) -> None:
    monkeypatch.delenv("JARVIS_ORB_STYLE", raising=False)
    # The image passed below selects the still picture; no other one may be found.
    monkeypatch.delenv("JARVIS_ORB_MASCOT_PATH", raising=False)
    monkeypatch.setattr(
        overlay_mod,
        "DEFAULT_MASCOT_REL",
        "assets/icons/__missing_legacy_orb_regression__.png",
    )

    overlay = OrbOverlay(style="mascot", mascot_path=tmp_path / "missing.png")

    assert overlay._build_renderer("mascot") is None