/*
 * SPDX-License-Identifier: GPL-3.0-or-later
 */
package com.runicgateway.app.ui.theme

import androidx.compose.ui.graphics.Color
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test

/** Unit tests for brand accent parsing (PLAN.md §3, §5). */
class BrandColorTest {

    @Test fun nullOrBlankReturnsNull() {
        assertNull(parseBrandColor(null))
        assertNull(parseBrandColor(""))
        assertNull(parseBrandColor("   "))
    }

    @Test fun sixDigitHexParses() {
        assertEquals(Color(0xFF7F99BD), parseBrandColor("#7f99bd"))
    }

    @Test fun hashIsOptional() {
        assertEquals(parseBrandColor("#7f99bd"), parseBrandColor("7f99bd"))
    }

    @Test fun shorthandExpands() {
        assertEquals(parseBrandColor("#ffffff"), parseBrandColor("#fff"))
    }

    @Test fun eightDigitHexKeepsAlpha() {
        assertEquals(Color(0x80112233), parseBrandColor("#80112233"))
    }

    @Test fun invalidReturnsNull() {
        assertNull(parseBrandColor("#12"))
        assertNull(parseBrandColor("nothex!"))
        assertNull(parseBrandColor("#gggggg"))
    }
}
