ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/fbintf/testsuite/Test10.pas
(Generate patch)

Comparing ibx/trunk/fbintf/testsuite/Test10.pas (file contents):
Revision 56 by tony, Mon Mar 6 10:20:02 2017 UTC vs.
Revision 402 by tony, Mon Aug 1 10:07:24 2022 UTC

# Line 1 | Line 1
1 + (*
2 + *  Firebird Interface (fbintf) Test suite. This program is used to
3 + *  test the Firebird Pascal Interface and provide a semi-automated
4 + *  pass/fail check for each test.
5 + *
6 + *  The contents of this file are subject to the Initial Developer's
7 + *  Public License Version 1.0 (the "License"); you may not use this
8 + *  file except in compliance with the License. You may obtain a copy
9 + *  of the License here:
10 + *
11 + *    http://www.firebirdsql.org/index.php?op=doc&id=idpl
12 + *
13 + *  Software distributed under the License is distributed on an "AS
14 + *  IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
15 + *  implied. See the License for the specific language governing rights
16 + *  and limitations under the License.
17 + *
18 + *  The Initial Developer of the Original Code is Tony Whyman.
19 + *
20 + *  The Original Code is (C) 2016 Tony Whyman, MWA Software
21 + *  (http://www.mwasoftware.co.uk).
22 + *
23 + *  All Rights Reserved.
24 + *
25 + *  Contributor(s): ______________________________________.
26 + *
27 + *)
28 +
29   unit Test10;
30   {$IFDEF MSWINDOWS}
31   {$DEFINE WINDOWS}
# Line 30 | Line 58 | unit Test10;
58   interface
59  
60   uses
61 <  Classes, SysUtils, TestManager, IB;
61 >  Classes, SysUtils, TestApplication, FBTestApp, IB;
62  
63   type
64  
65   { TTest10 }
66  
67 <  TTest10 = class(TTestBase)
67 >  TTest10 = class(TFBTestBase)
68    private
69      FEventSignalled: boolean;
70      procedure EventsTest(Attachment: IAttachment);
71      procedure EventReport(Sender: IEvents);
72 +    procedure ShowEventReport;
73      procedure ShowEventCounts(Intf: IEvents);
74    public
75      function TestTitle: AnsiString; override;
# Line 57 | Line 86 | const
86  
87   procedure TTest10.EventsTest(Attachment: IAttachment);
88   var EventHandler: IEvents;
60    i: integer;
89      WaitCount: integer;
90   begin
91    FEventSignalled := false;
# Line 66 | Line 94 | begin
94    EventHandler.AsyncWaitForEvent(EventReport);
95    writeln(OutFile,'Async Wait Called');
96    sleep(500);
97 +  CheckSynchronize;
98    if FEventSignalled then
99    begin
100      writeln(OutFile,'First Event - usually ignored');
101      FEventSignalled := false;
102      EventHandler.AsyncWaitForEvent(EventReport);
103      sleep(100);
104 +    CheckSynchronize;
105      if FEventSignalled then
106      begin
107        writeln(OutFile,'Unexpected Event 1');
# Line 80 | Line 110 | begin
110    end;
111    writeln(OutFile,'Signal Event');
112    Attachment.ExecImmediate([isc_tpb_write,isc_tpb_nowait,isc_tpb_concurrency],sqlEvent);
113 <  while not FEventSignalled do Sleep(50);
113 >  while not FEventSignalled do
114 >  begin
115 >    Sleep(50);
116 >    CheckSynchronize;
117 >  end;
118    ShowEventCounts(EventHandler);
119    FEventSignalled := false;
120  
# Line 96 | Line 130 | begin
130    EventHandler.AsyncWaitForEvent(EventReport);
131    writeln(OutFile,'Async Wait Called');
132    sleep(500);
133 +  CheckSynchronize;
134    if FEventSignalled then
135    begin
136      writeln(OutFile,'Deferred Events Caught');
137      ShowEventCounts(EventHandler);
138      FEventSignalled := false;
139      EventHandler.AsyncWaitForEvent(EventReport);
140 +    CheckSynchronize;
141      sleep(100);
142      if FEventSignalled then
143        writeln(OutFile,'Unexpected Event 3');
# Line 114 | Line 150 | begin
150    FEventSignalled := false;
151    writeln(OutFile,'Async Wait: Test Cancel');
152    EventHandler.AsyncWaitForEvent(EventReport);
153 +  CheckSynchronize;
154    writeln(OutFile,'Async Wait Called');
155    EventHandler.Cancel;
156    writeln(OutFile,'Event Cancelled');
# Line 126 | Line 163 | begin
163      writeln(OutFile,'Event called - so Cancel failed');
164  
165    writeln(OutFile,'Sync wait');
166 +  CheckSynchronize;
167    Attachment.ExecImmediate([isc_tpb_write,isc_tpb_nowait,isc_tpb_concurrency],sqlEvent);
168    EventHandler.WaitForEvent;
169    writeln(OutFile,'Event Signalled');
170    ShowEventCounts(EventHandler);
171    EventHandler := nil;
172 +  CheckSynchronize;
173   end;
174  
175   procedure TTest10.EventReport(Sender: IEvents);
176   begin
177    FEventSignalled := true;
178 +  TThread.Synchronize(nil,ShowEventReport);
179 + end;
180 +
181 + procedure TTest10.ShowEventReport;
182 + begin
183    writeln(OutFile,'Event Signalled');
184   end;
185  
# Line 162 | Line 206 | begin
206    DPB.Add(isc_dpb_user_name).setAsString(Owner.GetUserName);
207    DPB.Add(isc_dpb_password).setAsString(' ');
208    DPB.Add(isc_dpb_lc_ctype).setAsString(CharSet);
165  DPB.Add(isc_dpb_set_db_SQL_dialect).setAsByte(SQLDialect);
209    DPB.Find(isc_dpb_password).setAsString(Owner.GetPassword);
210    Attachment := FirebirdAPI.OpenDatabase(Owner.GetEmployeeDatabaseName,DPB);
211    EventsTest(Attachment);

Comparing ibx/trunk/fbintf/testsuite/Test10.pas (property svn:eol-style):
Revision 56 by tony, Mon Mar 6 10:20:02 2017 UTC vs.
Revision 402 by tony, Mon Aug 1 10:07:24 2022 UTC

# Line 0 | Line 1
1 + native

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines