﻿#if !NETFX_CORE
#if TK2D
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_2DTooKit()
    {
        SceneManager.LoadScene("I2Localization 2DToolKit");
        yield return null;

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

        var pLabel = I2Utils.FindObject("text/TextMesh Desc").GetComponent<tk2dTextMesh>();
        var pCubeLabel = I2Utils.FindObject("Cube/TextMesh").GetComponent<tk2dTextMesh>();
        var pCubeSprite = I2Utils.FindObject("Cube/Sprite").GetComponent<tk2dSprite>();

        I2Utils.FindObject("GuiCamera/Button_Spanish").GetComponent<SetLanguage>().ApplyLanguage();
        yield return null;

        Assert.IsTrue(pLabel.text == "Haga clic en los botones de abajo para cambiar el idioma");
        Assert.IsTrue(pCubeLabel.text == "Ejemplo de Localization 2D ToolKit");
        Assert.IsTrue(pCubeSprite.CurrentSprite.name == "crate");

        I2Utils.FindObject("GuiCamera/Button_English").GetComponent<SetLanguage>().ApplyLanguage();
        yield return null;

        Assert.IsTrue(pLabel.text == "Click on any of the buttons bellow to change the language");
        Assert.IsTrue(pCubeLabel.text == "2D-ToolKit Localization Example");
        Assert.IsTrue(pCubeSprite.CurrentSprite.name == "Chest Closed");

        I2Utils.FindObject("GuiCamera/Button_French").GetComponent<SetLanguage>().ApplyLanguage();
        yield return null;

        Assert.IsTrue(pLabel.text == "Cliquez sur un des boutons ci-dessous pour changer la langue");
        Assert.IsTrue(pCubeLabel.text == "2D-ToolKit Localisation Exemple");
        Assert.IsTrue(pCubeSprite.CurrentSprite.name == "Checkbox");
    }
}

#endif
#endif