ControlStyleTest.cs 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183
  1. //
  2. // ControlStyleTest.cs (Auto-generated by GenerateControlStyleTest.cs).
  3. //
  4. // Author:
  5. // Peter Dennis Bartok ([email protected])
  6. //
  7. // (C) 2005 Novell, Inc. (http://www.novell.com)
  8. //
  9. using System;
  10. using System.Windows.Forms;
  11. using System.Drawing;
  12. using System.Reflection;
  13. using NUnit.Framework;
  14. namespace MonoTests.System.Windows.Forms {
  15. [TestFixture]
  16. public class TestControlStyle {
  17. static Array style_values = Enum.GetValues(typeof(ControlStyles));
  18. static string[] style_names = Enum.GetNames(typeof(ControlStyles));
  19. public void AssertAreEqual(string[] want, string[] got, string name) {
  20. if (want.Length == got.Length) {
  21. for (int i=0; i < want.Length; i++) {
  22. if (want[i] != got[i]) {
  23. Console.WriteLine("{0}: Expected {1}, got {2}", name, want[i], got[i]);
  24. }
  25. }
  26. }
  27. Assert.AreEqual(want, got, name);
  28. }
  29. public static void CheckStyles (Control ctrl, string msg, params ControlStyles [] ExpectedStyles)
  30. {
  31. MethodInfo method = ctrl.GetType ().GetMethod ("GetStyle", BindingFlags.ExactBinding | BindingFlags.NonPublic | BindingFlags.Instance, null, new Type [] {typeof(ControlStyles)}, null);
  32. Assert.IsNotNull (method, "Cannot complete test, didn't find GetStyle method on Control");
  33. string failed = "";
  34. if (ExpectedStyles == null)
  35. ExpectedStyles = new ControlStyles [0];
  36. foreach (ControlStyles style in Enum.GetValues (typeof(ControlStyles))) {
  37. bool result = (bool) method.Invoke (ctrl, new object [] {style});
  38. if (Array.IndexOf (ExpectedStyles, style) >= 0) {
  39. if (!result)
  40. failed += "\t" + "ControlStyles." + style.ToString () + " was expected, but is not set." + Environment.NewLine;
  41. } else {
  42. if (result)
  43. failed += "\t" + "ControlStyles." + style.ToString () + " is set, but was not expected." + Environment.NewLine;
  44. }
  45. }
  46. if (failed != String.Empty) {
  47. Assert.Fail (msg + Environment.NewLine + failed);
  48. }
  49. }
  50. public static string[] GetStyles(Control control) {
  51. string[] result;
  52. result = new string[style_names.Length];
  53. for (int i = 0; i < style_values.Length; i++) {
  54. result[i] = style_names[i] + "=" + control.GetType().GetMethod("GetStyle", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(control, new object[1] {(ControlStyles)style_values.GetValue(i)});
  55. }
  56. return result;
  57. }
  58. [Test]
  59. public void ControlStyleTest ()
  60. {
  61. string[] Control_want = {
  62. "ContainerControl=False",
  63. "UserPaint=True",
  64. "Opaque=False",
  65. "ResizeRedraw=False",
  66. "FixedWidth=False",
  67. "FixedHeight=False",
  68. "StandardClick=True",
  69. "Selectable=True",
  70. "UserMouse=False",
  71. "SupportsTransparentBackColor=False",
  72. "StandardDoubleClick=True",
  73. "AllPaintingInWmPaint=True",
  74. "CacheText=False",
  75. "EnableNotifyMessage=False",
  76. "DoubleBuffer=False",
  77. #if NET_2_0
  78. "OptimizedDoubleBuffer=False",
  79. "UseTextForAccessibility=True"
  80. #endif
  81. };
  82. Assert.AreEqual(Control_want, GetStyles(new Control()), "ControlStyles");
  83. }
  84. [Test]
  85. public void ButtonStyleTest ()
  86. {
  87. string[] Button_want = {
  88. "ContainerControl=False",
  89. "UserPaint=True",
  90. "Opaque=True",
  91. "ResizeRedraw=True",
  92. "FixedWidth=False",
  93. "FixedHeight=False",
  94. "StandardClick=False",
  95. "Selectable=True",
  96. "UserMouse=True",
  97. "SupportsTransparentBackColor=True",
  98. "StandardDoubleClick=False",
  99. "AllPaintingInWmPaint=True",
  100. "CacheText=True",
  101. "EnableNotifyMessage=False",
  102. #if NET_2_0
  103. "DoubleBuffer=False",
  104. "OptimizedDoubleBuffer=True",
  105. "UseTextForAccessibility=True"
  106. #else
  107. "DoubleBuffer=True"
  108. #endif
  109. };
  110. Assert.AreEqual(Button_want, GetStyles(new Button()), "ButtonStyles");
  111. }
  112. [Test]
  113. public void CheckBoxStyleTest ()
  114. {
  115. string[] CheckBox_want = {
  116. "ContainerControl=False",
  117. "UserPaint=True",
  118. "Opaque=True",
  119. "ResizeRedraw=True",
  120. "FixedWidth=False",
  121. "FixedHeight=False",
  122. "StandardClick=False",
  123. "Selectable=True",
  124. "UserMouse=True",
  125. "SupportsTransparentBackColor=True",
  126. "StandardDoubleClick=False",
  127. "AllPaintingInWmPaint=True",
  128. "CacheText=True",
  129. "EnableNotifyMessage=False",
  130. #if NET_2_0
  131. "DoubleBuffer=False",
  132. "OptimizedDoubleBuffer=True",
  133. "UseTextForAccessibility=True"
  134. #else
  135. "DoubleBuffer=True"
  136. #endif
  137. };
  138. Assert.AreEqual(CheckBox_want, GetStyles(new CheckBox()), "CheckBoxStyles");
  139. }
  140. [Test]
  141. public void RadioButtonStyleTest ()
  142. {
  143. string[] RadioButton_want = {
  144. "ContainerControl=False",
  145. "UserPaint=True",
  146. "Opaque=True",
  147. "ResizeRedraw=True",
  148. "FixedWidth=False",
  149. "FixedHeight=False",
  150. "StandardClick=False",
  151. "Selectable=True",
  152. "UserMouse=True",
  153. "SupportsTransparentBackColor=True",
  154. "StandardDoubleClick=True",
  155. "AllPaintingInWmPaint=True",
  156. "CacheText=True",
  157. "EnableNotifyMessage=False",
  158. #if NET_2_0
  159. "DoubleBuffer=False",
  160. "OptimizedDoubleBuffer=True",
  161. "UseTextForAccessibility=True"
  162. #else
  163. "DoubleBuffer=True"
  164. #endif
  165. };
  166. Assert.AreEqual(RadioButton_want, GetStyles(new RadioButton()), "RadioButtonStyles");
  167. }
  168. [Test]
  169. public void DataGridStyleTest ()
  170. {
  171. string[] DataGrid_want = {
  172. "ContainerControl=False",
  173. "UserPaint=True",
  174. "Opaque=False",
  175. "ResizeRedraw=False",
  176. "FixedWidth=False",
  177. "FixedHeight=False",
  178. "StandardClick=True",
  179. "Selectable=True",
  180. "UserMouse=True",
  181. "SupportsTransparentBackColor=False",
  182. "StandardDoubleClick=True",
  183. "AllPaintingInWmPaint=True",
  184. "CacheText=False",
  185. "EnableNotifyMessage=False",
  186. "DoubleBuffer=False",
  187. #if NET_2_0
  188. "OptimizedDoubleBuffer=False",
  189. "UseTextForAccessibility=True"
  190. #endif
  191. };
  192. Assert.AreEqual(DataGrid_want, GetStyles(new DataGrid()), "DataGridStyles");
  193. }
  194. [Test]
  195. public void DateTimePickerStyleTest ()
  196. {
  197. string[] DateTimePicker_want = {
  198. "ContainerControl=False",
  199. "UserPaint=False",
  200. "Opaque=False",
  201. "ResizeRedraw=False",
  202. "FixedWidth=False",
  203. "FixedHeight=True",
  204. "StandardClick=False",
  205. "Selectable=True",
  206. "UserMouse=False",
  207. "SupportsTransparentBackColor=False",
  208. "StandardDoubleClick=True",
  209. "AllPaintingInWmPaint=True",
  210. "CacheText=False",
  211. "EnableNotifyMessage=False",
  212. "DoubleBuffer=False",
  213. #if NET_2_0
  214. "OptimizedDoubleBuffer=False",
  215. "UseTextForAccessibility=True"
  216. #endif
  217. };
  218. Assert.AreEqual(DateTimePicker_want, GetStyles(new DateTimePicker()), "DateTimePickerStyles");
  219. }
  220. [Test]
  221. public void GroupBoxStyleTest ()
  222. {
  223. string[] GroupBox_want = {
  224. "ContainerControl=True",
  225. "UserPaint=True",
  226. "Opaque=False",
  227. "ResizeRedraw=True",
  228. "FixedWidth=False",
  229. "FixedHeight=False",
  230. "StandardClick=True",
  231. "Selectable=False",
  232. "UserMouse=False",
  233. "SupportsTransparentBackColor=True",
  234. "StandardDoubleClick=True",
  235. "AllPaintingInWmPaint=True",
  236. "CacheText=False",
  237. "EnableNotifyMessage=False",
  238. "DoubleBuffer=False",
  239. #if NET_2_0
  240. "OptimizedDoubleBuffer=False",
  241. "UseTextForAccessibility=True"
  242. #endif
  243. };
  244. Assert.AreEqual(GroupBox_want, GetStyles(new GroupBox()), "GroupBoxStyles");
  245. }
  246. [Test]
  247. public void LabelStyleTest ()
  248. {
  249. string[] Label_want = {
  250. "ContainerControl=False",
  251. "UserPaint=True",
  252. "Opaque=False",
  253. "ResizeRedraw=True",
  254. "FixedWidth=False",
  255. "FixedHeight=False",
  256. "StandardClick=True",
  257. "Selectable=False",
  258. "UserMouse=False",
  259. "SupportsTransparentBackColor=True",
  260. "StandardDoubleClick=True",
  261. "AllPaintingInWmPaint=True",
  262. "CacheText=False",
  263. "EnableNotifyMessage=False",
  264. #if NET_2_0
  265. "DoubleBuffer=False",
  266. "OptimizedDoubleBuffer=True",
  267. "UseTextForAccessibility=True"
  268. #else
  269. "DoubleBuffer=True"
  270. #endif
  271. };
  272. Assert.AreEqual(Label_want, GetStyles(new Label()), "LabelStyles");
  273. }
  274. [Test]
  275. public void LinkLabelStyleTest ()
  276. {
  277. string[] LinkLabel_want = {
  278. "ContainerControl=False",
  279. "UserPaint=True",
  280. "Opaque=True",
  281. "ResizeRedraw=True",
  282. "FixedWidth=False",
  283. "FixedHeight=False",
  284. "StandardClick=True",
  285. "Selectable=False",
  286. "UserMouse=False",
  287. "SupportsTransparentBackColor=True",
  288. "StandardDoubleClick=True",
  289. "AllPaintingInWmPaint=True",
  290. "CacheText=False",
  291. "EnableNotifyMessage=False",
  292. #if NET_2_0
  293. "DoubleBuffer=False",
  294. "OptimizedDoubleBuffer=True",
  295. "UseTextForAccessibility=True"
  296. #else
  297. "DoubleBuffer=True"
  298. #endif
  299. };
  300. string[] LinkLabel_link_want = {
  301. "ContainerControl=False",
  302. "UserPaint=True",
  303. "Opaque=True",
  304. "ResizeRedraw=True",
  305. "FixedWidth=False",
  306. "FixedHeight=False",
  307. "StandardClick=True",
  308. "Selectable=True",
  309. "UserMouse=False",
  310. "SupportsTransparentBackColor=True",
  311. "StandardDoubleClick=True",
  312. "AllPaintingInWmPaint=True",
  313. "CacheText=False",
  314. "EnableNotifyMessage=False",
  315. #if NET_2_0
  316. "DoubleBuffer=False",
  317. "OptimizedDoubleBuffer=True",
  318. "UseTextForAccessibility=True"
  319. #else
  320. "DoubleBuffer=True"
  321. #endif
  322. };
  323. LinkLabel link = new LinkLabel ();
  324. // Test LinkLabel without text and without links
  325. Assert.AreEqual(LinkLabel_want, GetStyles(link), "#1");
  326. // Test LinkLabel with only text
  327. link.Text = "Users need not fear making the switch to Linux";
  328. link.Links.Clear ();
  329. Assert.AreEqual (LinkLabel_want, GetStyles (link), "#2");
  330. // Test LinkLabel with a link
  331. link.Links.Add (6, 9, "http://link1");
  332. Assert.AreEqual(LinkLabel_link_want, GetStyles(link), "#3");
  333. }
  334. [Test]
  335. public void ComboBoxStyleTest ()
  336. {
  337. string[] ComboBox_want = {
  338. "ContainerControl=False",
  339. "UserPaint=False",
  340. "Opaque=False",
  341. "ResizeRedraw=False",
  342. "FixedWidth=False",
  343. "FixedHeight=False",
  344. "StandardClick=False",
  345. "Selectable=True",
  346. "UserMouse=False",
  347. "SupportsTransparentBackColor=False",
  348. "StandardDoubleClick=True",
  349. "AllPaintingInWmPaint=True",
  350. "CacheText=False",
  351. "EnableNotifyMessage=False",
  352. "DoubleBuffer=False",
  353. #if NET_2_0
  354. "OptimizedDoubleBuffer=False",
  355. "UseTextForAccessibility=False"
  356. #endif
  357. };
  358. Assert.AreEqual(ComboBox_want, GetStyles(new ComboBox()), "ComboBoxStyles");
  359. }
  360. [Test]
  361. public void ListBoxStyleTest ()
  362. {
  363. string[] ListBox_want = {
  364. "ContainerControl=False",
  365. "UserPaint=False",
  366. "Opaque=False",
  367. "ResizeRedraw=False",
  368. "FixedWidth=False",
  369. "FixedHeight=False",
  370. "StandardClick=False",
  371. "Selectable=True",
  372. "UserMouse=False",
  373. "SupportsTransparentBackColor=False",
  374. "StandardDoubleClick=True",
  375. "AllPaintingInWmPaint=True",
  376. "CacheText=False",
  377. "EnableNotifyMessage=False",
  378. "DoubleBuffer=False",
  379. #if NET_2_0
  380. "OptimizedDoubleBuffer=False",
  381. "UseTextForAccessibility=False"
  382. #endif
  383. };
  384. Assert.AreEqual(ListBox_want, GetStyles(new ListBox()), "ListBoxStyles");
  385. }
  386. [Test]
  387. public void CheckedListBoxStyleTest ()
  388. {
  389. string[] CheckedListBox_want = {
  390. "ContainerControl=False",
  391. "UserPaint=False",
  392. "Opaque=False",
  393. "ResizeRedraw=True",
  394. "FixedWidth=False",
  395. "FixedHeight=False",
  396. "StandardClick=False",
  397. "Selectable=True",
  398. "UserMouse=False",
  399. "SupportsTransparentBackColor=False",
  400. "StandardDoubleClick=True",
  401. "AllPaintingInWmPaint=True",
  402. "CacheText=False",
  403. "EnableNotifyMessage=False",
  404. "DoubleBuffer=False",
  405. #if NET_2_0
  406. "OptimizedDoubleBuffer=False",
  407. "UseTextForAccessibility=False"
  408. #endif
  409. };
  410. Assert.AreEqual(CheckedListBox_want, GetStyles(new CheckedListBox()), "CheckedListBoxStyles");
  411. }
  412. [Test]
  413. public void ListViewStyleTest ()
  414. {
  415. string[] ListView_want = {
  416. "ContainerControl=False",
  417. "UserPaint=False",
  418. "Opaque=False",
  419. "ResizeRedraw=False",
  420. "FixedWidth=False",
  421. "FixedHeight=False",
  422. "StandardClick=False",
  423. "Selectable=True",
  424. "UserMouse=False",
  425. "SupportsTransparentBackColor=False",
  426. "StandardDoubleClick=True",
  427. "AllPaintingInWmPaint=True",
  428. "CacheText=False",
  429. "EnableNotifyMessage=False",
  430. "DoubleBuffer=False",
  431. #if NET_2_0
  432. "OptimizedDoubleBuffer=False",
  433. "UseTextForAccessibility=False"
  434. #endif
  435. };
  436. Assert.AreEqual(ListView_want, GetStyles(new ListView()), "ListViewStyles");
  437. }
  438. [Test]
  439. public void MdiClientStyleTest ()
  440. {
  441. string[] MdiClient_want = {
  442. "ContainerControl=False",
  443. "UserPaint=True",
  444. "Opaque=False",
  445. "ResizeRedraw=False",
  446. "FixedWidth=False",
  447. "FixedHeight=False",
  448. "StandardClick=True",
  449. "Selectable=False",
  450. "UserMouse=False",
  451. "SupportsTransparentBackColor=False",
  452. "StandardDoubleClick=True",
  453. "AllPaintingInWmPaint=True",
  454. "CacheText=False",
  455. "EnableNotifyMessage=False",
  456. "DoubleBuffer=False",
  457. #if NET_2_0
  458. "OptimizedDoubleBuffer=False",
  459. "UseTextForAccessibility=True"
  460. #endif
  461. };
  462. Assert.AreEqual(MdiClient_want, GetStyles(new MdiClient()), "MdiClientStyles");
  463. }
  464. [Test]
  465. public void MonthCalendarStyleTest ()
  466. {
  467. string[] MonthCalendar_want = {
  468. "ContainerControl=False",
  469. "UserPaint=False",
  470. "Opaque=False",
  471. "ResizeRedraw=False",
  472. "FixedWidth=False",
  473. "FixedHeight=False",
  474. "StandardClick=False",
  475. "Selectable=True",
  476. "UserMouse=False",
  477. "SupportsTransparentBackColor=False",
  478. "StandardDoubleClick=True",
  479. "AllPaintingInWmPaint=True",
  480. "CacheText=False",
  481. "EnableNotifyMessage=False",
  482. "DoubleBuffer=False",
  483. #if NET_2_0
  484. "OptimizedDoubleBuffer=False",
  485. "UseTextForAccessibility=True"
  486. #endif
  487. };
  488. Assert.AreEqual(MonthCalendar_want, GetStyles(new MonthCalendar()), "MonthCalendarStyles");
  489. }
  490. [Test]
  491. public void PictureBoxStyleTest ()
  492. {
  493. string[] PictureBox_want = {
  494. "ContainerControl=False",
  495. "UserPaint=True",
  496. "Opaque=False",
  497. "ResizeRedraw=False",
  498. "FixedWidth=False",
  499. "FixedHeight=False",
  500. "StandardClick=True",
  501. "Selectable=False",
  502. "UserMouse=False",
  503. "SupportsTransparentBackColor=True",
  504. "StandardDoubleClick=True",
  505. "AllPaintingInWmPaint=True",
  506. "CacheText=False",
  507. "EnableNotifyMessage=False",
  508. #if NET_2_0
  509. "DoubleBuffer=False",
  510. "OptimizedDoubleBuffer=True",
  511. "UseTextForAccessibility=True"
  512. #else
  513. "DoubleBuffer=True"
  514. #endif
  515. };
  516. Assert.AreEqual(PictureBox_want, GetStyles(new PictureBox()), "PictureBoxStyles");
  517. }
  518. [Test]
  519. public void ProgressBarStyleTest ()
  520. {
  521. string[] ProgressBar_want = {
  522. "ContainerControl=False",
  523. "UserPaint=False",
  524. "Opaque=False",
  525. "ResizeRedraw=False",
  526. "FixedWidth=False",
  527. "FixedHeight=False",
  528. "StandardClick=True",
  529. "Selectable=False",
  530. "UserMouse=False",
  531. "SupportsTransparentBackColor=False",
  532. "StandardDoubleClick=True",
  533. "AllPaintingInWmPaint=True",
  534. "CacheText=False",
  535. "EnableNotifyMessage=False",
  536. "DoubleBuffer=False",
  537. #if NET_2_0
  538. "OptimizedDoubleBuffer=False",
  539. "UseTextForAccessibility=False"
  540. #endif
  541. };
  542. Assert.AreEqual(ProgressBar_want, GetStyles(new ProgressBar()), "ProgressBarStyles");
  543. }
  544. [Test]
  545. public void ScrollableControlStyleTest ()
  546. {
  547. string[] ScrollableControl_want = {
  548. "ContainerControl=True",
  549. "UserPaint=True",
  550. "Opaque=False",
  551. "ResizeRedraw=False",
  552. "FixedWidth=False",
  553. "FixedHeight=False",
  554. "StandardClick=True",
  555. "Selectable=True",
  556. "UserMouse=False",
  557. "SupportsTransparentBackColor=False",
  558. "StandardDoubleClick=True",
  559. "AllPaintingInWmPaint=False",
  560. "CacheText=False",
  561. "EnableNotifyMessage=False",
  562. "DoubleBuffer=False",
  563. #if NET_2_0
  564. "OptimizedDoubleBuffer=False",
  565. "UseTextForAccessibility=True"
  566. #endif
  567. };
  568. Assert.AreEqual(ScrollableControl_want, GetStyles(new ScrollableControl()), "ScrollableControlStyles");
  569. }
  570. [Test]
  571. public void ContainerControlStyleTest ()
  572. {
  573. string[] ContainerControl_want = {
  574. "ContainerControl=True",
  575. "UserPaint=True",
  576. "Opaque=False",
  577. "ResizeRedraw=False",
  578. "FixedWidth=False",
  579. "FixedHeight=False",
  580. "StandardClick=True",
  581. "Selectable=True",
  582. "UserMouse=False",
  583. "SupportsTransparentBackColor=False",
  584. "StandardDoubleClick=True",
  585. "AllPaintingInWmPaint=False",
  586. "CacheText=False",
  587. "EnableNotifyMessage=False",
  588. "DoubleBuffer=False",
  589. #if NET_2_0
  590. "OptimizedDoubleBuffer=False",
  591. "UseTextForAccessibility=True"
  592. #endif
  593. };
  594. Assert.AreEqual(ContainerControl_want, GetStyles(new ContainerControl()), "ContainerControlStyles");
  595. }
  596. [Test]
  597. public void FormStyleTest ()
  598. {
  599. string[] Form_want = {
  600. "ContainerControl=True",
  601. "UserPaint=True",
  602. "Opaque=False",
  603. "ResizeRedraw=False",
  604. "FixedWidth=False",
  605. "FixedHeight=False",
  606. "StandardClick=True",
  607. "Selectable=True",
  608. "UserMouse=False",
  609. "SupportsTransparentBackColor=False",
  610. "StandardDoubleClick=True",
  611. "AllPaintingInWmPaint=False",
  612. "CacheText=False",
  613. "EnableNotifyMessage=False",
  614. "DoubleBuffer=False",
  615. #if NET_2_0
  616. "OptimizedDoubleBuffer=False",
  617. "UseTextForAccessibility=True"
  618. #endif
  619. };
  620. Form f = new Form ();
  621. f.ShowInTaskbar = false;
  622. Assert.AreEqual(Form_want, GetStyles(f), "FormStyles");
  623. f.Dispose ();
  624. }
  625. [Test]
  626. public void PropertyGridStyleTest ()
  627. {
  628. string[] PropertyGrid_want = {
  629. "ContainerControl=True",
  630. "UserPaint=True",
  631. "Opaque=False",
  632. "ResizeRedraw=False",
  633. "FixedWidth=False",
  634. "FixedHeight=False",
  635. "StandardClick=True",
  636. "Selectable=True",
  637. "UserMouse=False",
  638. "SupportsTransparentBackColor=False",
  639. "StandardDoubleClick=True",
  640. "AllPaintingInWmPaint=False",
  641. "CacheText=False",
  642. "EnableNotifyMessage=False",
  643. "DoubleBuffer=False",
  644. #if NET_2_0
  645. "OptimizedDoubleBuffer=False",
  646. "UseTextForAccessibility=True"
  647. #endif
  648. };
  649. Assert.AreEqual(PropertyGrid_want, GetStyles(new PropertyGrid()), "PropertyGridStyles");
  650. }
  651. [Test]
  652. public void DomainUpDownStyleTest ()
  653. {
  654. string[] DomainUpDown_want = {
  655. "ContainerControl=True",
  656. "UserPaint=True",
  657. #if NET_2_0
  658. "Opaque=True",
  659. "ResizeRedraw=True",
  660. #else
  661. "Opaque=False",
  662. "ResizeRedraw=False",
  663. #endif
  664. "FixedWidth=False",
  665. "FixedHeight=True",
  666. #if NET_2_0
  667. "StandardClick=False",
  668. #else
  669. "StandardClick=True",
  670. #endif
  671. "Selectable=True",
  672. "UserMouse=False",
  673. "SupportsTransparentBackColor=False",
  674. "StandardDoubleClick=True",
  675. "AllPaintingInWmPaint=False",
  676. "CacheText=False",
  677. "EnableNotifyMessage=False",
  678. "DoubleBuffer=False",
  679. #if NET_2_0
  680. "OptimizedDoubleBuffer=False",
  681. "UseTextForAccessibility=False"
  682. #endif
  683. };
  684. Assert.AreEqual(DomainUpDown_want, GetStyles(new DomainUpDown()), "DomainUpDownStyles");
  685. }
  686. [Test]
  687. public void NumericUpDownStyleTest ()
  688. {
  689. string[] NumericUpDown_want = {
  690. "ContainerControl=True",
  691. "UserPaint=True",
  692. #if NET_2_0
  693. "Opaque=True",
  694. "ResizeRedraw=True",
  695. #else
  696. "Opaque=False",
  697. "ResizeRedraw=False",
  698. #endif
  699. "FixedWidth=False",
  700. "FixedHeight=True",
  701. #if NET_2_0
  702. "StandardClick=False",
  703. #else
  704. "StandardClick=True",
  705. #endif
  706. "Selectable=True",
  707. "UserMouse=False",
  708. "SupportsTransparentBackColor=False",
  709. "StandardDoubleClick=True",
  710. "AllPaintingInWmPaint=False",
  711. "CacheText=False",
  712. "EnableNotifyMessage=False",
  713. "DoubleBuffer=False",
  714. #if NET_2_0
  715. "OptimizedDoubleBuffer=False",
  716. "UseTextForAccessibility=False"
  717. #endif
  718. };
  719. Assert.AreEqual(NumericUpDown_want, GetStyles(new NumericUpDown()), "NumericUpDownStyles");
  720. }
  721. [Test]
  722. public void UserControlStyleTest ()
  723. {
  724. string[] UserControl_want = {
  725. "ContainerControl=True",
  726. "UserPaint=True",
  727. "Opaque=False",
  728. "ResizeRedraw=False",
  729. "FixedWidth=False",
  730. "FixedHeight=False",
  731. "StandardClick=True",
  732. "Selectable=True",
  733. "UserMouse=False",
  734. #if NET_2_0
  735. "SupportsTransparentBackColor=True",
  736. #else
  737. "SupportsTransparentBackColor=False",
  738. #endif
  739. "StandardDoubleClick=True",
  740. "AllPaintingInWmPaint=False",
  741. "CacheText=False",
  742. "EnableNotifyMessage=False",
  743. "DoubleBuffer=False",
  744. #if NET_2_0
  745. "OptimizedDoubleBuffer=False",
  746. "UseTextForAccessibility=True"
  747. #endif
  748. };
  749. Assert.AreEqual(UserControl_want, GetStyles(new UserControl()), "UserControlStyles");
  750. }
  751. [Test]
  752. public void PanelStyleTest ()
  753. {
  754. string[] Panel_want = {
  755. "ContainerControl=True",
  756. "UserPaint=True",
  757. "Opaque=False",
  758. "ResizeRedraw=False",
  759. "FixedWidth=False",
  760. "FixedHeight=False",
  761. "StandardClick=True",
  762. "Selectable=False",
  763. "UserMouse=False",
  764. "SupportsTransparentBackColor=True",
  765. "StandardDoubleClick=True",
  766. "AllPaintingInWmPaint=False",
  767. "CacheText=False",
  768. "EnableNotifyMessage=False",
  769. "DoubleBuffer=False",
  770. #if NET_2_0
  771. "OptimizedDoubleBuffer=False",
  772. "UseTextForAccessibility=True"
  773. #endif
  774. };
  775. Assert.AreEqual(Panel_want, GetStyles(new Panel()), "PanelStyles");
  776. }
  777. [Test]
  778. public void TabPageStyleTest ()
  779. {
  780. string[] TabPage_want = {
  781. "ContainerControl=True",
  782. "UserPaint=True",
  783. "Opaque=False",
  784. "ResizeRedraw=False",
  785. "FixedWidth=False",
  786. "FixedHeight=False",
  787. "StandardClick=True",
  788. "Selectable=False",
  789. "UserMouse=False",
  790. "SupportsTransparentBackColor=True",
  791. "StandardDoubleClick=True",
  792. "AllPaintingInWmPaint=False",
  793. "CacheText=True",
  794. "EnableNotifyMessage=False",
  795. "DoubleBuffer=False",
  796. #if NET_2_0
  797. "OptimizedDoubleBuffer=False",
  798. "UseTextForAccessibility=True"
  799. #endif
  800. };
  801. Assert.AreEqual(TabPage_want, GetStyles(new TabPage()), "TabPageStyles");
  802. }
  803. [Test]
  804. public void HScrollBarStyleTest ()
  805. {
  806. string[] HScrollBar_want = {
  807. "ContainerControl=False",
  808. "UserPaint=False",
  809. "Opaque=False",
  810. "ResizeRedraw=False",
  811. "FixedWidth=False",
  812. "FixedHeight=False",
  813. "StandardClick=False",
  814. "Selectable=True",
  815. "UserMouse=False",
  816. "SupportsTransparentBackColor=False",
  817. "StandardDoubleClick=True",
  818. "AllPaintingInWmPaint=True",
  819. "CacheText=False",
  820. "EnableNotifyMessage=False",
  821. "DoubleBuffer=False",
  822. #if NET_2_0
  823. "OptimizedDoubleBuffer=False",
  824. "UseTextForAccessibility=False"
  825. #endif
  826. };
  827. Assert.AreEqual(HScrollBar_want, GetStyles(new HScrollBar()), "HScrollBarStyles");
  828. }
  829. [Test]
  830. public void VScrollBarStyleTest ()
  831. {
  832. string[] VScrollBar_want = {
  833. "ContainerControl=False",
  834. "UserPaint=False",
  835. "Opaque=False",
  836. "ResizeRedraw=False",
  837. "FixedWidth=False",
  838. "FixedHeight=False",
  839. "StandardClick=False",
  840. "Selectable=True",
  841. "UserMouse=False",
  842. "SupportsTransparentBackColor=False",
  843. "StandardDoubleClick=True",
  844. "AllPaintingInWmPaint=True",
  845. "CacheText=False",
  846. "EnableNotifyMessage=False",
  847. "DoubleBuffer=False",
  848. #if NET_2_0
  849. "OptimizedDoubleBuffer=False",
  850. "UseTextForAccessibility=False"
  851. #endif
  852. };
  853. Assert.AreEqual(VScrollBar_want, GetStyles(new VScrollBar()), "VScrollBarStyles");
  854. }
  855. [Test]
  856. public void SplitterStyleTest ()
  857. {
  858. string[] Splitter_want = {
  859. "ContainerControl=False",
  860. "UserPaint=True",
  861. "Opaque=False",
  862. "ResizeRedraw=False",
  863. "FixedWidth=False",
  864. "FixedHeight=False",
  865. "StandardClick=True",
  866. "Selectable=False",
  867. "UserMouse=False",
  868. "SupportsTransparentBackColor=False",
  869. "StandardDoubleClick=True",
  870. "AllPaintingInWmPaint=True",
  871. "CacheText=False",
  872. "EnableNotifyMessage=False",
  873. "DoubleBuffer=False",
  874. #if NET_2_0
  875. "OptimizedDoubleBuffer=False",
  876. "UseTextForAccessibility=True"
  877. #endif
  878. };
  879. Assert.AreEqual(Splitter_want, GetStyles(new Splitter()), "SplitterStyles");
  880. }
  881. [Test]
  882. public void StatusBarStyleTest ()
  883. {
  884. string[] StatusBar_want = {
  885. "ContainerControl=False",
  886. "UserPaint=False",
  887. "Opaque=False",
  888. "ResizeRedraw=False",
  889. "FixedWidth=False",
  890. "FixedHeight=False",
  891. "StandardClick=True",
  892. "Selectable=False",
  893. "UserMouse=False",
  894. "SupportsTransparentBackColor=False",
  895. "StandardDoubleClick=True",
  896. "AllPaintingInWmPaint=True",
  897. "CacheText=False",
  898. "EnableNotifyMessage=False",
  899. "DoubleBuffer=False",
  900. #if NET_2_0
  901. "OptimizedDoubleBuffer=False",
  902. "UseTextForAccessibility=True"
  903. #endif
  904. };
  905. Assert.AreEqual(StatusBar_want, GetStyles(new StatusBar()), "StatusBarStyles");
  906. }
  907. [Test]
  908. public void TabControlStyleTest ()
  909. {
  910. string[] TabControl_want = {
  911. "ContainerControl=False",
  912. "UserPaint=False",
  913. "Opaque=False",
  914. "ResizeRedraw=False",
  915. "FixedWidth=False",
  916. "FixedHeight=False",
  917. "StandardClick=True",
  918. "Selectable=True",
  919. "UserMouse=False",
  920. "SupportsTransparentBackColor=False",
  921. "StandardDoubleClick=True",
  922. "AllPaintingInWmPaint=True",
  923. "CacheText=False",
  924. "EnableNotifyMessage=False",
  925. "DoubleBuffer=False",
  926. #if NET_2_0
  927. "OptimizedDoubleBuffer=False",
  928. "UseTextForAccessibility=True"
  929. #endif
  930. };
  931. Assert.AreEqual(TabControl_want, GetStyles(new TabControl()), "TabControlStyles");
  932. }
  933. [Test]
  934. public void RichTextBoxStyleTest ()
  935. {
  936. string[] RichTextBox_want = {
  937. "ContainerControl=False",
  938. "UserPaint=False",
  939. "Opaque=False",
  940. "ResizeRedraw=False",
  941. "FixedWidth=False",
  942. "FixedHeight=False",
  943. "StandardClick=False",
  944. "Selectable=True",
  945. "UserMouse=False",
  946. "SupportsTransparentBackColor=False",
  947. #if NET_2_0
  948. "StandardDoubleClick=False",
  949. #else
  950. "StandardDoubleClick=True",
  951. #endif
  952. "AllPaintingInWmPaint=True",
  953. "CacheText=False",
  954. "EnableNotifyMessage=False",
  955. "DoubleBuffer=False",
  956. #if NET_2_0
  957. "OptimizedDoubleBuffer=False",
  958. "UseTextForAccessibility=False"
  959. #endif
  960. };
  961. Assert.AreEqual(RichTextBox_want, GetStyles(new RichTextBox()), "RichTextBoxStyles");
  962. }
  963. [Test]
  964. public void TextBoxStyleTest ()
  965. {
  966. string[] TextBox_want = {
  967. "ContainerControl=False",
  968. "UserPaint=False",
  969. "Opaque=False",
  970. "ResizeRedraw=False",
  971. "FixedWidth=False",
  972. "FixedHeight=True",
  973. "StandardClick=False",
  974. "Selectable=True",
  975. "UserMouse=False",
  976. "SupportsTransparentBackColor=False",
  977. "StandardDoubleClick=False",
  978. "AllPaintingInWmPaint=True",
  979. "CacheText=False",
  980. "EnableNotifyMessage=False",
  981. "DoubleBuffer=False",
  982. #if NET_2_0
  983. "OptimizedDoubleBuffer=False",
  984. "UseTextForAccessibility=False"
  985. #endif
  986. };
  987. Assert.AreEqual(TextBox_want, GetStyles(new TextBox()), "TextBoxStyles");
  988. }
  989. [Test]
  990. public void DataGridTextBoxStyleTest ()
  991. {
  992. string[] DataGridTextBox_want = {
  993. "ContainerControl=False",
  994. "UserPaint=False",
  995. "Opaque=False",
  996. "ResizeRedraw=False",
  997. "FixedWidth=False",
  998. "FixedHeight=True",
  999. "StandardClick=False",
  1000. "Selectable=True",
  1001. "UserMouse=False",
  1002. "SupportsTransparentBackColor=False",
  1003. "StandardDoubleClick=False",
  1004. "AllPaintingInWmPaint=True",
  1005. "CacheText=False",
  1006. "EnableNotifyMessage=False",
  1007. "DoubleBuffer=False",
  1008. #if NET_2_0
  1009. "OptimizedDoubleBuffer=False",
  1010. "UseTextForAccessibility=False"
  1011. #endif
  1012. };
  1013. Assert.AreEqual(DataGridTextBox_want, GetStyles(new DataGridTextBox()), "DataGridTextBoxStyles");
  1014. }
  1015. [Test]
  1016. public void ToolBarStyleTest ()
  1017. {
  1018. string[] ToolBar_want = {
  1019. "ContainerControl=False",
  1020. "UserPaint=False",
  1021. "Opaque=False",
  1022. "ResizeRedraw=False",
  1023. "FixedWidth=False",
  1024. "FixedHeight=True",
  1025. "StandardClick=True",
  1026. "Selectable=True",
  1027. "UserMouse=False",
  1028. "SupportsTransparentBackColor=False",
  1029. "StandardDoubleClick=True",
  1030. "AllPaintingInWmPaint=True",
  1031. "CacheText=False",
  1032. "EnableNotifyMessage=False",
  1033. "DoubleBuffer=False",
  1034. #if NET_2_0
  1035. "OptimizedDoubleBuffer=False",
  1036. "UseTextForAccessibility=True"
  1037. #endif
  1038. };
  1039. Assert.AreEqual(ToolBar_want, GetStyles(new ToolBar()), "ToolBarStyles");
  1040. }
  1041. [Test]
  1042. public void TrackBarStyleTest ()
  1043. {
  1044. string[] TrackBar_want = {
  1045. "ContainerControl=False",
  1046. "UserPaint=False",
  1047. "Opaque=False",
  1048. "ResizeRedraw=False",
  1049. "FixedWidth=False",
  1050. "FixedHeight=False",
  1051. "StandardClick=True",
  1052. "Selectable=True",
  1053. "UserMouse=False",
  1054. "SupportsTransparentBackColor=False",
  1055. "StandardDoubleClick=True",
  1056. "AllPaintingInWmPaint=True",
  1057. "CacheText=False",
  1058. "EnableNotifyMessage=False",
  1059. "DoubleBuffer=False",
  1060. #if NET_2_0
  1061. "OptimizedDoubleBuffer=False",
  1062. "UseTextForAccessibility=False"
  1063. #endif
  1064. };
  1065. Assert.AreEqual(TrackBar_want, GetStyles(new TrackBar()), "TrackBarStyles");
  1066. }
  1067. [Test]
  1068. public void TreeViewStyleTest ()
  1069. {
  1070. string[] TreeView_want = {
  1071. "ContainerControl=False",
  1072. "UserPaint=False",
  1073. "Opaque=False",
  1074. "ResizeRedraw=False",
  1075. "FixedWidth=False",
  1076. "FixedHeight=False",
  1077. "StandardClick=False",
  1078. "Selectable=True",
  1079. "UserMouse=False",
  1080. "SupportsTransparentBackColor=False",
  1081. "StandardDoubleClick=True",
  1082. "AllPaintingInWmPaint=True",
  1083. "CacheText=False",
  1084. "EnableNotifyMessage=False",
  1085. "DoubleBuffer=False",
  1086. #if NET_2_0
  1087. "OptimizedDoubleBuffer=False",
  1088. "UseTextForAccessibility=False"
  1089. #endif
  1090. };
  1091. Assert.AreEqual(TreeView_want, GetStyles(new TreeView()), "TreeViewStyles");
  1092. }
  1093. }
  1094. }