Skip to content

Commit

Permalink
fix: can not paste enum
Browse files Browse the repository at this point in the history
  • Loading branch information
fuqunaga committed Aug 27, 2024
1 parent 4139901 commit 0a0e607
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions Assets/Tests/Editor/Clipboard/ClipboardParserTest_Deserialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,16 @@ public void MatchUnityEditorMethod_Generic(string text) =>

private static string[] EnumSource => new[]
{
"", "_",
"", "_","Enum:",
"one", "One",
"_two", "Two",
"three_", "Three",
"fourthItem", "FourthItem",
"FifthItem", "fifthItem",
"Sixth_Item", "SixthItem",
"SEVEN", "Seven",
"Enum:one", "Enum:One",
"Enum one", "Enum;one",
"Enum:_two", "Enum:Two",
"Enum:three_", "Enum:Three",
"Enum:fourthItem", "Enum:FourthItem",
"Enum:FifthItem", "Enum:fifthItem",
"Enum:Sixth_Item", "Enum:SixthItem",
"Enum:SEVEN", "Enum:Seven",
null,
"expect parse fail"
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public static bool DeserializeEnum(string text, Type type, out object value)
foreach (var name in names)
{
var displayName = RuntimeObjectNames.NicifyVariableName(name);
if (displayName != text) continue;
if (displayName != val) continue;

value = Enum.Parse(type, name);
return true;
Expand Down

0 comments on commit 0a0e607

Please sign in to comment.