﻿#if !NETFX_CORE
using UnityEngine;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
using UnityEngine.SceneManagement;
using I2.Loc;
using UnityEngine.UI;
using System;
#pragma warning disable 618


public partial class I2Loc_PlayTest_Features
{
    [UnityTest, Category("Features")]
    public IEnumerator I2LocTest_RightToLeft_Text_Rendering()
    {
        SceneManager.LoadScene("I2Localization    features RightToLeft Text Rendering");
        yield return null;

        var pRight = I2Utils.FindObject("Canvas/Right Text").GetComponent<Text>();
        var pWrong = I2Utils.FindObject("Canvas/Wrong Text").GetComponent<Text>();
        var pLineWrap = I2Utils.FindObject("Canvas/RightLineWrap Text").GetComponent<Text>();

        I2Utils.FindObject("Canvas/Buttons/Arabic").GetComponent<SetLanguage>().ApplyLanguage();
        yield return null;

        Assert.IsTrue(pRight.text == ".ﺺﻨﻟا ﻞﻌﺟ ﺄﻄﺨﻟاو باﻮﺼﻟا ﺢﺿﻮﻳ لﺎﺜﻣ ﺺﻧ ﻮﻫ اﺬﻫ");
        Assert.IsTrue(pWrong.text == "هذا هو نص مثال يوضح الصواب والخطأ جعل النص.");
        Assert.IsTrue(pLineWrap.text == "ﺢﺿﻮﻳ لﺎﺜﻣ ﺺﻧ ﻮﻫ اﺬﻫ\r\n.ﺺﻨﻟا ﻞﻌﺟ ﺄﻄﺨﻟاو باﻮﺼﻟا");

        I2Utils.FindObject("Canvas/Buttons/English").GetComponent<SetLanguage>().ApplyLanguage();
        yield return null;

        Assert.IsTrue(pRight.text == "This is an example text showing \nright and wrong text rendering.");
        Assert.IsTrue(pWrong.text == "This is an example text showing \nright and wrong text rendering.");
        Assert.IsTrue(pLineWrap.text == "This is an example text showing \nright and wrong text rendering.");
    }
}

#endif