[add] coverage
This commit is contained in:
parent
432303bf00
commit
d8acb448de
4 changed files with 71 additions and 2 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
## 0.2.5 2025-02-17
|
||||||
|
* rename property pages to pageCount
|
||||||
|
* increase test coverage
|
||||||
## 0.2.4 2025-02-16
|
## 0.2.4 2025-02-16
|
||||||
* Add `property`
|
* Add `property`
|
||||||
* rewrite `report` to return CSV style data
|
* rewrite `report` to return CSV style data
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "pdfbox",
|
"name": "pdfbox",
|
||||||
"version": "0.2.4",
|
"version": "0.2.5",
|
||||||
"description": "A BaseX interface to Apache Pdfbox version 3",
|
"description": "A BaseX interface to Apache Pdfbox version 3",
|
||||||
"main": "src/Pdfbox3.xqm",
|
"main": "src/Pdfbox3.xqm",
|
||||||
"homepage": "https://github.com/expkg-zone58/pdfbox#readme",
|
"homepage": "https://github.com/expkg-zone58/pdfbox#readme",
|
||||||
|
|
|
@ -116,7 +116,7 @@ as xs:base64Binary{
|
||||||
values are sequences of functions to get property from $pdf object
|
values are sequences of functions to get property from $pdf object
|
||||||
:)
|
:)
|
||||||
declare %private variable $pdfbox:property-map:=map{
|
declare %private variable $pdfbox:property-map:=map{
|
||||||
"pages": pdfbox:page-count#1,
|
"pageCount": pdfbox:page-count#1,
|
||||||
|
|
||||||
"hasOutline": pdfbox:hasOutline#1,
|
"hasOutline": pdfbox:hasOutline#1,
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,72 @@ function test:password-good(){
|
||||||
return unit:assert(true())
|
return unit:assert(true())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(:~ Test for pdfbox:binary function :)
|
||||||
|
declare %unit:test
|
||||||
|
function test:binary(){
|
||||||
|
let $pdf:=test:open("samples.pdf/BaseX100.pdf")
|
||||||
|
let $binary:=pdfbox:binary($pdf)
|
||||||
|
return unit:assert(exists($binary))
|
||||||
|
};
|
||||||
|
|
||||||
|
(:~ Test for pdfbox:save function :)
|
||||||
|
declare %unit:test
|
||||||
|
function test:save(){
|
||||||
|
let $pdf:=test:open("samples.pdf/BaseX100.pdf")
|
||||||
|
let $dest:=file:create-temp-file("test-save",".pdf")
|
||||||
|
let $savedPath:=pdfbox:save($pdf, $dest)
|
||||||
|
return unit:assert-equals($savedPath, $dest)
|
||||||
|
};
|
||||||
|
|
||||||
|
(:~ Test for pdfbox:property function :)
|
||||||
|
declare %unit:test
|
||||||
|
function test:property(){
|
||||||
|
let $pdf:=test:open("samples.pdf/BaseX100.pdf")
|
||||||
|
let $pages:=pdfbox:property($pdf, "pageCount")
|
||||||
|
return unit:assert(true())
|
||||||
|
};
|
||||||
|
|
||||||
|
(:~ Test for pdfbox:property function :)
|
||||||
|
declare %unit:test("expected", "pdfbox:property")
|
||||||
|
function test:property-bad(){
|
||||||
|
let $pdf:=test:open("samples.pdf/BaseX100.pdf")
|
||||||
|
let $title:=pdfbox:property($pdf, "totle")
|
||||||
|
return unit:assert(exists($title))
|
||||||
|
};
|
||||||
|
(:~ Test for pdfbox:defined-properties function :)
|
||||||
|
declare %unit:test
|
||||||
|
function test:defined-properties(){
|
||||||
|
let $properties:=pdfbox:defined-properties()
|
||||||
|
return unit:assert(exists($properties))
|
||||||
|
};
|
||||||
|
|
||||||
|
(:~ Test for pdfbox:report function :)
|
||||||
|
declare %unit:test
|
||||||
|
function test:report(){
|
||||||
|
let $pdfPaths:=("samples.pdf/BaseX100.pdf", "samples.pdf/icelandic-dictionary.pdf")
|
||||||
|
!test:resolve(.)
|
||||||
|
let $report:=pdfbox:report($pdfPaths)
|
||||||
|
return unit:assert(exists($report?names) and exists($report?records))
|
||||||
|
};
|
||||||
|
|
||||||
|
(:~ Test for pdfbox:hasOutline function :)
|
||||||
|
declare %unit:test
|
||||||
|
function test:hasOutline(){
|
||||||
|
let $pdf:=test:open("samples.pdf/BaseX100.pdf")
|
||||||
|
let $hasOutline:=pdfbox:hasOutline($pdf)
|
||||||
|
return unit:assert(not($hasOutline))
|
||||||
|
};
|
||||||
|
|
||||||
|
(:~ Test for pdfbox:hasLabels function :)
|
||||||
|
declare %unit:test
|
||||||
|
function test:hasLabels(){
|
||||||
|
let $pdf:=test:open("samples.pdf/BaseX100.pdf")
|
||||||
|
let $hasLabels:=pdfbox:hasLabels($pdf)
|
||||||
|
return unit:assert($hasLabels)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(:---------------------------------------:)
|
(:---------------------------------------:)
|
||||||
declare function test:open($file as xs:string,$opts as map(*))
|
declare function test:open($file as xs:string,$opts as map(*))
|
||||||
as item(){
|
as item(){
|
||||||
|
|
Loading…
Add table
Reference in a new issue