package org.onetwo.boot.utils;

import org.junit.Test;
import org.onetwo.boot.utils.ImageCompressor.ImageCompressorConfig;

/**
 * @author wayshall
 * <br/>
 */
public class ImageCompressorTest {
	
	@Test
	public void test(){
		ImageCompressor compressor = new ImageCompressor();
//		compressor.setScale(1);
//		compressor.setHeight(350);
		compressor.setConfig(ImageCompressorConfig.builder().width(350).build());
		compressor.compressTo("C:/Users/way/Desktop/bak/18da/a.jpg", "C:/Users/way/Desktop/bak/18da/a-compress.jpg");
		
		compressor = new ImageCompressor();
		//不可以只设置width，同时又设置scale
		compressor.setConfig(ImageCompressorConfig.builder().width(350).build());
		compressor.compressTo("C:/Users/way/Desktop/bak/18da/hst.jpg", "C:/Users/way/Desktop/bak/18da/hst-compress.jpg");
	}

}

@@ -782,12 +782,302 @@
 pg%22);%0A%09%7D
+%0A%09%0A%09@Test%0A%09public void testOSX()%7B%0A%09%09ImageCompressor compressor = new ImageCompressor();%0A%09%09compressor.setConfig(ImageCompressorConfig.builder().scale(0.3).quality(0.3).build());%0A%09%09compressor.compressTo(%22/Users/way/data/defulat_cover.jpg%22, %0A%09%09%09%09%22/Users/way/data/defulat_cover_min.jpg%22);%0A%09%09%0A%09%7D
 %0A%0A%7D%0A

add image compressor test