Skip to content

ssd1327: Harmonize driver and add test scenario.#55

Merged
nedseb merged 4 commits intomainfrom
ssd1327-harmonize-and-tests
Mar 12, 2026
Merged

ssd1327: Harmonize driver and add test scenario.#55
nedseb merged 4 commits intomainfrom
ssd1327-harmonize-and-tests

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Mar 12, 2026

Closes #36
Closes #54

Summary

  • Harmonize SSD1327 driver: addraddress in SSD1327_I2C and WS_OLED_128X128_I2C, remove debug print() in SSD1327_SPI.__init__
  • Add test scenario with 4 mock tests and 8 hardware tests (white fill, text, grayscale gradient, scrolling animation)
  • FakeI2C: add writeto() and writevto() methods (used by SSD1327_I2C instead of writeto_mem)
  • framebuf stub: new framebuf_stub.py for testing display drivers on CPython
  • Manual test UX: single keypress (Entree=oui, Echap=non) instead of typing y/n

Tests

Test Mode Description
Fill black does not crash mock fill(0)
Fill white does not crash mock fill(15)
Text rendering does not crash mock text("Test", 0, 0, 15)
Show does not crash mock show()
Display white screen hardware fill(15) + show
Screen is white hardware (manual) Visual check
Display text hardware text("STeaMi") + show
Text is visible hardware (manual) Visual check
Display grayscale gradient hardware 16 vertical bands 0→15
Grayscale gradient is visible hardware (manual) Visual check
Scrolling animation hardware Horizontal scroll 128px
Animation was smooth hardware (manual) Visual check

Test commands

# Mock tests (CPython)
python3 -m pytest tests/ -v --driver ssd1327

# Hardware tests (STeaMi board)
python3 -m pytest tests/ -v --port /dev/ttyACM0 --driver ssd1327 -s

Test results

============================== test session starts ==============================
platform linux -- Python 3.13.7, pytest-8.3.5, pluggy-1.5.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/nedjar/sandbox/micropython-steami-lib
configfile: pytest.ini
plugins: typeguard-4.4.2
collected 101 items / 89 deselected / 12 selected                                                                                                                                                                                                                           

tests/test_scenarios.py::test_scenario[ssd1327/Fill black does not crash/mock] None
PASSED
tests/test_scenarios.py::test_scenario[ssd1327/Fill white does not crash/mock] None
PASSED
tests/test_scenarios.py::test_scenario[ssd1327/Text rendering does not crash/mock] None
PASSED
tests/test_scenarios.py::test_scenario[ssd1327/Show does not crash/mock] None
PASSED
tests/test_scenarios.py::test_scenario[ssd1327/Display white screen/hardware] True
PASSED
tests/test_scenarios.py::test_scenario[ssd1327/Screen is white/hardware]   [MANUAL] L'écran affiche-t-il un fond blanc uniforme ? [Entree=oui / Echap=non] 
True
PASSED
tests/test_scenarios.py::test_scenario[ssd1327/Display text/hardware] True
PASSED
tests/test_scenarios.py::test_scenario[ssd1327/Text is visible/hardware]   [MANUAL] L'écran affiche-t-il 'STeaMi' et 'Test OK' sur fond noir ? [Entree=oui / Echap=non] 
True
PASSED
tests/test_scenarios.py::test_scenario[ssd1327/Display grayscale gradient/hardware] True
PASSED
tests/test_scenarios.py::test_scenario[ssd1327/Grayscale gradient is visible/hardware]   [MANUAL] L'écran affiche-t-il 16 bandes verticales du noir au blanc ? [Entree=oui / Echap=non] 
True
PASSED
tests/test_scenarios.py::test_scenario[ssd1327/Scrolling animation/hardware] True
PASSED
tests/test_scenarios.py::test_scenario[ssd1327/Animation was smooth/hardware]   [MANUAL] Le texte 'STeaMi' a-t-il defile horizontalement de maniere fluide ? [Entree=oui / Echap=non] 
True
PASSED

====================== 12 passed, 89 deselected in 24.46s =======================

@nedseb nedseb requested review from Charly-sketch and Copilot March 12, 2026 15:06
@nedseb nedseb self-assigned this Mar 12, 2026
@nedseb nedseb added enhancement New feature or request test labels Mar 12, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR harmonizes the SSD1327 display driver API with project conventions, expands the CPython mock test harness to support SSD1327’s I2C write patterns, and adds a new YAML scenario to exercise the driver in both mock and hardware modes.

Changes:

  • Updated SSD1327 I2C constructors to use address (instead of addr) and removed a stray debug print() in the SPI init path.
  • Enhanced the CPython test runner: added a framebuf stub and extended FakeI2C with writeto() / writevto().
  • Added a new tests/scenarios/ssd1327.yaml scenario and improved manual test prompting UX (single keypress).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/ssd1327/ssd1327/device.py Harmonizes address naming for I2C classes and removes SPI debug output.
tests/fake_machine/i2c.py Adds writeto()/writevto() needed by SSD1327 I2C implementation in mock mode.
tests/fake_machine/framebuf_stub.py Introduces a minimal framebuf stub so display drivers import/run on CPython.
tests/runner/executor.py Patches framebuf into the mock import environment and reuses the new manual prompt helper.
tests/test_scenarios.py Adds _prompt_yes_no() (Enter/Escape) and uses it for manual checks.
tests/scenarios/ssd1327.yaml Adds SSD1327 mock + hardware/manual scenario coverage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/runner/executor.py
Comment thread tests/runner/executor.py Outdated
Comment thread tests/test_scenarios.py Outdated
@nedseb nedseb merged commit 26e87ec into main Mar 12, 2026
3 checks passed
@nedseb nedseb deleted the ssd1327-harmonize-and-tests branch March 12, 2026 15:26
@semantic-release-updater
Copy link
Copy Markdown

🎉 This PR is included in version 0.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ssd1327: Harmonize driver with project conventions tests: Add test scenario for SSD1327 OLED display.

2 participants