package tech.easyflow.ai.service.support;

import org.junit.Assert;
import org.junit.Test;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;

/**
 * VLM 连接验证专用 PNG 测试。
 */
public class VlmVerificationImageTest {

    /**
     * 验证固定资源图片可重复读取并能被标准 PNG 解码器解析。
     *
     * @throws Exception 图片解码失败时抛出
     */
    @Test
    public void pngBytesShouldReturnDeterministicReadableImage() throws Exception {
        byte[] first = VlmVerificationImage.pngBytes();
        byte[] second = VlmVerificationImage.pngBytes();
        BufferedImage image = ImageIO.read(new ByteArrayInputStream(first));

        Assert.assertArrayEquals(first, second);
        Assert.assertNotNull(image);
        Assert.assertEquals(480, image.getWidth());
        Assert.assertEquals(180, image.getHeight());
        Assert.assertEquals("5839", VlmVerificationImage.VERIFICATION_CODE);
    }
}
