package space.animefu.starfallhaven;

import org.junit.Test;
import static org.junit.Assert.*;

public class HavenHudLayoutTest {
    @Test public void phoneViewportUsesCompactChromeAndPreservesWorld(){
        HavenHudLayout layout=HavenHudLayout.calculate(1280,570,80,0,0,24,2.75f);
        assertTrue(layout.compact);
        assertEquals(1f,layout.scale,.001f);
        assertTrue(layout.topBar<=54f);
        assertTrue(layout.bottomBar<=58f);
        assertTrue(layout.worldHeight(570,0,24)>=430f);
    }

    @Test public void emulatorBaselineRemainsPlayable(){
        HavenHudLayout layout=HavenHudLayout.calculate(1212,540,0,0,0,24,2.625f);
        assertTrue(layout.compact);
        assertTrue(layout.scale>=.9f&&layout.scale<=1f);
        assertTrue(layout.worldHeight(540,0,24)>=390f);
    }

    @Test public void physicalDensityCannotBalloonCanvasUi(){
        HavenHudLayout layout=HavenHudLayout.calculate(1280,570,0,0,0,0,4f);
        assertTrue(layout.scale<=1f);
        assertTrue(layout.worldHeight(570,0,0)>=450f);
    }

    @Test public void largerLandscapeViewportKeepsComfortableScale(){
        HavenHudLayout layout=HavenHudLayout.calculate(1920,1080,0,0,0,0,2f);
        assertFalse(layout.compact);
        assertEquals(1.25f,layout.scale,.001f);
        assertTrue(layout.worldHeight(1080,0,0)>850f);
    }
}
