comparison mde/gui/widget/layout.d @ 163:24d77c52243f

Provided sensible conversions for setting the value of one AStringContent from another, along with unittest. Updated layout and Translation unittests to run.
author Diggory Hardy <diggory.hardy@gmail.com>
date Sat, 23 May 2009 15:47:32 +0200
parents 2476790223b8
children da8d3091fdaf
comparison
equal deleted inserted replaced
162:2476790223b8 163:24d77c52243f
119 override IContent content () { 119 override IContent content () {
120 return cList; 120 return cList;
121 } 121 }
122 122
123 override bool dropContent (IContent content) { 123 override bool dropContent (IContent content) {
124 if (cList.setContent (content)) 124 if (cList.set (content))
125 return true; 125 return true;
126 return parent.dropContent (content); 126 return parent.dropContent (content);
127 } 127 }
128 128
129 override void recursionCheck (widgetID wID, IContent c) { 129 override void recursionCheck (widgetID wID, IContent c) {
917 assert (x == mw, "invariant: mw is wrong"); 917 assert (x == mw, "invariant: mw is wrong");
918 } 918 }
919 } 919 }
920 920
921 debug (mdeUnitTest) unittest { 921 debug (mdeUnitTest) unittest {
922 bool throws (void delegate() dg) {
923 bool r = false;
924 try {
925 dg();
926 } catch (Exception e) {
927 r = true;
928 }
929 return r;
930 }
931
932 AlignColumns a, a2, b; 922 AlignColumns a, a2, b;
933 a = getInstance ("a", 2); 923 a = getInstance ("a", null, 2, false);
934 a2 = getInstance ("a", 2); 924 a2 = getInstance ("a", null, 2, false);
935 b = getInstance ("b", 5); 925 b = getInstance ("a", null, 5, true);
936 assert (a is a2); 926 assert (a is a2);
937 assert (a !is b); 927 assert (a !is b);
938 assert (throws ({ getInstance ("a", 4); })); 928 assert (getInstance ("a", null, 4, false) !is a);
939 929
940 a.setup (0, 3); 930 a.setup (0, 3);
941 a.spacing = 6; 931 a.spacing = 6;
942 a.minWidth[0] = 50; 932 a.minWidth[0] = 50;
943 a.minWidth[1] = 6; 933 a.minWidth[1] = 6;