using System.IO;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.TestTools;
using UnityEngine.UI;
namespace TMPro
{
///
/// End to end coverage for the reported bug: "TextMeshPro input field doesn't remove
/// characters from the first backspace when variant characters are used with the input
/// field", where a variant character is a base character followed by a variation selector -
/// typically an Ideographic Variation Sequence, whose selector (U+E0100 and up) is a
/// surrogate pair.
///
/// In its default editing mode the input field resolves every delete range and caret step
/// through textInfo.characterInfo[n].index and .stringLength. SetArraySizes used to record
/// the span of the last code point consumed by the variation selector block instead of the
/// span of the whole cluster, so the first Backspace either removed the wrong span or
/// indexed a characterInfo slot past characterCount and removed nothing. The span mapping
/// itself is covered by TMP_CharacterClusterTests; these tests assert the behaviour a user
/// sees.
///
[Category("Text Parsing & Layout")]
[UnityPlatform(RuntimePlatform.OSXEditor, RuntimePlatform.WindowsEditor, RuntimePlatform.LinuxEditor)]
internal class TMP_InputFieldClusterTests : TMPTestSuiteWithEssentialResources
{
// U+E0100 VARIATION SELECTOR-17, encoded as a surrogate pair: two UTF-16 code units.
const string k_VariationSelector17 = "\U000E0100";
// U+1F600 GRINNING FACE. A plain surrogate pair, with no variation selector.
const string k_AstralCharacter = "\U0001F600";
GameObject m_CameraObject;
GameObject m_CanvasObject;
GameObject m_InputObject;
GameObject m_EventObject;
TMP_InputField m_InputField;
[SetUp]
public void SetUp()
{
m_CameraObject = new GameObject("Camera Object", typeof(Camera));
m_CanvasObject = new GameObject("Canvas Object", typeof(Canvas), typeof(GraphicRaycaster));
m_CanvasObject.GetComponent