66 lines
2.1 KiB
Java
66 lines
2.1 KiB
Java
|
|
package com.ai.da.controller;
|
||
|
|
|
||
|
|
import com.ai.da.AiDaApplication;
|
||
|
|
import com.ai.da.common.utils.PantoneUtils;
|
||
|
|
import com.ai.da.service.DesignService;
|
||
|
|
import com.ai.da.service.PanToneService;
|
||
|
|
import org.junit.Test;
|
||
|
|
import org.junit.runner.RunWith;
|
||
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
||
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
||
|
|
|
||
|
|
import javax.annotation.Resource;
|
||
|
|
import java.util.Arrays;
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
@RunWith(SpringRunner.class)
|
||
|
|
@SpringBootTest(classes = AiDaApplication.class)
|
||
|
|
public class PantoneTest {
|
||
|
|
|
||
|
|
@Resource
|
||
|
|
private PanToneService panToneService;
|
||
|
|
@Resource
|
||
|
|
private DesignService designService;
|
||
|
|
|
||
|
|
@Test
|
||
|
|
public void testGetPantoneByRgbBatch(){
|
||
|
|
List<String> colors = Arrays.asList("244 222 222","120 57 55","229 208 207","223 184 182","80 49 48");
|
||
|
|
// System.out.println(panToneService.getPantoneByRgbBatch(colors));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Test
|
||
|
|
public void testDesign(){
|
||
|
|
System.out.println(designService.detail(34182L));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Test
|
||
|
|
public void testRgbToHsv(){
|
||
|
|
|
||
|
|
|
||
|
|
// 42 228 194
|
||
|
|
// 226 194 194
|
||
|
|
// 174 226 20
|
||
|
|
int[] rgb1 = {174,226,20};
|
||
|
|
System.out.println(Arrays.toString(rgb1));
|
||
|
|
rgb1 = PantoneUtils.rgbToHsv(rgb1);
|
||
|
|
System.out.println(Arrays.toString(rgb1));
|
||
|
|
System.out.println(rgb1[0] * 101 * 101 + rgb1[1] * 101 + rgb1[2]);
|
||
|
|
int[] rgb2 = {226,194,194};
|
||
|
|
System.out.println(Arrays.toString(rgb2));
|
||
|
|
System.out.println(Arrays.toString(PantoneUtils.rgbToHsv(rgb2)));
|
||
|
|
System.out.println(rgb2[0] * 101 * 101 + rgb2[1] * 101 + rgb2[2]);
|
||
|
|
int[] rgb3 = {42,228,194};
|
||
|
|
System.out.println(Arrays.toString(rgb3));
|
||
|
|
System.out.println(Arrays.toString(PantoneUtils.rgbToHsv(rgb3)));
|
||
|
|
System.out.println(rgb3[0] * 101 * 101 + rgb3[1] * 101 + rgb3[2]);
|
||
|
|
|
||
|
|
int[] rgb4 = {246,227,180};
|
||
|
|
System.out.println(Arrays.toString(rgb4));
|
||
|
|
rgb4 = PantoneUtils.rgbToHsv(rgb4);
|
||
|
|
System.out.println(Arrays.toString(rgb4));
|
||
|
|
System.out.println(rgb4[0] * 101 * 101 + rgb4[1] * 101 + rgb4[2]);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|