示例#1
0
 public void TestConstructFromResource()
 {
     using (
         FlatGuiVisualizer visualizer = FlatGuiVisualizer.FromResource(
             this.mockedGraphicsDeviceService.ServiceProvider,
             Resources.UnitTestResources.ResourceManager, "UnitTestSkin"
             )
         ) {
         Assert.IsNotNull(visualizer); // nonsense to avoid compiler warning
     }
 }
示例#2
0
 public void TestAccessControlRepository()
 {
     using (
         FlatGuiVisualizer visualizer = FlatGuiVisualizer.FromResource(
             this.mockedGraphicsDeviceService.ServiceProvider,
             Resources.UnitTestResources.ResourceManager, "UnitTestSkin"
             )
         ) {
         // The visualizer should have added its own assembly to the list automatically
         Assert.AreEqual(1, visualizer.RendererRepository.LoadedAssemblies.Count);
     }
 }
示例#3
0
 public void TestThrowOnConstructFromBrokenResource()
 {
     Assert.Throws <ArgumentException>(
         delegate() {
         using (
             FlatGuiVisualizer visualizer = FlatGuiVisualizer.FromResource(
                 this.mockedGraphicsDeviceService.ServiceProvider,
                 Resources.UnitTestResources.ResourceManager, "BadColorSkin"
                 )
             ) { }
     }
         );
 }
示例#4
0
 public void TestConstructFromFile()
 {
     using (ResourceFileKeeper keeper = new ResourceFileKeeper()) {
         using (
             FlatGuiVisualizer visualizer = FlatGuiVisualizer.FromFile(
                 this.mockedGraphicsDeviceService.ServiceProvider,
                 Path.Combine(keeper.ResourcePath, "UnitTest.skin.xml")
                 )
             ) {
             Assert.IsNotNull(visualizer); // nonsense to avoid compiler warning
         }
     }
 }
示例#5
0
        public void TestDrawNonRenderableControl()
        {
            using (
                FlatGuiVisualizer visualizer = FlatGuiVisualizer.FromResource(
                    this.mockedGraphicsDeviceService.ServiceProvider,
                    Resources.UnitTestResources.ResourceManager, "UnitTestSkin"
                    )
                ) {
                Screen screen = new Screen(800, 600);
                screen.Desktop.Children.Add(new NonRenderableControl());

                visualizer.Draw(screen);
            }
        }
示例#6
0
 public void TestThrowOnConstructFromBrokenFile()
 {
     using (ResourceFileKeeper keeper = new ResourceFileKeeper()) {
         Assert.Throws <ArgumentException>(
             delegate() {
             using (
                 FlatGuiVisualizer visualizer = FlatGuiVisualizer.FromFile(
                     this.mockedGraphicsDeviceService.ServiceProvider,
                     Path.Combine(keeper.ResourcePath, "BadColor.skin.xml")
                     )
                 ) { }
         }
             );
     }
 }