2
0
mirror of https://github.com/koreader/koreader synced 2024-11-04 12:00:25 +00:00
koreader/spec/unit/filemanagerconverter_spec.lua
poire-z 24424e505e Update UI layout code to use new SVG icons
- Add IconWidget, use it for icons instead of ImageWidget.
  Specify icons by name only, look for them (with either
  .svg or .png suffixes) in multiple directories (including
  koreader/settings/icons/ to allow customizing them).
  Don't crash when icon name not found, shown a black
  background warning icon instead.
- Don't trust the icons' native sizes: replace
  scale_for_dpi=true with width/height=DGENERIC_ICON_SIZE,
  so all icons get the same (tunable) size - except in
  a few specific use cases.
- Top and bottom menu bars: normalize, and have icons
  properly centered in them, extend vertical line
  separators up to the edges.
- TOC: adjust expand/collapse icons size to items size
2020-12-19 14:49:18 +01:00

51 lines
2.2 KiB
Lua

describe("FileConverter module", function()
local FileConverter
setup(function()
require("commonrequire")
FileConverter = require("apps/filemanager/filemanagerconverter")
end)
it("should show conversion support for Markdown", function()
assert.is_true(FileConverter:isSupported("/markdown_file.md"))
end)
it("should not show conversion support for PDF", function()
assert.is_false(FileConverter:isSupported("/pdf_file.pdf"))
end)
it("should convert Markdown to HTML", function()
local markdown = [[
# KOReader Quickstart Guide
Welcome to KOreader. You can activate the menu by swiping down from the top of the screen. Clicking outside the menu or swiping up on the menu will discard it. Turning pages can be done either by swiping left and right or by single taps on the left or right side of the screen.
**Main menu**
![Menu](../resources/menu.svg) You can always view this quickstart guide again through *Help* → *Quickstart guide* in the top right menu.
**Settings**
![Settings](../resources/settings.svg) You can change the language and other settings through the gear icon.
------------
Generated by KOReader v2015.11-982-g704d4238.
]]
local title = "KOReader Quickstart Guide"
local html_expected = [[<!DOCTYPE html>
<html>
<head>
<title>KOReader Quickstart Guide</title>
</head>
<body>
<h1>KOReader Quickstart Guide</h1>
<p>Welcome to KOreader. You can activate the menu by swiping down from the top of the screen. Clicking outside the menu or swiping up on the menu will discard it. Turning pages can be done either by swiping left and right or by single taps on the left or right side of the screen.</p>
<p><strong>Main menu</strong></p>
<p><img alt="Menu" src="../resources/menu.svg"> You can always view this quickstart guide again through <em>Help</em> → <em>Quickstart guide</em> in the top right menu.</p>
<p><strong>Settings</strong></p>
<p><img alt="Settings" src="../resources/settings.svg"> You can change the language and other settings through the gear icon.</p>
<hr>
<p>Generated by KOReader v2015.11-982-g704d4238.</p>
</body>
</html>]]
assert.are.same(html_expected, FileConverter:mdToHtml(markdown, title))
end)
end)