PropertyGeneratorTests.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using UnityEngine;
  2. namespace UnityEditor.ShaderGraph.UnitTests
  3. {
  4. /*
  5. [TestFixture]
  6. public class PropertyGeneratorTests
  7. {
  8. [OneTimeSetUp]
  9. public void RunBeforeAnyTests()
  10. {
  11. Debug.unityLogger.logHandler = new ConsoleLogHandler();
  12. }
  13. private const string kPropertyName = "ThePropertyName";
  14. private const string kPropertyDescription = "ThePropertyDescription";
  15. [Test]
  16. public void TestCanAddPropertyChunkToPropertyGenerator()
  17. {
  18. var chunk = new FloatPropertyChunk(kPropertyName, kPropertyDescription, 0.5f, PropertyChunk.HideState.Visible);
  19. var generator = new PropertyCollector();
  20. generator.AddShaderProperty(chunk);
  21. Assert.AreNotEqual(string.Empty, generator.GetPropertiesBlock(0));
  22. }
  23. [Test]
  24. public void TestCanGetShaderStringWithIndentWorks()
  25. {
  26. var chunk = new FloatPropertyChunk(kPropertyName, kPropertyDescription, 0.5f, PropertyChunk.HideState.Visible);
  27. var generator = new PropertyCollector();
  28. generator.AddShaderProperty(chunk);
  29. Assert.AreEqual(0, generator.GetPropertiesBlock(0).Count(x => x == '\t'));
  30. Assert.AreEqual(1, generator.GetPropertiesBlock(1).Count(x => x == '\t'));
  31. Assert.AreEqual(2, generator.GetPropertiesBlock(2).Count(x => x == '\t'));
  32. }
  33. [Test]
  34. public void TestCanGetConfiguredTextureInfos()
  35. {
  36. var chunk = new TexturePropertyChunk(kPropertyName, kPropertyDescription, null, TextureType.Bump, PropertyChunk.HideState.Visible, TexturePropertyChunk.ModifiableState.Modifiable);
  37. var generator = new PropertyCollector();
  38. generator.AddShaderProperty(chunk);
  39. var infos = generator.GetConfiguredTexutres();
  40. Assert.AreEqual(1, infos.Count);
  41. Assert.AreEqual(kPropertyName, infos[0].name);
  42. Assert.AreEqual(0, infos[0].textureId);
  43. Assert.AreEqual(TexturePropertyChunk.ModifiableState.Modifiable, infos[0].modifiable);
  44. }
  45. }*/
  46. }