ControlStyleTest.cs 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178
  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. Assert.AreEqual(LinkLabel_want, GetStyles(new LinkLabel()), "LinkLabelStyles");
  324. // Test LinkLabel with a link
  325. LinkLabel link = new LinkLabel();
  326. link.Text = "Users need not fear making the switch to Linux";
  327. link.Links.Add (6,9, "http://link1");
  328. Assert.AreEqual(LinkLabel_link_want, GetStyles(link), "LinkLabelStyles2");
  329. }
  330. [Test]
  331. public void ComboBoxStyleTest ()
  332. {
  333. string[] ComboBox_want = {
  334. "ContainerControl=False",
  335. "UserPaint=False",
  336. "Opaque=False",
  337. "ResizeRedraw=False",
  338. "FixedWidth=False",
  339. "FixedHeight=False",
  340. "StandardClick=False",
  341. "Selectable=True",
  342. "UserMouse=False",
  343. "SupportsTransparentBackColor=False",
  344. "StandardDoubleClick=True",
  345. "AllPaintingInWmPaint=True",
  346. "CacheText=False",
  347. "EnableNotifyMessage=False",
  348. "DoubleBuffer=False",
  349. #if NET_2_0
  350. "OptimizedDoubleBuffer=False",
  351. "UseTextForAccessibility=False"
  352. #endif
  353. };
  354. Assert.AreEqual(ComboBox_want, GetStyles(new ComboBox()), "ComboBoxStyles");
  355. }
  356. [Test]
  357. public void ListBoxStyleTest ()
  358. {
  359. string[] ListBox_want = {
  360. "ContainerControl=False",
  361. "UserPaint=False",
  362. "Opaque=False",
  363. "ResizeRedraw=False",
  364. "FixedWidth=False",
  365. "FixedHeight=False",
  366. "StandardClick=False",
  367. "Selectable=True",
  368. "UserMouse=False",
  369. "SupportsTransparentBackColor=False",
  370. "StandardDoubleClick=True",
  371. "AllPaintingInWmPaint=True",
  372. "CacheText=False",
  373. "EnableNotifyMessage=False",
  374. "DoubleBuffer=False",
  375. #if NET_2_0
  376. "OptimizedDoubleBuffer=False",
  377. "UseTextForAccessibility=False"
  378. #endif
  379. };
  380. Assert.AreEqual(ListBox_want, GetStyles(new ListBox()), "ListBoxStyles");
  381. }
  382. [Test]
  383. public void CheckedListBoxStyleTest ()
  384. {
  385. string[] CheckedListBox_want = {
  386. "ContainerControl=False",
  387. "UserPaint=False",
  388. "Opaque=False",
  389. "ResizeRedraw=True",
  390. "FixedWidth=False",
  391. "FixedHeight=False",
  392. "StandardClick=False",
  393. "Selectable=True",
  394. "UserMouse=False",
  395. "SupportsTransparentBackColor=False",
  396. "StandardDoubleClick=True",
  397. "AllPaintingInWmPaint=True",
  398. "CacheText=False",
  399. "EnableNotifyMessage=False",
  400. "DoubleBuffer=False",
  401. #if NET_2_0
  402. "OptimizedDoubleBuffer=False",
  403. "UseTextForAccessibility=False"
  404. #endif
  405. };
  406. Assert.AreEqual(CheckedListBox_want, GetStyles(new CheckedListBox()), "CheckedListBoxStyles");
  407. }
  408. [Test]
  409. public void ListViewStyleTest ()
  410. {
  411. string[] ListView_want = {
  412. "ContainerControl=False",
  413. "UserPaint=False",
  414. "Opaque=False",
  415. "ResizeRedraw=False",
  416. "FixedWidth=False",
  417. "FixedHeight=False",
  418. "StandardClick=False",
  419. "Selectable=True",
  420. "UserMouse=False",
  421. "SupportsTransparentBackColor=False",
  422. "StandardDoubleClick=True",
  423. "AllPaintingInWmPaint=True",
  424. "CacheText=False",
  425. "EnableNotifyMessage=False",
  426. "DoubleBuffer=False",
  427. #if NET_2_0
  428. "OptimizedDoubleBuffer=False",
  429. "UseTextForAccessibility=False"
  430. #endif
  431. };
  432. Assert.AreEqual(ListView_want, GetStyles(new ListView()), "ListViewStyles");
  433. }
  434. [Test]
  435. public void MdiClientStyleTest ()
  436. {
  437. string[] MdiClient_want = {
  438. "ContainerControl=False",
  439. "UserPaint=True",
  440. "Opaque=False",
  441. "ResizeRedraw=False",
  442. "FixedWidth=False",
  443. "FixedHeight=False",
  444. "StandardClick=True",
  445. "Selectable=False",
  446. "UserMouse=False",
  447. "SupportsTransparentBackColor=False",
  448. "StandardDoubleClick=True",
  449. "AllPaintingInWmPaint=True",
  450. "CacheText=False",
  451. "EnableNotifyMessage=False",
  452. "DoubleBuffer=False",
  453. #if NET_2_0
  454. "OptimizedDoubleBuffer=False",
  455. "UseTextForAccessibility=True"
  456. #endif
  457. };
  458. Assert.AreEqual(MdiClient_want, GetStyles(new MdiClient()), "MdiClientStyles");
  459. }
  460. [Test]
  461. public void MonthCalendarStyleTest ()
  462. {
  463. string[] MonthCalendar_want = {
  464. "ContainerControl=False",
  465. "UserPaint=False",
  466. "Opaque=False",
  467. "ResizeRedraw=False",
  468. "FixedWidth=False",
  469. "FixedHeight=False",
  470. "StandardClick=False",
  471. "Selectable=True",
  472. "UserMouse=False",
  473. "SupportsTransparentBackColor=False",
  474. "StandardDoubleClick=True",
  475. "AllPaintingInWmPaint=True",
  476. "CacheText=False",
  477. "EnableNotifyMessage=False",
  478. "DoubleBuffer=False",
  479. #if NET_2_0
  480. "OptimizedDoubleBuffer=False",
  481. "UseTextForAccessibility=True"
  482. #endif
  483. };
  484. Assert.AreEqual(MonthCalendar_want, GetStyles(new MonthCalendar()), "MonthCalendarStyles");
  485. }
  486. [Test]
  487. public void PictureBoxStyleTest ()
  488. {
  489. string[] PictureBox_want = {
  490. "ContainerControl=False",
  491. "UserPaint=True",
  492. "Opaque=False",
  493. "ResizeRedraw=False",
  494. "FixedWidth=False",
  495. "FixedHeight=False",
  496. "StandardClick=True",
  497. "Selectable=False",
  498. "UserMouse=False",
  499. "SupportsTransparentBackColor=True",
  500. "StandardDoubleClick=True",
  501. "AllPaintingInWmPaint=True",
  502. "CacheText=False",
  503. "EnableNotifyMessage=False",
  504. #if NET_2_0
  505. "DoubleBuffer=False",
  506. "OptimizedDoubleBuffer=True",
  507. "UseTextForAccessibility=True"
  508. #else
  509. "DoubleBuffer=True"
  510. #endif
  511. };
  512. Assert.AreEqual(PictureBox_want, GetStyles(new PictureBox()), "PictureBoxStyles");
  513. }
  514. [Test]
  515. public void ProgressBarStyleTest ()
  516. {
  517. string[] ProgressBar_want = {
  518. "ContainerControl=False",
  519. "UserPaint=False",
  520. "Opaque=False",
  521. "ResizeRedraw=False",
  522. "FixedWidth=False",
  523. "FixedHeight=False",
  524. "StandardClick=True",
  525. "Selectable=False",
  526. "UserMouse=False",
  527. "SupportsTransparentBackColor=False",
  528. "StandardDoubleClick=True",
  529. "AllPaintingInWmPaint=True",
  530. "CacheText=False",
  531. "EnableNotifyMessage=False",
  532. "DoubleBuffer=False",
  533. #if NET_2_0
  534. "OptimizedDoubleBuffer=False",
  535. "UseTextForAccessibility=False"
  536. #endif
  537. };
  538. Assert.AreEqual(ProgressBar_want, GetStyles(new ProgressBar()), "ProgressBarStyles");
  539. }
  540. [Test]
  541. public void ScrollableControlStyleTest ()
  542. {
  543. string[] ScrollableControl_want = {
  544. "ContainerControl=True",
  545. "UserPaint=True",
  546. "Opaque=False",
  547. "ResizeRedraw=False",
  548. "FixedWidth=False",
  549. "FixedHeight=False",
  550. "StandardClick=True",
  551. "Selectable=True",
  552. "UserMouse=False",
  553. "SupportsTransparentBackColor=False",
  554. "StandardDoubleClick=True",
  555. "AllPaintingInWmPaint=False",
  556. "CacheText=False",
  557. "EnableNotifyMessage=False",
  558. "DoubleBuffer=False",
  559. #if NET_2_0
  560. "OptimizedDoubleBuffer=False",
  561. "UseTextForAccessibility=True"
  562. #endif
  563. };
  564. Assert.AreEqual(ScrollableControl_want, GetStyles(new ScrollableControl()), "ScrollableControlStyles");
  565. }
  566. [Test]
  567. public void ContainerControlStyleTest ()
  568. {
  569. string[] ContainerControl_want = {
  570. "ContainerControl=True",
  571. "UserPaint=True",
  572. "Opaque=False",
  573. "ResizeRedraw=False",
  574. "FixedWidth=False",
  575. "FixedHeight=False",
  576. "StandardClick=True",
  577. "Selectable=True",
  578. "UserMouse=False",
  579. "SupportsTransparentBackColor=False",
  580. "StandardDoubleClick=True",
  581. "AllPaintingInWmPaint=False",
  582. "CacheText=False",
  583. "EnableNotifyMessage=False",
  584. "DoubleBuffer=False",
  585. #if NET_2_0
  586. "OptimizedDoubleBuffer=False",
  587. "UseTextForAccessibility=True"
  588. #endif
  589. };
  590. Assert.AreEqual(ContainerControl_want, GetStyles(new ContainerControl()), "ContainerControlStyles");
  591. }
  592. [Test]
  593. public void FormStyleTest ()
  594. {
  595. string[] Form_want = {
  596. "ContainerControl=True",
  597. "UserPaint=True",
  598. "Opaque=False",
  599. "ResizeRedraw=False",
  600. "FixedWidth=False",
  601. "FixedHeight=False",
  602. "StandardClick=True",
  603. "Selectable=True",
  604. "UserMouse=False",
  605. "SupportsTransparentBackColor=False",
  606. "StandardDoubleClick=True",
  607. "AllPaintingInWmPaint=False",
  608. "CacheText=False",
  609. "EnableNotifyMessage=False",
  610. "DoubleBuffer=False",
  611. #if NET_2_0
  612. "OptimizedDoubleBuffer=False",
  613. "UseTextForAccessibility=True"
  614. #endif
  615. };
  616. Form f = new Form ();
  617. f.ShowInTaskbar = false;
  618. Assert.AreEqual(Form_want, GetStyles(f), "FormStyles");
  619. f.Dispose ();
  620. }
  621. [Test]
  622. public void PropertyGridStyleTest ()
  623. {
  624. string[] PropertyGrid_want = {
  625. "ContainerControl=True",
  626. "UserPaint=True",
  627. "Opaque=False",
  628. "ResizeRedraw=False",
  629. "FixedWidth=False",
  630. "FixedHeight=False",
  631. "StandardClick=True",
  632. "Selectable=True",
  633. "UserMouse=False",
  634. "SupportsTransparentBackColor=False",
  635. "StandardDoubleClick=True",
  636. "AllPaintingInWmPaint=False",
  637. "CacheText=False",
  638. "EnableNotifyMessage=False",
  639. "DoubleBuffer=False",
  640. #if NET_2_0
  641. "OptimizedDoubleBuffer=False",
  642. "UseTextForAccessibility=True"
  643. #endif
  644. };
  645. Assert.AreEqual(PropertyGrid_want, GetStyles(new PropertyGrid()), "PropertyGridStyles");
  646. }
  647. [Test]
  648. public void DomainUpDownStyleTest ()
  649. {
  650. string[] DomainUpDown_want = {
  651. "ContainerControl=True",
  652. "UserPaint=True",
  653. #if NET_2_0
  654. "Opaque=True",
  655. "ResizeRedraw=True",
  656. #else
  657. "Opaque=False",
  658. "ResizeRedraw=False",
  659. #endif
  660. "FixedWidth=False",
  661. "FixedHeight=True",
  662. #if NET_2_0
  663. "StandardClick=False",
  664. #else
  665. "StandardClick=True",
  666. #endif
  667. "Selectable=True",
  668. "UserMouse=False",
  669. "SupportsTransparentBackColor=False",
  670. "StandardDoubleClick=True",
  671. "AllPaintingInWmPaint=False",
  672. "CacheText=False",
  673. "EnableNotifyMessage=False",
  674. "DoubleBuffer=False",
  675. #if NET_2_0
  676. "OptimizedDoubleBuffer=False",
  677. "UseTextForAccessibility=False"
  678. #endif
  679. };
  680. Assert.AreEqual(DomainUpDown_want, GetStyles(new DomainUpDown()), "DomainUpDownStyles");
  681. }
  682. [Test]
  683. public void NumericUpDownStyleTest ()
  684. {
  685. string[] NumericUpDown_want = {
  686. "ContainerControl=True",
  687. "UserPaint=True",
  688. #if NET_2_0
  689. "Opaque=True",
  690. "ResizeRedraw=True",
  691. #else
  692. "Opaque=False",
  693. "ResizeRedraw=False",
  694. #endif
  695. "FixedWidth=False",
  696. "FixedHeight=True",
  697. #if NET_2_0
  698. "StandardClick=False",
  699. #else
  700. "StandardClick=True",
  701. #endif
  702. "Selectable=True",
  703. "UserMouse=False",
  704. "SupportsTransparentBackColor=False",
  705. "StandardDoubleClick=True",
  706. "AllPaintingInWmPaint=False",
  707. "CacheText=False",
  708. "EnableNotifyMessage=False",
  709. "DoubleBuffer=False",
  710. #if NET_2_0
  711. "OptimizedDoubleBuffer=False",
  712. "UseTextForAccessibility=False"
  713. #endif
  714. };
  715. Assert.AreEqual(NumericUpDown_want, GetStyles(new NumericUpDown()), "NumericUpDownStyles");
  716. }
  717. [Test]
  718. public void UserControlStyleTest ()
  719. {
  720. string[] UserControl_want = {
  721. "ContainerControl=True",
  722. "UserPaint=True",
  723. "Opaque=False",
  724. "ResizeRedraw=False",
  725. "FixedWidth=False",
  726. "FixedHeight=False",
  727. "StandardClick=True",
  728. "Selectable=True",
  729. "UserMouse=False",
  730. #if NET_2_0
  731. "SupportsTransparentBackColor=True",
  732. #else
  733. "SupportsTransparentBackColor=False",
  734. #endif
  735. "StandardDoubleClick=True",
  736. "AllPaintingInWmPaint=False",
  737. "CacheText=False",
  738. "EnableNotifyMessage=False",
  739. "DoubleBuffer=False",
  740. #if NET_2_0
  741. "OptimizedDoubleBuffer=False",
  742. "UseTextForAccessibility=True"
  743. #endif
  744. };
  745. Assert.AreEqual(UserControl_want, GetStyles(new UserControl()), "UserControlStyles");
  746. }
  747. [Test]
  748. public void PanelStyleTest ()
  749. {
  750. string[] Panel_want = {
  751. "ContainerControl=True",
  752. "UserPaint=True",
  753. "Opaque=False",
  754. "ResizeRedraw=False",
  755. "FixedWidth=False",
  756. "FixedHeight=False",
  757. "StandardClick=True",
  758. "Selectable=False",
  759. "UserMouse=False",
  760. "SupportsTransparentBackColor=True",
  761. "StandardDoubleClick=True",
  762. "AllPaintingInWmPaint=False",
  763. "CacheText=False",
  764. "EnableNotifyMessage=False",
  765. "DoubleBuffer=False",
  766. #if NET_2_0
  767. "OptimizedDoubleBuffer=False",
  768. "UseTextForAccessibility=True"
  769. #endif
  770. };
  771. Assert.AreEqual(Panel_want, GetStyles(new Panel()), "PanelStyles");
  772. }
  773. [Test]
  774. public void TabPageStyleTest ()
  775. {
  776. string[] TabPage_want = {
  777. "ContainerControl=True",
  778. "UserPaint=True",
  779. "Opaque=False",
  780. "ResizeRedraw=False",
  781. "FixedWidth=False",
  782. "FixedHeight=False",
  783. "StandardClick=True",
  784. "Selectable=False",
  785. "UserMouse=False",
  786. "SupportsTransparentBackColor=True",
  787. "StandardDoubleClick=True",
  788. "AllPaintingInWmPaint=False",
  789. "CacheText=True",
  790. "EnableNotifyMessage=False",
  791. "DoubleBuffer=False",
  792. #if NET_2_0
  793. "OptimizedDoubleBuffer=False",
  794. "UseTextForAccessibility=True"
  795. #endif
  796. };
  797. Assert.AreEqual(TabPage_want, GetStyles(new TabPage()), "TabPageStyles");
  798. }
  799. [Test]
  800. public void HScrollBarStyleTest ()
  801. {
  802. string[] HScrollBar_want = {
  803. "ContainerControl=False",
  804. "UserPaint=False",
  805. "Opaque=False",
  806. "ResizeRedraw=False",
  807. "FixedWidth=False",
  808. "FixedHeight=False",
  809. "StandardClick=False",
  810. "Selectable=True",
  811. "UserMouse=False",
  812. "SupportsTransparentBackColor=False",
  813. "StandardDoubleClick=True",
  814. "AllPaintingInWmPaint=True",
  815. "CacheText=False",
  816. "EnableNotifyMessage=False",
  817. "DoubleBuffer=False",
  818. #if NET_2_0
  819. "OptimizedDoubleBuffer=False",
  820. "UseTextForAccessibility=False"
  821. #endif
  822. };
  823. Assert.AreEqual(HScrollBar_want, GetStyles(new HScrollBar()), "HScrollBarStyles");
  824. }
  825. [Test]
  826. public void VScrollBarStyleTest ()
  827. {
  828. string[] VScrollBar_want = {
  829. "ContainerControl=False",
  830. "UserPaint=False",
  831. "Opaque=False",
  832. "ResizeRedraw=False",
  833. "FixedWidth=False",
  834. "FixedHeight=False",
  835. "StandardClick=False",
  836. "Selectable=True",
  837. "UserMouse=False",
  838. "SupportsTransparentBackColor=False",
  839. "StandardDoubleClick=True",
  840. "AllPaintingInWmPaint=True",
  841. "CacheText=False",
  842. "EnableNotifyMessage=False",
  843. "DoubleBuffer=False",
  844. #if NET_2_0
  845. "OptimizedDoubleBuffer=False",
  846. "UseTextForAccessibility=False"
  847. #endif
  848. };
  849. Assert.AreEqual(VScrollBar_want, GetStyles(new VScrollBar()), "VScrollBarStyles");
  850. }
  851. [Test]
  852. public void SplitterStyleTest ()
  853. {
  854. string[] Splitter_want = {
  855. "ContainerControl=False",
  856. "UserPaint=True",
  857. "Opaque=False",
  858. "ResizeRedraw=False",
  859. "FixedWidth=False",
  860. "FixedHeight=False",
  861. "StandardClick=True",
  862. "Selectable=False",
  863. "UserMouse=False",
  864. "SupportsTransparentBackColor=False",
  865. "StandardDoubleClick=True",
  866. "AllPaintingInWmPaint=True",
  867. "CacheText=False",
  868. "EnableNotifyMessage=False",
  869. "DoubleBuffer=False",
  870. #if NET_2_0
  871. "OptimizedDoubleBuffer=False",
  872. "UseTextForAccessibility=True"
  873. #endif
  874. };
  875. Assert.AreEqual(Splitter_want, GetStyles(new Splitter()), "SplitterStyles");
  876. }
  877. [Test]
  878. public void StatusBarStyleTest ()
  879. {
  880. string[] StatusBar_want = {
  881. "ContainerControl=False",
  882. "UserPaint=False",
  883. "Opaque=False",
  884. "ResizeRedraw=False",
  885. "FixedWidth=False",
  886. "FixedHeight=False",
  887. "StandardClick=True",
  888. "Selectable=False",
  889. "UserMouse=False",
  890. "SupportsTransparentBackColor=False",
  891. "StandardDoubleClick=True",
  892. "AllPaintingInWmPaint=True",
  893. "CacheText=False",
  894. "EnableNotifyMessage=False",
  895. "DoubleBuffer=False",
  896. #if NET_2_0
  897. "OptimizedDoubleBuffer=False",
  898. "UseTextForAccessibility=True"
  899. #endif
  900. };
  901. Assert.AreEqual(StatusBar_want, GetStyles(new StatusBar()), "StatusBarStyles");
  902. }
  903. [Test]
  904. public void TabControlStyleTest ()
  905. {
  906. string[] TabControl_want = {
  907. "ContainerControl=False",
  908. "UserPaint=False",
  909. "Opaque=False",
  910. "ResizeRedraw=False",
  911. "FixedWidth=False",
  912. "FixedHeight=False",
  913. "StandardClick=True",
  914. "Selectable=True",
  915. "UserMouse=False",
  916. "SupportsTransparentBackColor=False",
  917. "StandardDoubleClick=True",
  918. "AllPaintingInWmPaint=True",
  919. "CacheText=False",
  920. "EnableNotifyMessage=False",
  921. "DoubleBuffer=False",
  922. #if NET_2_0
  923. "OptimizedDoubleBuffer=False",
  924. "UseTextForAccessibility=True"
  925. #endif
  926. };
  927. Assert.AreEqual(TabControl_want, GetStyles(new TabControl()), "TabControlStyles");
  928. }
  929. [Test]
  930. public void RichTextBoxStyleTest ()
  931. {
  932. string[] RichTextBox_want = {
  933. "ContainerControl=False",
  934. "UserPaint=False",
  935. "Opaque=False",
  936. "ResizeRedraw=False",
  937. "FixedWidth=False",
  938. "FixedHeight=False",
  939. "StandardClick=False",
  940. "Selectable=True",
  941. "UserMouse=False",
  942. "SupportsTransparentBackColor=False",
  943. #if NET_2_0
  944. "StandardDoubleClick=False",
  945. #else
  946. "StandardDoubleClick=True",
  947. #endif
  948. "AllPaintingInWmPaint=True",
  949. "CacheText=False",
  950. "EnableNotifyMessage=False",
  951. "DoubleBuffer=False",
  952. #if NET_2_0
  953. "OptimizedDoubleBuffer=False",
  954. "UseTextForAccessibility=False"
  955. #endif
  956. };
  957. Assert.AreEqual(RichTextBox_want, GetStyles(new RichTextBox()), "RichTextBoxStyles");
  958. }
  959. [Test]
  960. public void TextBoxStyleTest ()
  961. {
  962. string[] TextBox_want = {
  963. "ContainerControl=False",
  964. "UserPaint=False",
  965. "Opaque=False",
  966. "ResizeRedraw=False",
  967. "FixedWidth=False",
  968. "FixedHeight=True",
  969. "StandardClick=False",
  970. "Selectable=True",
  971. "UserMouse=False",
  972. "SupportsTransparentBackColor=False",
  973. "StandardDoubleClick=False",
  974. "AllPaintingInWmPaint=True",
  975. "CacheText=False",
  976. "EnableNotifyMessage=False",
  977. "DoubleBuffer=False",
  978. #if NET_2_0
  979. "OptimizedDoubleBuffer=False",
  980. "UseTextForAccessibility=False"
  981. #endif
  982. };
  983. Assert.AreEqual(TextBox_want, GetStyles(new TextBox()), "TextBoxStyles");
  984. }
  985. [Test]
  986. public void DataGridTextBoxStyleTest ()
  987. {
  988. string[] DataGridTextBox_want = {
  989. "ContainerControl=False",
  990. "UserPaint=False",
  991. "Opaque=False",
  992. "ResizeRedraw=False",
  993. "FixedWidth=False",
  994. "FixedHeight=True",
  995. "StandardClick=False",
  996. "Selectable=True",
  997. "UserMouse=False",
  998. "SupportsTransparentBackColor=False",
  999. "StandardDoubleClick=False",
  1000. "AllPaintingInWmPaint=True",
  1001. "CacheText=False",
  1002. "EnableNotifyMessage=False",
  1003. "DoubleBuffer=False",
  1004. #if NET_2_0
  1005. "OptimizedDoubleBuffer=False",
  1006. "UseTextForAccessibility=False"
  1007. #endif
  1008. };
  1009. Assert.AreEqual(DataGridTextBox_want, GetStyles(new DataGridTextBox()), "DataGridTextBoxStyles");
  1010. }
  1011. [Test]
  1012. public void ToolBarStyleTest ()
  1013. {
  1014. string[] ToolBar_want = {
  1015. "ContainerControl=False",
  1016. "UserPaint=False",
  1017. "Opaque=False",
  1018. "ResizeRedraw=False",
  1019. "FixedWidth=False",
  1020. "FixedHeight=True",
  1021. "StandardClick=True",
  1022. "Selectable=True",
  1023. "UserMouse=False",
  1024. "SupportsTransparentBackColor=False",
  1025. "StandardDoubleClick=True",
  1026. "AllPaintingInWmPaint=True",
  1027. "CacheText=False",
  1028. "EnableNotifyMessage=False",
  1029. "DoubleBuffer=False",
  1030. #if NET_2_0
  1031. "OptimizedDoubleBuffer=False",
  1032. "UseTextForAccessibility=True"
  1033. #endif
  1034. };
  1035. Assert.AreEqual(ToolBar_want, GetStyles(new ToolBar()), "ToolBarStyles");
  1036. }
  1037. [Test]
  1038. public void TrackBarStyleTest ()
  1039. {
  1040. string[] TrackBar_want = {
  1041. "ContainerControl=False",
  1042. "UserPaint=False",
  1043. "Opaque=False",
  1044. "ResizeRedraw=False",
  1045. "FixedWidth=False",
  1046. "FixedHeight=False",
  1047. "StandardClick=True",
  1048. "Selectable=True",
  1049. "UserMouse=False",
  1050. "SupportsTransparentBackColor=False",
  1051. "StandardDoubleClick=True",
  1052. "AllPaintingInWmPaint=True",
  1053. "CacheText=False",
  1054. "EnableNotifyMessage=False",
  1055. "DoubleBuffer=False",
  1056. #if NET_2_0
  1057. "OptimizedDoubleBuffer=False",
  1058. "UseTextForAccessibility=False"
  1059. #endif
  1060. };
  1061. Assert.AreEqual(TrackBar_want, GetStyles(new TrackBar()), "TrackBarStyles");
  1062. }
  1063. [Test]
  1064. public void TreeViewStyleTest ()
  1065. {
  1066. string[] TreeView_want = {
  1067. "ContainerControl=False",
  1068. "UserPaint=False",
  1069. "Opaque=False",
  1070. "ResizeRedraw=False",
  1071. "FixedWidth=False",
  1072. "FixedHeight=False",
  1073. "StandardClick=False",
  1074. "Selectable=True",
  1075. "UserMouse=False",
  1076. "SupportsTransparentBackColor=False",
  1077. "StandardDoubleClick=True",
  1078. "AllPaintingInWmPaint=True",
  1079. "CacheText=False",
  1080. "EnableNotifyMessage=False",
  1081. "DoubleBuffer=False",
  1082. #if NET_2_0
  1083. "OptimizedDoubleBuffer=False",
  1084. "UseTextForAccessibility=False"
  1085. #endif
  1086. };
  1087. Assert.AreEqual(TreeView_want, GetStyles(new TreeView()), "TreeViewStyles");
  1088. }
  1089. }
  1090. }