Esempio n. 1
0
import pytest
from pymmcore_plus import CMMCorePlus, PropertyType

from micromanager_gui._core_widgets import PropertyWidget

# not sure how else to parametrize the test without instantiating here at import ...
CORE = CMMCorePlus()
CORE.loadSystemConfiguration()
dev_props = [(dev, prop) for dev in CORE.getLoadedDevices()
             for prop in CORE.getDevicePropertyNames(dev)]


def _assert_equal(a, b):
    try:
        assert float(a) == float(b)
    except ValueError:
        assert str(a) == str(b)


@pytest.mark.parametrize("dev, prop", dev_props)
def test_property_widget(dev, prop, qtbot):
    wdg = PropertyWidget(dev, prop, core=CORE)
    qtbot.addWidget(wdg)
    if CORE.isPropertyReadOnly(dev, prop) or prop in (
            "SimulateCrash",
            "Trigger",
            "AsyncPropertyLeader",
    ):
        return

    start_val = CORE.getProperty(dev, prop)
Esempio n. 2
0
def iter_dev_props(mmc: CMMCorePlus) -> Iterator[Tuple[str, str]]:
    for dev in mmc.getLoadedDevices():
        for prop in mmc.getDevicePropertyNames(dev):
            yield dev, prop