Ejemplo n.º 1
0
        public void OnResize()
        {
            TextFormatFactory.DisposeItems();
            TextLayoutFactory.DisposeItems();
            ColourFactory.DisposeItems();

            var imageLoader = ImageLoader as ImageLoader;

            if (imageLoader != null)
            {
                imageLoader.DisposeAll();
            }

            Utilities.Dispose(ref backBuffer);
            Utilities.Dispose(ref backBufferView);
            Utilities.Dispose(ref renderTarget);
            Utilities.Dispose(ref factory);
            Utilities.Dispose(ref imagingFactory);

            if (swapChain != null)
            {
                swapChain.ResizeBuffers(1, Width, Height, DXGI.Format.B8G8R8A8_UNorm, DXGI.SwapChainFlags.None);
                CreateSizeDependentComponents();
            }

            children.ForEach(c => c.OnResize());
        }
        public void TestItAddsColours()
        {
            Colour colour = ColourFactory.Make();

            collection.Add(colour);

            Assert.Equal(colour, collection.Colours[0]);
        }
 public AllColoursMustBeValidTest()
 {
     first  = ColourFactory.Make("colour1", -1);
     second = ColourFactory.Make("colour2", 0);
     third  = ColourFactory.Make("colour3", 255);
     fourth = ColourFactory.Make("colour4", 16777215);
     fifth  = ColourFactory.Make("colour5", 16777216);
 }
        public void FromRgbIntAll127()
        {
            var result = ColourFactory.FromRgbInt(127, 127, 127);

            Assert.AreEqual(0.5, Math.Round(result.R, 1));
            Assert.AreEqual(0.5, Math.Round(result.G, 1));
            Assert.AreEqual(0.5, Math.Round(result.B, 1));
        }
        public void TestItReturnsElementsInOrder()
        {
            Colour first  = ColourFactory.Make("red");
            Colour second = ColourFactory.Make("green");
            Colour third  = ColourFactory.Make("blue");

            sectorElements.Add(first);
            sectorElements.Add(second);
            sectorElements.Add(third);

            IEnumerable <ICompilableElementProvider> expected = new List <ICompilableElementProvider>()
            {
                third,
                second,
                first
            };

            AssertCollectedItems(expected);
        }
 public AllRegionsMustHaveAValidColourTest()
 {
     sectorElements.Add(ColourFactory.Make("colour1"));
 }
Ejemplo n.º 7
0
 public ColourValidatorTest()
 {
     sectorElements = new SectorElementCollection();
     sectorElements.Add(ColourFactory.Make("colour1"));
     sectorElements.Add(ColourFactory.Make("colour2"));
 }
 public AllColoursMustHaveAUniqueIdTest()
 {
     first  = ColourFactory.Make("colour1");
     second = ColourFactory.Make("colour2");
     third  = ColourFactory.Make("colour1");
 }
 public AllSctSidsMustHaveValidColoursTest()
 {
     sectorElements.Add(ColourFactory.Make("colour1"));
 }
 public void TestItFailsIfColourNotDefined()
 {
     sectorElements.Add(ColourFactory.Make("notcentrelinecolour"));
     AssertValidationErrors();
 }
 public void TestItPassesOnColourDefined()
 {
     sectorElements.Add(ColourFactory.Make("centrelinecolour"));
     AssertNoValidationErrors();
 }
        public void FromRgbIntAllNegative()
        {
            var result = ColourFactory.FromRgbInt(-500, -1024, -256);

            Assert.AreEqual(new Colour(0, 0, 0), result);
        }
        public void FromRgbIntAllTooLarge()
        {
            var result = ColourFactory.FromRgbInt(500, 1024, 256);

            Assert.AreEqual(new Colour(1, 1, 1), result);
        }
        public void FromRgbIntAll255()
        {
            var result = ColourFactory.FromRgbInt(255, 255, 255);

            Assert.AreEqual(new Colour(1, 1, 1), result);
        }
        public void FromRgbIntAllZeros()
        {
            var result = ColourFactory.FromRgbInt(0, 0, 0);

            Assert.AreEqual(new Colour(0, 0, 0), result);
        }