﻿#if !NETFX_CORE
#if NGUI
using UnityEngine;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
using UnityEngine.SceneManagement;
using I2.Loc;
using UnityEngine.UI;
using System;


public partial class I2Loc_PlayTest_Targets
{
    [UnityTest, Category("Targets")]
    public IEnumerator I2LocTest_NGUI()
    {
        SceneManager.LoadScene("I2Localization NGUI");
        yield return null;

        Assert.IsTrue(LocalizationManager.Sources.Count == (LocalizationManager.GlobalSources.Length + 1));

        var pLabel = I2Utils.FindObject("UI Root (2D)/Panel/Label").GetComponent<UILabel>();
        var pLabelDesc = I2Utils.FindObject("UI Root (2D)/Panel/Label - Description").GetComponent<UILabel>();

        LocalizationManager.CurrentLanguage = "Spanish";
        yield return null;

        Assert.IsTrue(pLabel.text == "El jugador Rojo ha ganado!");
        Assert.IsTrue(pLabelDesc.text == "Este ejemplo muestra como localizar NGUI.\r\n[000000]UILabels, UISprites y UITextures[-] pueden traducirse con solo añadirles un componente [0000FF]Localize[-] y la crear un [0000FF]LanguageSource[-] en la escena / Proyecto.");
        Assert.IsTrue(pLabelDesc.ambigiousFont.name == "Arimo14");

        LocalizationManager.CurrentLanguage = "English";
        yield return null;

        Assert.IsTrue(pLabel.text == "Red Player Wins!");
        Assert.IsTrue(pLabelDesc.text == "This example shows how to localize NGUI.\r\n[000000]UILabels, UISprites and UITextures[-] are supported by simply adding a [000000]Localize[-] component to them and setting up a [000000]LanguageSource[-] in the Scene/Project.");
        Assert.IsTrue(pLabelDesc.ambigiousFont.name == "Arimo18");

        LocalizationManager.CurrentLanguage = "French";
        yield return null;

        Assert.IsTrue(pLabel.text == "Joueur Rouge gagne!");
        Assert.IsTrue(pLabelDesc.text == "Cet exemple montre comment localiser NGUI.\r\n[000000]UILabels, UISprites et UITextures[-] sont pris en charge par le simple ajout d'un composant [0000FF]Localize[-] pour eux et la mise en place d'une [0000FF]LanguageSource[-] dans la Scène / projet.");
        Assert.IsTrue(pLabelDesc.ambigiousFont.name == "Coalition");
    }
}

#endif
#endif