Screen Mock Class for Testing

This class implements the screen API, but in a mock setup, for testing purposes.

class firmware.screen_mock.ScreenMock

Bases: ScreenBase

This class implements the screen API in a mock, nearly empty state, for unit testing purposes

BLACK = 0

Empty mock Black color definition

BLUE = 0

Empty mock Blue color definition

GRAY = 0

Empty mock Gray color definition

GREEN = 0

Empty mock Green color definition

RED = 0

Empty mock Red color definition

WHITE = 0

Empty mock White color definition

YELLOW = 0

Empty mock Yellow color definition

circle(point: tuple, radius: int, color: int) None

Mock circle method which does nothing

Parameters:
  • point – Unused in this mock class

  • radius – Unused in this mock class

  • color – Unused in this mock class

Returns:

Nothing

draw_qr(y_offset: int, qr_bits: list, scale: int = 3) None

Mock draw_qr method which does nothing

Parameters:
  • y_offset – Unused in this mock class

  • qr_bits – Unused in this mock class

  • scale – Unused in this mock class

Returns:

Nothing

fill(color: int) None

Mock fill method which does nothing

Parameters:

color – Unused in this mock class

Returns:

Nothing

fillrect(point: tuple, size: tuple, color: int) None

Mock fillrect method which does nothing

Parameters:
  • point – Unused in this mock class

  • size – Unused in this mock class

  • color – Unused in this mock class

Returns:

Nothing

hline(point: tuple, length: int, color: int) None

Mock hline method which does nothing

Parameters:
  • point – Unused in this mock class

  • length – Unused in this mock class

  • color – Unused in this mock class

Returns:

Nothing

rect(p1: tuple, p2: tuple, color: int) None

Mock rect method which does nothing

Parameters:
  • p1 – Unused in this mock class

  • p2 – Unused in this mock class

  • color – Unused in this mock class

Returns:

Nothing

text(point: tuple, text: str, color: int, size: int = 1, nowrap: bool = True) None

This mock text method simply updates the displayed messages variable with the new text. This allows unit testing to ensure the display showed a message to the user under various conditions.

Parameters:
  • point – Unused in this mock class

  • text – Unused in this mock class

  • color – Unused in this mock class

  • size – Unused in this mock class

  • nowrap – Unused in this mock class

Returns:

Nothing

vline(point: tuple, length: int, color: int) None

Mock vline method which does nothing

Parameters:
  • point – Unused in this mock class

  • length – Unused in this mock class

  • color – Unused in this mock class

Returns:

Nothing