41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
# Copyright 2022 (c) Anna Schumaker.
|
|
"""Tests our sidebar row widgets."""
|
|
import unittest
|
|
import emmental.sidebar.row
|
|
from gi.repository import Gio
|
|
from gi.repository import Gtk
|
|
|
|
|
|
class TestBaseRow(unittest.TestCase):
|
|
"""Test our BaseRow class."""
|
|
|
|
def setUp(self):
|
|
"""Set up common variables."""
|
|
self.row = emmental.sidebar.row.BaseRow()
|
|
|
|
def test_init(self):
|
|
"""Test that the BaseRow is configured correctly."""
|
|
self.assertIsInstance(self.row, Gtk.Box)
|
|
self.assertEqual(self.row.get_orientation(),
|
|
Gtk.Orientation.HORIZONTAL)
|
|
|
|
def test_name(self):
|
|
"""Test the name property."""
|
|
self.assertEqual(self.row.name, "")
|
|
row2 = emmental.sidebar.row.BaseRow(name="Test Playlist")
|
|
self.assertEqual(row2.name, "Test Playlist")
|
|
|
|
def test_count(self):
|
|
"""Test the count property."""
|
|
self.assertEqual(self.row.count, 0)
|
|
row2 = emmental.sidebar.row.BaseRow(count=42)
|
|
self.assertEqual(row2.count, 42)
|
|
|
|
def test_playlist(self):
|
|
"""Test the playlist property."""
|
|
plist = emmental.db.playlist.Playlist(Gio.ListStore(),
|
|
0, "Playlist Name")
|
|
self.assertIsNone(self.row.playlist)
|
|
row2 = emmental.sidebar.row.BaseRow(playlist=plist)
|
|
self.assertEqual(row2.playlist, plist)
|