Skip to content

Commit

Permalink
test: add reflection test
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Jan 30, 2025
1 parent dd45457 commit 75234e0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 26 deletions.
26 changes: 0 additions & 26 deletions Assets/Tests/Editor/NewTestScript.cs

This file was deleted.

34 changes: 34 additions & 0 deletions Assets/Tests/Editor/ReflectionTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Reflection;
using NUnit.Framework;
using UnityEditor;
using UnityEngine;

namespace Coffee
{
public class ReflectionTests
{
const BindingFlags flags = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public;

[Test]
public void DoIntRangeProperty()
{
var method = typeof(MaterialEditor)
.GetMethod("DoIntRangeProperty", flags)
.CreateDelegate(typeof(Func<Rect, MaterialProperty, GUIContent, int>), null)
as Func<Rect, MaterialProperty, GUIContent, int>;

Assert.IsNotNull(method);
}

[Test]
public void DoPowerRangeProperty()
{
var method = typeof(MaterialEditor)
.GetMethod("DoPowerRangeProperty", flags)
.CreateDelegate(typeof(Func<Rect, MaterialProperty, GUIContent, float, float>), null)
as Func<Rect, MaterialProperty, GUIContent, float, float>;
Assert.IsNotNull(method);
}
}
}
File renamed without changes.

0 comments on commit 75234e0

Please sign in to comment.