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
38 public void KindTest ()
40 PaperSource ps = new PaperSource ();
44 ps.RawKind = (int)PaperSourceKind.Custom;
45 Assert.AreEqual (PaperSourceKind.Custom, ps.Kind, "Kind #8");
46 Assert.AreEqual (257, ps.RawKind, "RawKind #8");
49 // An integer value of 256 and above returns Custom (0x257)
51 Assert.AreEqual (256, ps.RawKind, "out: #" + 256);
52 Assert.AreEqual (PaperSourceKind.Custom, ps.Kind, "kind is custom: #" + 256);
57 Assert.AreEqual ((PaperSourceKind)0, ps.Kind, "Kind #1");
58 Assert.AreEqual (0, ps.RawKind, "RawKind #1");
62 ps.RawKind = (int)PaperSourceKind.Upper;
63 Assert.AreEqual (PaperSourceKind.Upper, ps.Kind, "Kind #2");
64 Assert.AreEqual ((int)PaperSourceKind.Upper, ps.RawKind, "RawKind #2");
67 ps.RawKind = (int)PaperSourceKind.FormSource;
68 Assert.AreEqual (PaperSourceKind.FormSource, ps.Kind, "Kind #3");
69 Assert.AreEqual ((int)PaperSourceKind.FormSource, ps.RawKind, "RawKind #3");
74 Assert.AreEqual (PaperSourceKind.Custom, ps.Kind, "Kind #4");
75 Assert.AreEqual (999999, ps.RawKind, "RawKind #4");
78 ps.RawKind = int.MaxValue;
79 Assert.AreEqual (PaperSourceKind.Custom, ps.Kind, "Kind #5");
80 Assert.AreEqual (int.MaxValue, ps.RawKind, "RawKind #5");
83 // Negative -- Looks as if MSFT forgot to check for negative!
85 Assert.AreEqual ((PaperSourceKind)(-1), ps.Kind, "Kind #6");
86 Assert.AreEqual (-1, ps.RawKind, "RawKind #6");
89 ps.RawKind = int.MinValue;
90 Assert.AreEqual ((PaperSourceKind)(int.MinValue), ps.Kind, "Kind #7");
91 Assert.AreEqual (int.MinValue, ps.RawKind, "RawKind #7");