Line 0
Link Here
|
|
|
1 |
/* |
2 |
* Licensed to the Apache Software Foundation (ASF) under one or more |
3 |
* contributor license agreements. See the NOTICE file distributed with |
4 |
* this work for additional information regarding copyright ownership. |
5 |
* The ASF licenses this file to You under the Apache License, Version 2.0 |
6 |
* (the "License"); you may not use this file except in compliance with |
7 |
* the License. You may obtain a copy of the License at |
8 |
* |
9 |
* http://www.apache.org/licenses/LICENSE-2.0 |
10 |
* |
11 |
* Unless required by applicable law or agreed to in writing, software |
12 |
* distributed under the License is distributed on an "AS IS" BASIS, |
13 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 |
* See the License for the specific language governing permissions and |
15 |
* limitations under the License. |
16 |
*/ |
17 |
|
18 |
/* $Id$ */ |
19 |
|
20 |
package org.apache.xmlgraphics.image.loader.impl; |
21 |
|
22 |
import junit.framework.TestCase; |
23 |
|
24 |
import org.apache.xmlgraphics.image.loader.ImageContext; |
25 |
import org.apache.xmlgraphics.image.loader.ImageInfo; |
26 |
import org.apache.xmlgraphics.image.loader.ImageSessionContext; |
27 |
import org.apache.xmlgraphics.image.loader.ImageSize; |
28 |
import org.apache.xmlgraphics.image.loader.MockImageContext; |
29 |
import org.apache.xmlgraphics.image.loader.MockImageSessionContext; |
30 |
import org.apache.xmlgraphics.util.MimeConstants; |
31 |
|
32 |
/** |
33 |
* Test case for {@link ImageLoaderRawCCITTFax}. |
34 |
*/ |
35 |
public class ImageLoaderRawCCITTFaxTestCase extends TestCase { |
36 |
private ImageLoaderRawCCITTFax sut; |
37 |
|
38 |
public void testLoadImage() throws Exception { |
39 |
ImageContext context = MockImageContext.newSafeInstance(); |
40 |
ImageSessionContext session = new MockImageSessionContext(context); |
41 |
// This image file is NOT a valid tif! It is the directory table ONLY. |
42 |
ImageInfo info = new ImageInfo("dirOnly.tif", MimeConstants.MIME_TIFF); |
43 |
ImageSize size = new ImageSize(); |
44 |
// Size data can be retrieve by parsing the directory table in the TIFF |
45 |
size.setSizeInPixels(1728, 2266); |
46 |
size.setResolution(203, 192); |
47 |
size.calcSizeFromPixels(); |
48 |
info.setSize(size); |
49 |
|
50 |
sut = new ImageLoaderRawCCITTFax(); |
51 |
ImageRawCCITTFax rawImage = (ImageRawCCITTFax) sut.loadImage(info, null, session); |
52 |
assertEquals(2, rawImage.getCompression()); |
53 |
} |
54 |
} |