示例#1
0
        public void SizeTrackerEventTest()
        {
            NuGenRatioSizeTracker sizeTracker = new NuGenRatioSizeTracker(new Size(800, 600));
            SizeTrackerEventSink  eventSink   = new SizeTrackerEventSink(sizeTracker);

            eventSink.ExpectedWidth  = 640;
            eventSink.ExpectedHeight = 480;
            eventSink.ExpectedHeightChangedCallsCount = 1;
            eventSink.ExpectedWidthChangedCallsCount  = 0;

            sizeTracker.Width = 640;
            Assert.AreEqual(new Size(640, 480), sizeTracker.Size);

            eventSink.Verify();
        }
        public void SizeTrackerDoNotMaintainAspectRatioEventTest()
        {
            NuGenRatioSizeTracker sizeTracker = new NuGenRatioSizeTracker(new Size(800, 600));
            SizeTrackerEventSink  eventSink   = new SizeTrackerEventSink(sizeTracker);

            eventSink.ExpectedHeightChangedCallsCount = 0;
            eventSink.ExpectedWidthChangedCallsCount  = 0;

            sizeTracker.Height = 800;
            Assert.AreEqual(new Size(800, 800), sizeTracker.Size);

            sizeTracker.Width = 480;
            Assert.AreEqual(new Size(480, 800), sizeTracker.Size);

            eventSink.Verify();
        }
		public void SizeTrackerDoNotMaintainAspectRatioEventTest()
		{
			NuGenRatioSizeTracker sizeTracker = new NuGenRatioSizeTracker(new Size(800, 600), false);
			SizeTrackerEventSink eventSink = new SizeTrackerEventSink(sizeTracker);

			eventSink.ExpectedHeightChangedCallsCount = 0;
			eventSink.ExpectedWidthChangedCallsCount = 0;

			sizeTracker.Height = 800;
			Assert.AreEqual(new Size(800, 800), sizeTracker.Size);

			sizeTracker.Width = 480;
			Assert.AreEqual(new Size(480, 800), sizeTracker.Size);

			eventSink.Verify();
		}
		public void SizeTrackerEventTest()
		{
			NuGenRatioSizeTracker sizeTracker = new NuGenRatioSizeTracker(new Size(800, 600));
			SizeTrackerEventSink eventSink = new SizeTrackerEventSink(sizeTracker);

			eventSink.ExpectedWidth = 640;
			eventSink.ExpectedHeight = 480;
			eventSink.ExpectedHeightChangedCallsCount = 1;
			eventSink.ExpectedWidthChangedCallsCount = 0;

			sizeTracker.Width = 640;
			Assert.AreEqual(new Size(640, 480), sizeTracker.Size);

			eventSink.Verify();
		}