"""Tests para pdf_add_page."""

import sys
import os

sys.path.insert(0, os.path.dirname(__file__))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "python", "types", "infra"))

from pdf_create import pdf_create
from pdf_add_page import pdf_add_page


def test_anadir_pagina_portrait_a4():
    doc = pdf_create()
    doc = pdf_add_page(doc, orientation="portrait")
    assert len(doc.pages) == 1
    assert doc.pages[0]["orientation"] == "portrait"
    assert doc.fpdf.page == 1


def test_anadir_pagina_landscape():
    doc = pdf_create()
    doc = pdf_add_page(doc, orientation="landscape")
    assert len(doc.pages) == 1
    assert doc.pages[0]["orientation"] == "landscape"


def test_pagina_con_dimensiones_personalizadas():
    doc = pdf_create()
    doc = pdf_add_page(doc, width=148.0, height=210.0)  # A5
    assert len(doc.pages) == 1
    # Verificar que se añadio la pagina
    assert doc.fpdf.page == 1
