# mupdf Tk specific tests --
#

package require TTXN
  # package under test is tkMuPDF 2.0  (aka MuPDF 2.0)
package require MuPDF 2.0

set thisDir [file dirname [file normalize [info script]]]
set samplesDir [file join $thisDir samples]

Name: page-saveImage
Description: {save page in a Tk photo-Image}
Test: {
    set pdf [mupdf::open [file join $samplesDir Sample-01.pdf]]
    set p0 [$pdf getpage 0]
    image create photo tkimage1
    $p0 saveImage tkimage1
    list [image width tkimage1] [image height tkimage1]
}
Cleanup: {
    $pdf quit
    image delete tkimage1
}
Expected: {612 792}


Name: page-saveImage-zoom-part
Description: {save part of a page in a Tk photo-Image}
Test: {
    set pdf [mupdf::open [file join $samplesDir Sample-01.pdf]]
    set p0 [$pdf getpage 0]
    image create photo tkimage1
    $p0 saveImage tkimage1  -zoom 2.0
    list [image width tkimage1] [image height tkimage1]
}
Cleanup: {
    $pdf quit
}
Expected: {1224 1584}

Name: page-saveImage-transparent-bg
Description: {save part of a page in a Tk photo-Image with transparent bg}
Test: {
    set pdf [mupdf::open [file join $samplesDir Sample-01.pdf]]
    set p0 [$pdf getpage 0]
    image create photo tkimage1
    $p0 saveImage tkimage1  -zoom 2.0 -overlay true
    list [image width tkimage1] [image height tkimage1]
}
Cleanup: {
    $pdf quit
}
Expected: {1224 1584}

# === cleanup ========================================
::tcltest::cleanupTests
