Esempio n. 1
0
		public void ConvertFrom ()
		{
			Int32RectConverter r = new Int32RectConverter ();

			object or = r.ConvertFrom ("1, 2, 3, 4");
			
			Assert.AreEqual (typeof (Int32Rect), or.GetType());
			Assert.AreEqual (new Int32Rect (1, 2, 3, 4), or);

			or = r.ConvertFrom ("Empty");
			Assert.AreEqual (typeof (Int32Rect), or.GetType());
			Assert.IsTrue (((Int32Rect)or).IsEmpty);
		}
Esempio n. 2
0
		public void ConvertFrom_negative ()
		{
			Int32RectConverter r = new Int32RectConverter ();
			object or = r.ConvertFrom ("1, 2, -4, -5");

			Assert.AreEqual (typeof (Int32Rect), or.GetType());
			Assert.AreEqual (new Int32Rect (1, 2, -4, -5), or);
		}
Esempio n. 3
0
		private static Int32Rect Int32RectFromRect(Rect inputRect)
		{
			Int32RectConverter converter = new Int32RectConverter();
			if (converter.CanConvertFrom(inputRect.GetType()))
				return (Int32Rect)converter.ConvertFrom(inputRect);

			Int32Rect outRect = new Int32Rect((int)inputRect.X, (int)inputRect.Y, (int)inputRect.Width, (int)inputRect.Height);
			return outRect;
		}
Esempio n. 4
0
		public void ConvertFrom_size ()
		{
			Int32RectConverter r = new Int32RectConverter ();

			r.ConvertFrom (new Size (10, 20));
		}