* Patch from Mantis #22105 by Lacak2 that improves oldvalue testing.

git-svn-id: trunk@21365 -
This commit is contained in:
marco 2012-05-23 06:49:49 +00:00
parent 283b37139f
commit 9e5316afd1

View File

@ -612,13 +612,28 @@ begin
end; end;
procedure TTestCursorDBBasics.TestOldValue; procedure TTestCursorDBBasics.TestOldValue;
var v : variant;
bufds: TDataset;
begin begin
bufds := DBConnector.GetNDataset(0) as TDataset; with DBConnector.GetNDataset(1) as TDataset do
bufds.Open; begin;
bufds.InsertRecord([0,'name']); Open;
v := VarToStr(bufds.fields[1].OldValue); First;
CheckEquals('1', VarToStr(Fields[0].OldValue), 'Original value'); // unmodified original value
CheckTrue(UpdateStatus=usUnmodified, 'Unmodified');
Edit;
Fields[0].AsInteger := -1;
CheckEquals('1', VarToStr(Fields[0].OldValue), 'Editing'); // dsEdit, there is no update-buffer yet
Post;
CheckEquals('1', VarToStr(Fields[0].OldValue), 'Edited'); // there is already update-buffer
CheckTrue(UpdateStatus=usModified, 'Modified');
Append;
Fields[0].AsInteger := -2;
CheckTrue(VarIsNull(Fields[0].OldValue), 'Inserting'); // dsInsert, there is no update-buffer yet
Post;
CheckTrue(VarIsNull(Fields[0].OldValue), 'Inserted'); // there is already update-buffer
CheckTrue(UpdateStatus=usInserted, 'Inserted');
end;
end; end;
procedure TTestDBBasics.TestCanModifySpecialFields; procedure TTestDBBasics.TestCanModifySpecialFields;