EditorUITest.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using NUnit.Framework;
  3. using Unity.RenderStreaming.Editor;
  4. namespace Unity.RenderStreaming.EditorTest
  5. {
  6. class CustomSignalingSettingsEditorTest
  7. {
  8. [Test]
  9. public void FindInspectorTypeByInspectedType()
  10. {
  11. Type type = typeof(WebSocketSignalingSettings);
  12. Assert.That(CustomSignalingSettingsEditor.FindInspectorTypeByInspectedType(type), Is.EqualTo(typeof(WebSocketSignalingSettingsEditor)));
  13. type = typeof(HttpSignalingSettings);
  14. Assert.That(CustomSignalingSettingsEditor.FindInspectorTypeByInspectedType(type), Is.EqualTo(typeof(HttpSignalingSettingsEditor)));
  15. type = typeof(int);
  16. Assert.That(CustomSignalingSettingsEditor.FindInspectorTypeByInspectedType(type), Is.Null);
  17. }
  18. [Test]
  19. public void FindInspectedTypeByLabel()
  20. {
  21. var labels = CustomSignalingSettingsEditor.Labels();
  22. foreach (var label in labels)
  23. {
  24. Assert.That(CustomSignalingSettingsEditor.FindInspectedTypeByLabel(label), Is.Not.Null);
  25. }
  26. Assert.That(CustomSignalingSettingsEditor.FindInspectedTypeByLabel(null), Is.Null);
  27. Assert.That(CustomSignalingSettingsEditor.FindInspectedTypeByLabel(string.Empty), Is.Null);
  28. Assert.That(CustomSignalingSettingsEditor.FindInspectedTypeByLabel("dummy"), Is.Null);
  29. }
  30. [Test]
  31. public void FindLabel()
  32. {
  33. Type inspectorType = typeof(WebSocketSignalingSettingsEditor);
  34. Type inspectedType = typeof(WebSocketSignalingSettings);
  35. Assert.That(CustomSignalingSettingsEditor.FindLabelByInspectorType(inspectorType), Is.EqualTo(CustomSignalingSettingsEditor.FindLabelByInspectedType(inspectedType)));
  36. inspectorType = typeof(HttpSignalingSettingsEditor);
  37. inspectedType = typeof(HttpSignalingSettings);
  38. Assert.That(CustomSignalingSettingsEditor.FindLabelByInspectorType(inspectorType), Is.EqualTo(CustomSignalingSettingsEditor.FindLabelByInspectedType(inspectedType)));
  39. inspectorType = typeof(int);
  40. Assert.That(CustomSignalingSettingsEditor.FindLabelByInspectorType(inspectorType), Is.Null);
  41. inspectedType = typeof(int);
  42. Assert.That(CustomSignalingSettingsEditor.FindLabelByInspectedType(inspectedType), Is.Null);
  43. }
  44. [Test]
  45. public void Labels()
  46. {
  47. var labels = CustomSignalingSettingsEditor.Labels();
  48. Assert.That(labels, Is.Not.Empty);
  49. Assert.That(labels, Is.Not.Contains(string.Empty));
  50. Assert.That(labels, Is.Not.Contains(null));
  51. }
  52. }
  53. }