emmental/ui/test_pane.py

30 lines
935 B
Python

# Copyright 2021 (c) Anna Schumaker.
import lib
import playlist
import sidebar
import unittest
from gi.repository import Gtk
from . import pane
class TestPane(unittest.TestCase):
def setUp(self):
lib.settings.reset()
def test_init(self):
paned = pane.Pane()
self.assertIsInstance(paned, Gtk.Paned)
self.assertIsInstance(paned.get_start_child(), sidebar.Sidebar)
self.assertIsInstance(paned.get_end_child(), playlist.Panel)
self.assertEqual(paned.get_orientation(), Gtk.Orientation.HORIZONTAL)
self.assertFalse(paned.get_shrink_start_child())
self.assertTrue(paned.get_vexpand())
def test_position(self):
paned = pane.Pane()
self.assertEqual(paned.get_position(), 250)
self.assertEqual(lib.settings.get_int("sidebar.width"), 250)
paned.set_position(100)
self.assertEqual(lib.settings.get_int("sidebar.width"), 100)