Spec updates for new font

This commit is contained in:
Frans de Jonge
2015-09-05 11:32:34 +02:00
parent d5066f85b4
commit 6eca0be44b
4 changed files with 18 additions and 19 deletions

View File

@@ -16,10 +16,10 @@ describe("Readertoc module", function()
end)
it("should get toc title from page", function()
local title = toc:getTocTitleByPage(51)
--DEBUG("toc", toc.toc)
assert(title == "Prologue")
DEBUG("toc", toc.toc)
assert(title == "SCENE V. A hall in Capulet's house.")
local title = toc:getTocTitleByPage(155)
assert(title == "SCENE IV. Hall in Capulet's house.")
assert(title == "SCENE I. Friar Laurence's cell.")
end)
describe("getTocTicks API", function()
local ticks_level_0 = nil
@@ -50,24 +50,24 @@ describe("Readertoc module", function()
end)
end)
it("should get page of next chapter", function()
assert.are.same(23, toc:getNextChapter(10, 0))
assert.are.same(106, toc:getNextChapter(100, 0))
assert.are.same(24, toc:getNextChapter(10, 0))
assert.are.same(113, toc:getNextChapter(100, 0))
assert.are.same(nil, toc:getNextChapter(200, 0))
end)
it("should get page of previous chapter", function()
assert.are.same(8, toc:getPreviousChapter(10, 0))
assert.are.same(94, toc:getPreviousChapter(100, 0))
assert.are.same(174, toc:getPreviousChapter(200, 0))
assert.are.same(97, toc:getPreviousChapter(100, 0))
assert.are.same(182, toc:getPreviousChapter(200, 0))
end)
it("should get page left of chapter", function()
assert.are.same(12, toc:getChapterPagesLeft(10, 0))
assert.are.same(5, toc:getChapterPagesLeft(100, 0))
assert.are.same(13, toc:getChapterPagesLeft(10, 0))
assert.are.same(12, toc:getChapterPagesLeft(100, 0))
assert.are.same(nil, toc:getChapterPagesLeft(200, 0))
end)
it("should get page done of chapter", function()
assert.are.same(2, toc:getChapterPagesDone(10, 0))
assert.are.same(6, toc:getChapterPagesDone(100, 0))
assert.are.same(26, toc:getChapterPagesDone(200, 0))
assert.are.same(0, toc:getChapterPagesDone(100, 0))
assert.are.same(18, toc:getChapterPagesDone(200, 0))
end)
describe("collasible TOC", function()
it("should collapse the secondary toc nodes by default", function()