sidebar: Create a row Label

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-10-12 10:33:57 -04:00
parent fdc4bb7275
commit b75fc78de7
2 changed files with 23 additions and 0 deletions

10
sidebar/row.py Normal file
View File

@ -0,0 +1,10 @@
# Copyright 2021 (c) Anna Schumaker.
from gi.repository import Gtk
from gi.repository import Pango
class Label(Gtk.Label):
def __init__(self):
Gtk.Label.__init__(self)
self.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
self.set_halign(Gtk.Align.START)
self.set_hexpand(True)

13
sidebar/test_row.py Normal file
View File

@ -0,0 +1,13 @@
# Copyright 2021 (c) Anna Schumaker.
import unittest
from gi.repository import Gtk
from gi.repository import Pango
from . import row
class TestLabel(unittest.TestCase):
def test_init(self):
label = row.Label()
self.assertIsInstance(label, Gtk.Label)
self.assertEqual(label.get_ellipsize(), Pango.EllipsizeMode.MIDDLE)
self.assertEqual(label.get_halign(), Gtk.Align.START)
self.assertTrue(label.get_hexpand())