2 // Copyright (C) 2009 Novell, Inc (http://www.novell.com)
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 // Andy Hume <andyhume32@yahoo.co.uk>
27 using NUnit.Framework;
30 using System.Drawing.Printing;
32 namespace MonoTests.System.Drawing.Printing
35 public class PaperSourceTest
39 public void KindTest ()
41 PaperSource ps = new PaperSource ();
45 ps.RawKind = (int)PaperSourceKind.Custom;
46 Assert.AreEqual (PaperSourceKind.Custom, ps.Kind, "Kind #8");
47 Assert.AreEqual (257, ps.RawKind, "RawKind #8");
50 // An integer value of 256 and above returns Custom (0x257)
52 Assert.AreEqual (256, ps.RawKind, "out: #" + 256);
53 Assert.AreEqual (PaperSourceKind.Custom, ps.Kind, "kind is custom: #" + 256);
58 Assert.AreEqual ((PaperSourceKind)0, ps.Kind, "Kind #1");
59 Assert.AreEqual (0, ps.RawKind, "RawKind #1");
63 ps.RawKind = (int)PaperSourceKind.Upper;
64 Assert.AreEqual (PaperSourceKind.Upper, ps.Kind, "Kind #2");
65 Assert.AreEqual ((int)PaperSourceKind.Upper, ps.RawKind, "RawKind #2");
68 ps.RawKind = (int)PaperSourceKind.FormSource;
69 Assert.AreEqual (PaperSourceKind.FormSource, ps.Kind, "Kind #3");
70 Assert.AreEqual ((int)PaperSourceKind.FormSource, ps.RawKind, "RawKind #3");
75 Assert.AreEqual (PaperSourceKind.Custom, ps.Kind, "Kind #4");
76 Assert.AreEqual (999999, ps.RawKind, "RawKind #4");
79 ps.RawKind = int.MaxValue;
80 Assert.AreEqual (PaperSourceKind.Custom, ps.Kind, "Kind #5");
81 Assert.AreEqual (int.MaxValue, ps.RawKind, "RawKind #5");
84 // Negative -- Looks as if MSFT forgot to check for negative!
86 Assert.AreEqual ((PaperSourceKind)(-1), ps.Kind, "Kind #6");
87 Assert.AreEqual (-1, ps.RawKind, "RawKind #6");
90 ps.RawKind = int.MinValue;
91 Assert.AreEqual ((PaperSourceKind)(int.MinValue), ps.Kind, "Kind #7");
92 Assert.AreEqual (int.MinValue, ps.RawKind, "RawKind #7");