Пример #1
0
		public static void Check_MetafileHeader_Emf (MetafileHeader header)
		{
			Assert.AreEqual (MetafileType.Emf, header.Type, "Type");
			Assert.AreEqual (65536, header.Version, "Version");
			// extactly the filesize
			Assert.AreEqual (20456, header.MetafileSize, "MetafileSize");

			Assert.AreEqual (0, header.Bounds.X, "Bounds.X");
			Assert.AreEqual (0, header.Bounds.Y, "Bounds.Y");
#if false
			Assert.AreEqual (759, header.Bounds.Width, "Bounds.Width");
			Assert.AreEqual (1073, header.Bounds.Height, "Bounds.Height");
			Assert.AreEqual (96f, header.DpiX, 0.5f, "DpiX");
			Assert.AreEqual (96f, header.DpiY, 0.5f, "DpiY");
			Assert.AreEqual (6619188, header.EmfPlusHeaderSize, "EmfPlusHeaderSize");
			Assert.AreEqual (3670064, header.LogicalDpiX, "LogicalDpiX");
			Assert.AreEqual (3670064, header.LogicalDpiY, "LogicalDpiY");
#endif
			try {
				Assert.IsNotNull (header.WmfHeader, "WmfHeader");
				Assert.Fail ("WmfHeader didn't throw an ArgumentException");
			}
			catch (ArgumentException) {
			}
			catch (Exception e) {
				Assert.Fail ("WmfHeader didn't throw an ArgumentException but: {0}.", e.ToString ());
			}

			Assert.IsFalse (header.IsDisplay (), "IsDisplay");
			Assert.IsTrue (header.IsEmf (), "IsEmf");
			Assert.IsTrue (header.IsEmfOrEmfPlus (), "IsEmfOrEmfPlus");
			Assert.IsFalse (header.IsEmfPlus (), "IsEmfPlus");
			Assert.IsFalse (header.IsEmfPlusDual (), "IsEmfPlusDual");
			Assert.IsFalse (header.IsEmfPlusOnly (), "IsEmfPlusOnly");
			Assert.IsFalse (header.IsWmf (), "IsWmf");
			Assert.IsFalse (header.IsWmfPlaceable (), "IsWmfPlaceable");
		}
Пример #2
0
		public static void Check_MetafileHeader_WmfPlaceable (MetafileHeader header)
		{
			Assert.AreEqual (MetafileType.WmfPlaceable, header.Type, "Type");
			Assert.AreEqual (0x300, header.Version, "Version");
			// filesize - 22, which happens to be the size (22) of a PLACEABLEMETAHEADER struct
			Assert.AreEqual (3474, header.MetafileSize, "MetafileSize");

			Assert.AreEqual (-30, header.Bounds.X, "Bounds.X");
			Assert.AreEqual (-40, header.Bounds.Y, "Bounds.Y");
			Assert.AreEqual (3096, header.Bounds.Width, "Bounds.Width");
			Assert.AreEqual (4127, header.Bounds.Height, "Bounds.Height");
			Assert.AreEqual (606, header.DpiX, "DpiX");
			Assert.AreEqual (606, header.DpiY, "DpiY");
			Assert.AreEqual (0, header.EmfPlusHeaderSize, "EmfPlusHeaderSize");
			Assert.AreEqual (0, header.LogicalDpiX, "LogicalDpiX");
			Assert.AreEqual (0, header.LogicalDpiY, "LogicalDpiY");

			Assert.IsNotNull (header.WmfHeader, "WmfHeader");
			Check_MetaHeader_WmfPlaceable (header.WmfHeader);

			Assert.IsFalse (header.IsDisplay (), "IsDisplay");
			Assert.IsFalse (header.IsEmf (), "IsEmf");
			Assert.IsFalse (header.IsEmfOrEmfPlus (), "IsEmfOrEmfPlus");
			Assert.IsFalse (header.IsEmfPlus (), "IsEmfPlus");
			Assert.IsFalse (header.IsEmfPlusDual (), "IsEmfPlusDual");
			Assert.IsFalse (header.IsEmfPlusOnly (), "IsEmfPlusOnly");
			Assert.IsTrue (header.IsWmf (), "IsWmf");
			Assert.IsTrue (header.IsWmfPlaceable (), "IsWmfPlaceable");
		}