@ -64,6 +64,11 @@ describe("Readerfooter module", function()
book_time_to_read = true ,
chapter_time_to_read = true ,
} )
-- NOTE: Forcefully disable the statistics plugin, as lj-sqlite3 is horribly broken under Busted,
-- causing it to erratically fail to load, affecting the results of this test...
G_reader_settings : saveSetting ( " plugins_disabled " , {
statistics = true ,
} )
UIManager : run ( )
end )
@ -173,8 +178,8 @@ describe("Readerfooter module", function()
footer : onUpdateFooter ( )
local timeinfo = footer.textGeneratorMap . time ( footer )
local page_count = readerui.document : getPageCount ( )
-- stats has not been initialized here, so we get na TB and TC
assert.are . same ( ' 1 / ' .. page_count .. ' | ' .. timeinfo .. ' | ⇒ 0 | 0% | ⤠ 0% | ⏳ na | ⤻ na ' ,
-- c.f., NOTE above, Statistics are disabled, hence the N/A results
assert.are . same ( ' 1 / ' .. page_count .. ' | ' .. timeinfo .. ' | ⇒ 0 | 0% | ⤠ 0% | ⏳ N/A | ⤻ N/A ' ,
footer.footer_text . text )
end )
@ -190,7 +195,7 @@ describe("Readerfooter module", function()
local footer = readerui.view . footer
readerui.view . footer : onUpdateFooter ( )
local timeinfo = readerui.view . footer.textGeneratorMap . time ( footer )
assert.are . same ( ' 1 / 2 | ' .. timeinfo .. ' | ⇒ 1 | 0% | ⤠ 50% | ⏳ na | ⤻ na ' ,
assert.are . same ( ' 1 / 2 | ' .. timeinfo .. ' | ⇒ 1 | 0% | ⤠ 50% | ⏳ N/A | ⤻ N/A ' ,
readerui.view . footer.footer_text . text )
end )
@ -209,7 +214,7 @@ describe("Readerfooter module", function()
footer : resetLayout ( )
footer : onUpdateFooter ( )
local timeinfo = footer.textGeneratorMap . time ( footer )
assert.are . same ( ' 1 / 2 | ' .. timeinfo .. ' | ⇒ 1 | 0% | ⤠ 50% | ⏳ na | ⤻ na ' ,
assert.are . same ( ' 1 / 2 | ' .. timeinfo .. ' | ⇒ 1 | 0% | ⤠ 50% | ⏳ N/A | ⤻ N/A ' ,
footer.footer_text . text )
-- disable show all at once, page progress should be on the first
@ -234,11 +239,11 @@ describe("Readerfooter module", function()
-- disable percentage, book time to read should follow
tapFooterMenu ( fake_menu , " Progress percentage " .. " (⤠) " )
assert.are . same ( ' ⏳ na ' , footer.footer_text . text )
assert.are . same ( ' ⏳ N/A ' , footer.footer_text . text )
-- disable book time to read, chapter time to read should follow
tapFooterMenu ( fake_menu , " Book time to read " .. " (⏳) " )
assert.are . same ( ' ⤻ na ' , footer.footer_text . text )
assert.are . same ( ' ⤻ N/A ' , footer.footer_text . text )
-- disable chapter time to read, text should be empty
tapFooterMenu ( fake_menu , " Chapter time to read " .. " (⤻) " )
@ -246,7 +251,7 @@ describe("Readerfooter module", function()
-- reenable chapter time to read, text should be chapter time to read
tapFooterMenu ( fake_menu , " Chapter time to read " .. " (⤻) " )
assert.are . same ( ' ⤻ na ' , footer.footer_text . text )
assert.are . same ( ' ⤻ N/A ' , footer.footer_text . text )
end )
it ( " should rotate through different modes " , function ( )
@ -300,20 +305,20 @@ describe("Readerfooter module", function()
local footer = readerui.view . footer
local horizontal_margin = Screen : scaleBySize ( 10 ) * 2
footer : onUpdateFooter ( )
assert.is . same ( 3 54 , footer.text_width )
assert.is . same ( 3 70 , footer.text_width )
assert.is . same ( 600 , footer.progress_bar . width
+ footer.text_width
+ horizontal_margin )
assert.is . same ( 2 26 , footer.progress_bar . width )
assert.is . same ( 2 10 , footer.progress_bar . width )
local old_screen_getwidth = Screen.getWidth
Screen.getWidth = function ( ) return 900 end
footer : resetLayout ( )
assert.is . same ( 3 54 , footer.text_width )
assert.is . same ( 3 70 , footer.text_width )
assert.is . same ( 900 , footer.progress_bar . width
+ footer.text_width
+ horizontal_margin )
assert.is . same ( 5 26 , footer.progress_bar . width )
assert.is . same ( 5 10 , footer.progress_bar . width )
Screen.getWidth = old_screen_getwidth
end )
@ -328,12 +333,12 @@ describe("Readerfooter module", function()
}
local footer = readerui.view . footer
footer : onPageUpdate ( 1 )
assert.are . same ( 2 18 , footer.progress_bar . width )
assert.are . same ( 3 62 , footer.text_width )
assert.are . same ( 2 02 , footer.progress_bar . width )
assert.are . same ( 3 78 , footer.text_width )
footer : onPageUpdate ( 100 )
assert.are . same ( 1 94 , footer.progress_bar . width )
assert.are . same ( 386 , footer.text_width )
assert.are . same ( 1 78 , footer.progress_bar . width )
assert.are . same ( 402 , footer.text_width )
end )
it ( " should support chapter markers " , function ( )