mirror of
https://github.com/moparisthebest/Simba
synced 2025-03-03 10:51:49 -05:00
Added a test. Works nicely.
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@25 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
fd960aa1aa
commit
ea1cac880f
@ -6,7 +6,7 @@
|
||||
<MainUnit Value="0"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<ActiveEditorIndexAtStart Value="3"/>
|
||||
<ActiveEditorIndexAtStart Value="1"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
@ -30,7 +30,7 @@
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="43">
|
||||
<Units Count="44">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
@ -167,8 +167,8 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="TestUnit"/>
|
||||
<CursorPos X="39" Y="66"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="46" Y="50"/>
|
||||
<TopLine Value="38"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -299,7 +299,7 @@
|
||||
<Filename Value="../../Units/MMLCore/client.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="Client"/>
|
||||
<CursorPos X="3" Y="36"/>
|
||||
<CursorPos X="71" Y="31"/>
|
||||
<TopLine Value="16"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="20"/>
|
||||
@ -318,8 +318,8 @@
|
||||
<Unit39>
|
||||
<Filename Value="../../../cogat/Units/CogatUnits/compfiles.pas"/>
|
||||
<UnitName Value="compFiles"/>
|
||||
<CursorPos X="55" Y="501"/>
|
||||
<TopLine Value="501"/>
|
||||
<CursorPos X="18" Y="8"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -328,8 +328,8 @@
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="files"/>
|
||||
<CursorPos X="21" Y="44"/>
|
||||
<TopLine Value="31"/>
|
||||
<CursorPos X="54" Y="19"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -351,112 +351,137 @@
|
||||
<TopLine Value="981"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit42>
|
||||
<Unit43>
|
||||
<Filename Value="../../../cogat/Units/CogatUnits/comptypes.pas"/>
|
||||
<UnitName Value="CompTypes"/>
|
||||
<CursorPos X="80" Y="9"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit43>
|
||||
</Units>
|
||||
<JumpHistory Count="26" HistoryIndex="25">
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="10" Column="7" TopLine="1"/>
|
||||
<Caret Line="9" Column="32" TopLine="1"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="108" Column="41" TopLine="95"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="17" Column="17" TopLine="1"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="103" Column="43" TopLine="95"/>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="13" Column="20" TopLine="7"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="9" Column="24" TopLine="1"/>
|
||||
<Filename Value="../../../cogat/Units/CogatUnits/compfiles.pas"/>
|
||||
<Caret Line="30" Column="22" TopLine="11"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="../../Units/MMLCore/client.pas"/>
|
||||
<Caret Line="8" Column="38" TopLine="1"/>
|
||||
<Filename Value="../../../cogat/Units/CogatUnits/compfiles.pas"/>
|
||||
<Caret Line="31" Column="23" TopLine="11"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="14" Column="8" TopLine="1"/>
|
||||
<Caret Line="439" Column="74" TopLine="11"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="9" Column="32" TopLine="1"/>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="43" Column="20" TopLine="28"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="17" Column="17" TopLine="1"/>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="55" Column="24" TopLine="40"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="13" Column="20" TopLine="7"/>
|
||||
<Caret Line="36" Column="27" TopLine="31"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="../../../cogat/Units/CogatUnits/compfiles.pas"/>
|
||||
<Caret Line="30" Column="22" TopLine="11"/>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="41" Column="46" TopLine="31"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="../../../cogat/Units/CogatUnits/compfiles.pas"/>
|
||||
<Caret Line="31" Column="23" TopLine="11"/>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="463" Column="34" TopLine="448"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="439" Column="74" TopLine="11"/>
|
||||
<Caret Line="34" Column="12" TopLine="30"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="43" Column="20" TopLine="28"/>
|
||||
<Caret Line="46" Column="19" TopLine="31"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="55" Column="24" TopLine="40"/>
|
||||
<Caret Line="72" Column="19" TopLine="50"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="36" Column="27" TopLine="31"/>
|
||||
<Caret Line="37" Column="11" TopLine="21"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="41" Column="46" TopLine="31"/>
|
||||
<Caret Line="38" Column="96" TopLine="28"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="463" Column="34" TopLine="448"/>
|
||||
<Caret Line="417" Column="42" TopLine="402"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="34" Column="12" TopLine="30"/>
|
||||
<Caret Line="449" Column="1" TopLine="431"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="46" Column="19" TopLine="31"/>
|
||||
<Filename Value="../../Units/MMLCore/client.pas"/>
|
||||
<Caret Line="37" Column="18" TopLine="12"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="72" Column="19" TopLine="50"/>
|
||||
<Caret Line="20" Column="29" TopLine="11"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="37" Column="11" TopLine="21"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="211" Column="1" TopLine="182"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="38" Column="96" TopLine="28"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="154" Column="49" TopLine="140"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="417" Column="42" TopLine="402"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="155" Column="8" TopLine="140"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="449" Column="1" TopLine="431"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="160" Column="23" TopLine="145"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="../../Units/MMLCore/client.pas"/>
|
||||
<Caret Line="37" Column="18" TopLine="12"/>
|
||||
<Filename Value="../../../cogat/Units/CogatUnits/compfiles.pas"/>
|
||||
<Caret Line="8" Column="18" TopLine="1"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="20" Column="29" TopLine="11"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="29" Column="14" TopLine="11"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="161" Column="39" TopLine="146"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="29" Column="20" TopLine="16"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="51" Column="14" TopLine="46"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="54" Column="17" TopLine="48"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
@ -1,3 +1,5 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TForm1','FORMDATA',[
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'@'#1#6'Height'#3#15#2#3'Top'#3#238#0#5'Wi'
|
||||
+'dth'#3#11#3#13'ActiveControl'#7#7'Button1'#7'Caption'#6#5'Form1'#12'ClientH'
|
||||
|
@ -42,6 +42,18 @@ type
|
||||
end;
|
||||
|
||||
procedure TMyThread.Execute;
|
||||
Const
|
||||
TestPath = './test';
|
||||
|
||||
fsFromBeginning = 0; // offset must be pos or 0
|
||||
fsFromCurrent = 1; // offset pos or neg
|
||||
fsFromEnd = 2; // offset only neg or 0
|
||||
|
||||
// put somewhese else
|
||||
DirectorySeperator = '/';
|
||||
DS = '/';
|
||||
ExeExt = '';
|
||||
|
||||
Var
|
||||
Client: TClient;
|
||||
w,h, x, y, xx, yy, i:integer;
|
||||
@ -50,6 +62,10 @@ Var
|
||||
arr: Array Of Integer;
|
||||
LoopY,LoopX : integer;
|
||||
|
||||
s, s2: string;
|
||||
myFile, myFile2: Integer;
|
||||
|
||||
|
||||
begin
|
||||
while (not Terminated) do
|
||||
begin
|
||||
@ -137,6 +153,67 @@ begin
|
||||
writeln('Right mouse is down!');
|
||||
if Client.MInput.IsMouseButtonDown(mouse_Middle) then
|
||||
writeln('Middle mouse is down!');
|
||||
|
||||
|
||||
with Client.MFiles do
|
||||
begin
|
||||
s := ExtractFileDir(Application.ExeName);
|
||||
Writeln('Our current path is: ' + s);
|
||||
If DirectoryExists(s) Then
|
||||
writeln('Directory ' + s + ' exists.');
|
||||
|
||||
If FileExists(s + DirectorySeperator + 'Cogat' + ExeExt) Then
|
||||
writeln('We exist!');
|
||||
|
||||
myFile := CreateFile(TestPath);
|
||||
WriteFileString(myFile, 'wat');
|
||||
WriteFileString(myFile, 'watnumber2');
|
||||
CloseFile(myFile);
|
||||
|
||||
myFile := OpenFile(TestPath, False);
|
||||
ReadFileString(myFile, s2, 2);
|
||||
writeln('s2: ' + s2);
|
||||
CloseFile(myFile);
|
||||
|
||||
myFile := CreateFile(TestPath + '2');
|
||||
WriteFileString(myFile, 'wat222');
|
||||
|
||||
CloseFile(myFile);
|
||||
|
||||
// TestPath now contains; 'watwatnumber2'. We will make it write 'number',
|
||||
// and then 2.
|
||||
myFile := OpenFile(TestPath, False);
|
||||
SetFileCharPointer(myFile, 6, fsFromBeginning);
|
||||
ReadFileString(myFile, s2, 6);
|
||||
writeln('s2: ' + s2);
|
||||
s2 := '';
|
||||
|
||||
SetFileCharPointer(myFile, -1, fsFromEnd);
|
||||
ReadFileString(myFile, s2, 1);
|
||||
writeln('s2: ' + s2);
|
||||
CloseFile(myFile);
|
||||
// myFile2 should be -1.
|
||||
myFile := RewriteFile(TestPath, False);
|
||||
myFile2 := RewriteFile(TestPath, False);
|
||||
writeln(inttostr(myFile) + ' : ' + inttostr(myFile2));
|
||||
|
||||
// myFile2 should be -1.
|
||||
myFile2 := OpenFile(TestPath, False);
|
||||
writeln(inttostr(myFile) + ' : ' + inttostr(myFile2));
|
||||
|
||||
// Now, we will test EndOfFile, and FileSize.
|
||||
|
||||
While Not EndOfFile(myFile) Do
|
||||
Begin
|
||||
ReadFileString(myFile, s2, 1);
|
||||
Writeln(s2);
|
||||
End;
|
||||
|
||||
CloseFile(myFile);
|
||||
writeln('wat');
|
||||
|
||||
|
||||
end;
|
||||
Client.Destroy;
|
||||
writeln('Test completed successfully');
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user