improve library screen
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user