36 lines
997 B
C#
36 lines
997 B
C#
using System.Reflection;
|
|
using NUnit.Framework;
|
|
using UnityEditor;
|
|
|
|
public sealed class XWorldJsonPrefabAutoConvertTests
|
|
{
|
|
private const string JsonPrefKey = "XWorld.UI.AutoConvertJsonOnFocus";
|
|
private const string HtmlPrefKey = "XWorld.UI.AutoConvertHtmlOnFocus";
|
|
|
|
[TearDown]
|
|
public void TearDown()
|
|
{
|
|
EditorPrefs.DeleteKey(JsonPrefKey);
|
|
EditorPrefs.DeleteKey(HtmlPrefKey);
|
|
}
|
|
|
|
[Test]
|
|
public void JsonAutoConvertDefaultsToEnabledIndependentlyOfHtmlPreference()
|
|
{
|
|
EditorPrefs.DeleteKey(JsonPrefKey);
|
|
EditorPrefs.SetBool(HtmlPrefKey, false);
|
|
|
|
Assert.That(ReadJsonAutoConvertEnabled(), Is.True);
|
|
}
|
|
|
|
private static bool ReadJsonAutoConvertEnabled()
|
|
{
|
|
MethodInfo method = typeof(XWorldUtil).GetMethod(
|
|
"IsAutoConvertJsonOnFocusEnabled",
|
|
BindingFlags.Static | BindingFlags.NonPublic);
|
|
|
|
Assert.That(method, Is.Not.Null);
|
|
return (bool)method.Invoke(null, null);
|
|
}
|
|
}
|