-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added lots of formats in tests - compare and assert on info on each o…
…f them
- Loading branch information
1 parent
35785c8
commit bf038b4
Showing
33 changed files
with
4,347 additions
and
30 deletions.
There are no files selected for viewing
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* XPM */ | ||
static char * to_rotate_xpm[] = { | ||
"64 64 20 1", | ||
" g #FFFFFF", | ||
". g #FEFEFE", | ||
"+ g #000000", | ||
"@ g #010101", | ||
"# g #FCFCFC", | ||
"$ g #FDFDFD", | ||
"% g #040404", | ||
"& g #030303", | ||
"* g #F8F8F8", | ||
"= g #FAFAFA", | ||
"- g #FBFBFB", | ||
"; g #F9F9F9", | ||
"> g #F7F7F7", | ||
", g #020202", | ||
"' g #050505", | ||
") g #F4F4F4", | ||
"! g #070707", | ||
"~ g #060606", | ||
"{ g #090909", | ||
"] g #0C0C0C", | ||
" . .+++++++++++++++++++ .. ", | ||
" . .++++++++++++++++++@ . #. ", | ||
" . .+++++++++++++++++++$ .. . ", | ||
" . .++++++++++++++++++%$ $ $ ", | ||
" . .+++++++++++++++++++@ # $ ", | ||
" . .++++++++++++++++++&@$. ", | ||
" . .++++++++++++++++++++ .$. ", | ||
" . .++++++++++++++++++@+. $$ ", | ||
" @++++++++++++++++++++. . ", | ||
" @++++++++++++++++++++. . ", | ||
" @++++++++++++++++++++. . ", | ||
" @++++++++++++++++++++. . ", | ||
" @++++++++++++++++++++. . ", | ||
" @++++++++++++++++++++. . ", | ||
" @++++++++++++++++++++. . ", | ||
" @++++++++++++++++++++. . ", | ||
" @+++++++++++++++++++. * = ", | ||
" @+++++++++++++++++++ $. # - ", | ||
" @++++++++++++++++++ *. = ; ", | ||
" @++++++++++++++++++. #. ", | ||
" @++++++++++++++++++ #== ", | ||
" @++++++++++++++++++ ## ", | ||
" @++++++++++++++++++# # = ", | ||
" @++++++++++++++++++ .# # . ", | ||
" @++++++++++++++++++ ", | ||
" @++++++++++++++++++ ", | ||
" @++++++++++++++++++ ", | ||
" @++++++++++++++++++ ", | ||
" @++++++++++++++++++ ", | ||
" @++++++++++++++++++ ", | ||
" @++++++++++++++++++ ", | ||
" @++++++++++++++++++ ", | ||
" @++++++++++++++++++ - $ ", | ||
" @++++++++++++++++++ # ; ", | ||
" @++++++++++++++++++. ; - ", | ||
" @++++++++++++++++++@> - $ # ", | ||
" @++++++++++++++++++&%# . ", | ||
" @++++++++++++++++++++, . ", | ||
" @++++++++++++++++++%&++&$ . ", | ||
" @++++++++++++++++++++,&+, # ", | ||
" .# +@++@&++&+@++++++++++++++++. $ . $ $ *.", | ||
" $- . -++&+++&++'+++++++++++++++++ = # # >$ ", | ||
" $ .= '+++&&++++++++++++++++++++,+ # # ; $* -", | ||
" ) = $++++++&''++++++++++++++++++,. . -. ", | ||
" - .$$ &@++&@+++++++++++++++++++&%++ #= .$ -.#- ", | ||
" * $$+!@+'+~+++++++++++++++++++,+~+. . # .", | ||
" $ .# # +,@+&+%++++++++++++++++@%~+++,+- .. =. ", | ||
" - $.. @++!+'+++++++++++++++++@+++@@+,,+ $", | ||
" -@+++&++,+&@,+++++++++++++++++++++ . ", | ||
" $ @,,+@,&+++++&+++++++++++++++++&+%+$ ", | ||
" # =+'+%+@++&&&++++++++++++++++++++++, $", | ||
" #+++@++{++&++++++++++++++++++!+!+@+ ", | ||
" # $ . +++~++!+@+++++++++++++++++&++~,+,", | ||
" ## ; +%+&&++,++++++++++++++++&++%@+++", | ||
" $ ;$ # # +++,+,+++++++++++++++++,&++]+&", | ||
" = $ - @+%+++++++++++++++++++,+&++&+", | ||
" . $ +,++@+@,,++++++++++++++++++", | ||
" $- +&~+%+++@+++++++++++++++++", | ||
" .. .# +++,%,,,@++++++++++++++++", | ||
" $ > ; @@++@+++++++++++++++++++", | ||
" . $ - +%++'%@++++++++++++++++", | ||
" # $# = -%,+@+++++++++++++++++", | ||
" $ .# ..; .$#!+@++++++++++++++++", | ||
" $ # # - +++++++++++++++++"}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,116 @@ | ||
import pmap from 'p-map' | ||
import { buildInputFile, compare } from '../src' | ||
import { buildInputFile, compare, execute, executeOne, extractInfo } from '../src' | ||
|
||
export default describe('formats', () => { | ||
|
||
const formats = ['jpg', 'png', 'psd', 'tiff', 'xcf', 'gif', 'bmp'] | ||
// heads up - all images spec/assets/to_rotate.* where converted using gimp unless explicitly saying otherwhise | ||
const formats = [ | ||
'jpg', 'png', | ||
'psd', | ||
'tiff', 'xcf', 'gif', 'bmp', 'tga', 'miff', 'ico', 'dcm', 'xpm', 'pcx', | ||
// 'pix', // gives error | ||
'fits', | ||
// 'djvu', // read only support | ||
'ppm', | ||
'pgm', | ||
'pfm', | ||
'mng', | ||
'hdr', | ||
'dds', // generated using convert -define "dds:compression={dxt1, dxt5, none}" to_rotate.png to_rotate.dds | ||
'otb', // generated using convert to_rotate.png to_rotate.otb | ||
|
||
it('compare should be true for all combinations', async done => { | ||
'txt', // generated using convert to_rotate.png to_rotate.txt | ||
|
||
const compares = [] | ||
formats.forEach(f1 => { | ||
formats.filter(f2 => f2 !== f1).forEach(async f2 => { | ||
compares.push([`to_rotate.${f1}`, `to_rotate.${f2}`]) | ||
}) | ||
}) | ||
const results = await pmap(compares, async c => { | ||
return compare(await buildInputFile(c[0]), await buildInputFile(c[1])) | ||
}) | ||
// 'rgb', // fails because MustSpecifyImageSize `to_rotate.rgb' | ||
] | ||
|
||
expect(results.length).toBeGreaterThan(formats.length * 2) | ||
const descriptions = { | ||
psd: 'Adobe Photoshop bitmap file' | ||
} | ||
|
||
results.forEach((r, i) => { | ||
expect(r).toBe(true, `compare(${compares[i][0]}, ${compares[i][1]})`) | ||
}) | ||
describe('compare and assert on info', ()=>{ | ||
|
||
done() | ||
let jasmineTimeout | ||
|
||
beforeAll(() => { | ||
jasmineTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL | ||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 40000 | ||
}) | ||
|
||
afterAll(() => { | ||
jasmine.DEFAULT_TIMEOUT_INTERVAL = jasmineTimeout | ||
}) | ||
|
||
it('compare should be true for all combinations', async done => { | ||
const compares = [] | ||
formats.forEach(f1 => { | ||
formats.filter(f2 => f2 !== f1).forEach(async f2 => { | ||
compares.push([`formats/to_rotate.${f1}`, `formats/to_rotate.${f2}`]) | ||
}) | ||
}) | ||
const results = await pmap(compares, async c => { | ||
return compare(await buildInputFile(c[0]), await buildInputFile(c[1])) | ||
}) | ||
expect(results.length).toBeGreaterThan(formats.length * 2) | ||
results.forEach((r, i) => { | ||
expect(r).toBe(true, `compare(${compares[i][0]}, ${compares[i][1]})`) | ||
}) | ||
done() | ||
}) | ||
|
||
it('info format should match', async done => { | ||
|
||
const mimeTypes = { | ||
jpg: 'image/jpeg', | ||
png: 'image/png', | ||
tiff: 'image/tiff', | ||
gif: 'image/gif', | ||
ppm: 'image/x-portable-pixmap', | ||
pnm: 'image/x-portable-greymap', | ||
pgm: 'image/x-portable-greymap', | ||
mng: 'video/x-mng', | ||
} | ||
const imFormatMap = { | ||
jpg: 'jpeg', | ||
pnm: 'pgm', | ||
} | ||
const results = await pmap(formats, async f => { | ||
return extractInfo(await buildInputFile(`formats/to_rotate.${f}`)) | ||
}) | ||
results.forEach((result, i) => { | ||
const image = result[0].image | ||
const format = formats[i] | ||
expect(imFormatMap[format] || format).toBe(image.format.toLowerCase()) | ||
expect(image.geometry.width).toBe(64) | ||
expect(image.mimeType).toBe(mimeTypes[format] || undefined) | ||
console.log(image) | ||
}) | ||
done() | ||
}) | ||
|
||
}) | ||
|
||
xit('extractInfo should get correct format and size', () => { | ||
|
||
describe('particular formats not supported or working', ()=>{ | ||
|
||
it('svg is not supported', async done => { | ||
const img = await buildInputFile('react.svg') | ||
const { outputFiles, errors } = await executeOne({ inputFiles: [img], commands: `convert MSVG:react.svg react.tiff` }) | ||
expect(outputFiles.length).toBe(0) | ||
expect(errors).toBeDefined() | ||
expect(errors.length).toBeGreaterThan(0) | ||
done() | ||
}) | ||
|
||
it('djvu doesn\'t work even read only', async done => { | ||
const img = await buildInputFile('formats/to_rotate.djvu') | ||
const { outputFiles, errors } = await executeOne({ inputFiles: [img], commands: `convert to_rotate.djvu out.tiff` }) | ||
// expect(await compare(img, outputFiles[0])).toBe(true) | ||
expect(outputFiles.length).toBe(0) | ||
expect(errors).toBeDefined() | ||
expect(errors.length).toBeGreaterThan(0) | ||
done() | ||
}) | ||
|
||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters