Beispiel #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
     }
 }
Beispiel #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);
     }
 }
Beispiel #3
0
 public void TestThrowOnConstructFromBrokenResource()
 {
     Assert.Throws <ArgumentException>(
         delegate() {
         using (
             FlatGuiVisualizer visualizer = FlatGuiVisualizer.FromResource(
                 this.mockedGraphicsDeviceService.ServiceProvider,
                 Resources.UnitTestResources.ResourceManager, "BadColorSkin"
                 )
             ) { }
     }
         );
 }
Beispiel #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
         }
     }
 }
Beispiel #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);
            }
        }
Beispiel #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")
                     )
                 ) { }
         }
             );
     }
 }