Ultimate Compression Toolkit For Delphi And C++ Builder Developers

procedure TAbZipperTests.CreateAndTestBasicZipFile;

var

  ExtractDir, TestFileName : string;

  AbUnZip : TAbUnZipper;

begin

  // Test with Setting BaseDirectory and not specifying AutoSave

  TestFileName := TestTempDir + ‘basic.zip’;

  if FileExists(TestFileName) then

    DeleteFile(TestFileName);

  Component.FileName := TestFileName;

  Component.BaseDirectory := TestFileDir;

  Component.AddFiles(‘*.*’,faAnyFile);

  Component.Save;

  Component.FileName := ;

  CheckFileExists(TestFileName);

 

  AbUnZip := TAbUnZipper.Create(nil);

  try

    AbUnZip.FileName := TestFileName;

    // Clean out old Directory and create a new one.

    Extractdir := TestTempDir + ‘extracttest’;

    if DirectoryExists(ExtractDir) then

      DelTree(ExtractDir);

    CreateDir(ExtractDir);

    // Extract Files.

    AbUnZip.BaseDirectory := ExtractDir;

    AbUnZip.ExtractFiles(‘*.*’);

    // Compare Extracted Files

    CheckDirMatch(TestFileDir,ExtractDir);

  finally

    AbUnZip.Free;

  end;

  DeleteFile(TestFileName);

end;