improve library screen
Python CI / test (3.12) (push) Has been cancelled
Python CI / test (3.13) (push) Has been cancelled

This commit is contained in:
2025-11-10 14:31:19 +01:00
parent dd392d2e15
commit d6bdc2ce40
6 changed files with 82 additions and 5 deletions
+5 -3
View File
@@ -40,7 +40,7 @@ class TestLibraryInteraction(unittest.TestCase):
self.assertIn('filename', book)
def test_library_table_creation(self):
"""Test that library table can be created"""
"""Test that library table can be created with pagination"""
books = self.library.scan_library()
table = self.library.create_library_table()
@@ -48,10 +48,12 @@ class TestLibraryInteraction(unittest.TestCase):
self.assertIsNotNone(table)
# Table should have body rows for 2-column grid layout
# With pagination, we only show books_per_page books, not all books
# Calculate expected rows based on current page's books
books_on_page = min(self.library.books_per_page, len(books) - (self.library.current_page * self.library.books_per_page))
# Each pair of books gets 2 rows (cover row + detail row)
# So N books = ceil(N/2) * 2 rows
expected_rows = ((books_on_page + 1) // 2) * 2
body_rows = list(table.body_rows())
expected_rows = ((len(books) + 1) // 2) * 2 # Round up to nearest even number, then double
self.assertEqual(len(body_rows), expected_rows)
def test_library_rendering(self):