@ -22,10 +22,10 @@ describe("Readertoc module", function()
assert.are . same ( 2 , toc_max_depth )
assert.are . same ( 2 , toc_max_depth )
end )
end )
it ( " should get toc title from page " , function ( )
it ( " should get toc title from page " , function ( )
title = toc : getTocTitleByPage ( 51 )
title = toc : getTocTitleByPage ( 49 )
DEBUG ( " toc " , toc.toc )
DEBUG ( " toc " , toc.toc )
assert ( title == " SCENE V. A hall in Capulet's house. " )
assert ( title == " SCENE V. A hall in Capulet's house. " )
title = toc : getTocTitleByPage ( 1 5 4)
title = toc : getTocTitleByPage ( 1 43 )
assert ( title == " SCENE I. Friar Laurence's cell. " )
assert ( title == " SCENE I. Friar Laurence's cell. " )
end )
end )
describe ( " getTocTicks API " , function ( )
describe ( " getTocTicks API " , function ( )
@ -68,12 +68,12 @@ describe("Readertoc module", function()
end )
end )
it ( " should get page left of chapter " , function ( )
it ( " should get page left of chapter " , function ( )
assert.truthy ( toc : getChapterPagesLeft ( 10 , 0 ) > 10 )
assert.truthy ( toc : getChapterPagesLeft ( 10 , 0 ) > 10 )
assert.truthy ( toc : getChapterPagesLeft ( 101 , 0 ) > 10 )
assert.truthy ( toc : getChapterPagesLeft ( 92 , 0 ) > 10 )
assert.are . same ( nil , toc : getChapterPagesLeft ( 200 , 0 ) )
assert.are . same ( nil , toc : getChapterPagesLeft ( 200 , 0 ) )
end )
end )
it ( " should get page done of chapter " , function ( )
it ( " should get page done of chapter " , function ( )
assert.truthy ( toc : getChapterPagesDone ( 12 , 0 ) < 5 )
assert.truthy ( toc : getChapterPagesDone ( 12 , 0 ) < 5 )
assert.truthy ( toc : getChapterPagesDone ( 9 9 , 0 ) < 5 )
assert.truthy ( toc : getChapterPagesDone ( 9 5 , 0 ) < 5 )
assert.truthy ( toc : getChapterPagesDone ( 204 , 0 ) > 10 )
assert.truthy ( toc : getChapterPagesDone ( 204 , 0 ) > 10 )
end )
end )
describe ( " collasible TOC " , function ( )
describe ( " collasible TOC " , function ( )