1
|
/**
|
2
|
* Tests for #7019: number edit issues.
|
3
|
*
|
4
|
* This test will eventually contain all kinds of editors to test them for other issues and
|
5
|
* regressions.
|
6
|
*/
|
7
|
SESSION:SET-NUMERIC-FORMAT(",",".").
|
8
|
|
9
|
/**
|
10
|
* Set session date format.
|
11
|
*
|
12
|
* Note: due to a bug in FWD, we cannot change this format for an already existing date instances,
|
13
|
* so we have to set an appropriate value right now.
|
14
|
* Note2: due to a bug in FWD, this operation causes issues with formats already compiled before.
|
15
|
*/
|
16
|
SESSION:DATE-FORMAT = "ymd".
|
17
|
|
18
|
DEFINE VARIABLE v AS DECIMAL NO-UNDO VIEW-AS FILL-IN SIZE 30 BY 1 FONT 1.
|
19
|
|
20
|
/**
|
21
|
* Use the long year date format, since most tests use it. It can be changed by the user later.
|
22
|
*/
|
23
|
DEFINE VARIABLE d AS DATE NO-UNDO VIEW-AS FILL-IN SIZE 30 BY 1 FONT 1 FORMAT "99999999".
|
24
|
|
25
|
DEFINE VARIABLE i AS INTEGER NO-UNDO VIEW-AS FILL-IN SIZE 30 BY 1 FONT 1.
|
26
|
DEFINE VARIABLE s AS CHARACTER NO-UNDO VIEW-AS FILL-IN SIZE 30 BY 1 FONT 1.
|
27
|
|
28
|
/**
|
29
|
* This field is used to enter a new screen value for fields being tested
|
30
|
*/
|
31
|
DEFINE VARIABLE newValue AS CHARACTER NO-UNDO FORMAT "x(256)" VIEW-AS FILL-IN SIZE 30 BY 1 FONT 1.
|
32
|
|
33
|
/**
|
34
|
* Pressing one of these buttons set the SCREEN-VALUE of the
|
35
|
* corresponding FILL-IN from the newValue FILL-IN
|
36
|
*/
|
37
|
DEFINE BUTTON bSetDecimal LABEL "Set decimal" SIZE 30 BY 1 FONT 1.
|
38
|
DEFINE BUTTON bSetInteger LABEL "Set integer" SIZE 30 BY 1 FONT 1.
|
39
|
DEFINE BUTTON bSetCharacter LABEL "Set character" SIZE 30 BY 1 FONT 1.
|
40
|
DEFINE BUTTON bSetDate LABEL "Set date" SIZE 30 BY 1.
|
41
|
|
42
|
/**
|
43
|
* Pressing one of these buttons set the newValue SCREEN-VALUE from the
|
44
|
* corresponding FILL-IN
|
45
|
*/
|
46
|
DEFINE BUTTON bGetDecimal LABEL "Get decimal" SIZE 30 BY 1 FONT 1.
|
47
|
DEFINE BUTTON bGetInteger LABEL "Get integer" SIZE 30 BY 1 FONT 1.
|
48
|
DEFINE BUTTON bGetCharacter LABEL "Get character" SIZE 30 BY 1 FONT 1.
|
49
|
DEFINE BUTTON bGetDate LABEL "Get date" SIZE 30 BY 1.
|
50
|
|
51
|
/**
|
52
|
* Pressing one of these buttons set the format spec of the
|
53
|
* corresponding FILL-IN from the newValue FILL-IN
|
54
|
*/
|
55
|
DEFINE BUTTON bSetDecimalFormat LABEL "Set decimal format" SIZE 30 BY 1 FONT 1.
|
56
|
DEFINE BUTTON bSetIntegerFormat LABEL "Set integer format" SIZE 30 BY 1 FONT 1.
|
57
|
DEFINE BUTTON bSetCharacterFormat LABEL "Set character format" SIZE 30 BY 1 FONT 1.
|
58
|
DEFINE BUTTON bSetDateFormat LABEL "Set date format" SIZE 30 BY 1.
|
59
|
|
60
|
/**
|
61
|
* Set session date format like SESSION:DATE-FORMAT = 'mdy'.
|
62
|
* Note: this seems to be currently useless, see above.
|
63
|
*/
|
64
|
DEFINE BUTTON bSessionDateFormat LABEL "Set session date format" SIZE 30 BY 1.
|
65
|
|
66
|
DEFINE FRAME f
|
67
|
"Decimal: " v AT ROW 1 COLUMN 10 NO-LABEL SKIP
|
68
|
"Integer: " i AT ROW 2 COLUMN 10 NO-LABEL SKIP
|
69
|
"Char: " s AT ROW 3 COLUMN 10 NO-LABEL SKIP
|
70
|
"Date: " d AT ROW 4 COLUMN 10 NO-LABEL SKIP
|
71
|
"Value: " newValue AT ROW 5 COLUMN 10 NO-LABEL SKIP
|
72
|
bSetDecimal AT ROW 6 COLUMN 10 NO-LABEL SKIP
|
73
|
bSetInteger AT ROW 7 COLUMN 10 NO-LABEL SKIP
|
74
|
bSetCharacter AT ROW 8 COLUMN 10 NO-LABEL SKIP
|
75
|
bSetDate AT ROW 9 COLUMN 10 NO-LABEL SKIP
|
76
|
|
77
|
bGetDecimal AT ROW 10 COLUMN 10 NO-LABEL SKIP
|
78
|
bGetInteger AT ROW 11 COLUMN 10 NO-LABEL SKIP
|
79
|
bGetCharacter AT ROW 12 COLUMN 10 NO-LABEL SKIP
|
80
|
bGetDate AT ROW 13 COLUMN 10 NO-LABEL SKIP
|
81
|
|
82
|
bSetDecimalFormat AT ROW 14 COLUMN 10 NO-LABEL SKIP
|
83
|
bSetIntegerFormat AT ROW 15 COLUMN 10 NO-LABEL SKIP
|
84
|
bSetCharacterFormat AT ROW 16 COLUMN 10 NO-LABEL SKIP
|
85
|
bSetDateFormat AT ROW 17 COLUMN 10 NO-LABEL SKIP
|
86
|
|
87
|
bSessionDateFormat AT ROW 18 COLUMN 10 NO-LABEL SKIP
|
88
|
WITH SIZE 45 BY 21 TITLE "#7019 test."
|
89
|
.
|
90
|
|
91
|
/**
|
92
|
* This is required in FWD due to the bug in FWD: setting SESSION:DATE-FORMAT = "ymd" above does not affect existing date instances.
|
93
|
* UPD: this does not work either.
|
94
|
*/
|
95
|
d:FORMAT = "9999/99/99".
|
96
|
|
97
|
/* Set new value handlers */
|
98
|
ON CHOOSE OF bSetDecimal DO:
|
99
|
v:SCREEN-VALUE = newValue:SCREEN-VALUE.
|
100
|
END.
|
101
|
|
102
|
ON CHOOSE OF bSetInteger DO:
|
103
|
i:SCREEN-VALUE = newValue:SCREEN-VALUE.
|
104
|
END.
|
105
|
|
106
|
ON CHOOSE OF bSetCharacter DO:
|
107
|
s:SCREEN-VALUE = newValue:SCREEN-VALUE.
|
108
|
END.
|
109
|
|
110
|
ON CHOOSE OF bSetDate DO:
|
111
|
d:SCREEN-VALUE = newValue:SCREEN-VALUE.
|
112
|
END.
|
113
|
|
114
|
/* Get new value handlers */
|
115
|
ON CHOOSE OF bGetDecimal DO:
|
116
|
newValue:SCREEN-VALUE = v:SCREEN-VALUE.
|
117
|
END.
|
118
|
|
119
|
ON CHOOSE OF bGetInteger DO:
|
120
|
newValue:SCREEN-VALUE = i:SCREEN-VALUE.
|
121
|
END.
|
122
|
|
123
|
ON CHOOSE OF bGetCharacter DO:
|
124
|
newValue:SCREEN-VALUE = s:SCREEN-VALUE.
|
125
|
END.
|
126
|
|
127
|
ON CHOOSE OF bGetDate DO:
|
128
|
ASSIGN d.
|
129
|
newValue:SCREEN-VALUE = STRING(d).
|
130
|
END.
|
131
|
|
132
|
ON CHOOSE OF bSetDecimalFormat DO:
|
133
|
v:FORMAT = newValue:SCREEN-VALUE.
|
134
|
END.
|
135
|
|
136
|
ON CHOOSE OF bSetIntegerFormat DO:
|
137
|
i:FORMAT = newValue:SCREEN-VALUE.
|
138
|
END.
|
139
|
|
140
|
ON CHOOSE OF bSetCharacterFormat DO:
|
141
|
s:FORMAT = newValue:SCREEN-VALUE.
|
142
|
END.
|
143
|
|
144
|
ON CHOOSE OF bSetDateFormat DO:
|
145
|
d:FORMAT = newValue:SCREEN-VALUE.
|
146
|
MESSAGE "Date format is now" d:FORMAT.
|
147
|
END.
|
148
|
|
149
|
ON CHOOSE OF bSessionDateFormat DO:
|
150
|
SESSION:DATE-FORMAT = newValue:SCREEN-VALUE.
|
151
|
END.
|
152
|
|
153
|
ON LEAVE OF d DO:
|
154
|
MESSAGE "'" d:SCREEN-VALUE "'".
|
155
|
// Note: the value is *not* normalized here yet!
|
156
|
ASSIGN d NO-ERROR.
|
157
|
IF NOT ERROR-STATUS:ERROR THEN
|
158
|
DO:
|
159
|
newValue:SCREEN-VALUE = STRING(d).
|
160
|
MESSAGE YEAR(d) MONTH(d) DAY(d).
|
161
|
END.
|
162
|
END.
|
163
|
|
164
|
ON ENTRY OF newValue DO:
|
165
|
MESSAGE "newValue entered".
|
166
|
END.
|
167
|
|
168
|
// Make sure the format is as we expect
|
169
|
d:FORMAT = "99999999".
|
170
|
|
171
|
ENABLE ALL WITH FRAME f.
|
172
|
VIEW FRAME f.
|
173
|
ON "A" OF FRAME f ANYWHERE DO:
|
174
|
MESSAGE "Hello1".
|
175
|
END.
|
176
|
|
177
|
WAIT-FOR GO OF FRAME f.
|