Turbopower_ipro: Extend test application to accept html files with images.

This commit is contained in:
wp_xyz 2022-05-31 17:09:27 +02:00
parent 8aee0d78a3
commit 420416181f
3 changed files with 29 additions and 9 deletions

View File

@ -25,7 +25,7 @@
(* Part of Ipbroker.pas allowing to use local files Armin <diehl@nordrhein.de> Jun 2006 *)
unit Ipfilebroker;
unit IpFileBroker;
{$I ipdefine.inc}

View File

@ -95,6 +95,7 @@ object TestForm: TTestForm
Width = 622
Align = alClient
BorderSpacing.Top = 3
DataProvider = IpHtmlDataProvider
FixedTypeface = 'Courier New'
DefaultTypeFace = 'default'
DefaultFontSize = 12
@ -667,7 +668,7 @@ object TestForm: TTestForm
AnchorSideTop.Side = asrCenter
Left = 6
Height = 25
Top = 0
Top = 1
Width = 75
BorderSpacing.Left = 6
Caption = 'Render'
@ -681,7 +682,7 @@ object TestForm: TTestForm
AnchorSideTop.Side = asrCenter
Left = 87
Height = 25
Top = 0
Top = 1
Width = 113
AutoSize = True
BorderSpacing.Left = 6
@ -696,7 +697,7 @@ object TestForm: TTestForm
AnchorSideTop.Side = asrCenter
Left = 500
Height = 25
Top = 0
Top = 1
Width = 137
AutoSize = True
BorderSpacing.Left = 24
@ -707,10 +708,10 @@ object TestForm: TTestForm
object btnPassed: TBitBtn
AnchorSideLeft.Control = btnShowInBrowser
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnLoadHtmlFromFile
AnchorSideTop.Control = Panel3
Left = 224
Height = 26
Top = -1
Top = 0
Width = 82
AutoSize = True
BorderSpacing.Left = 24
@ -725,7 +726,7 @@ object TestForm: TTestForm
object btnFailed: TBitBtn
AnchorSideLeft.Control = btnPassed
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnLoadHtmlFromFile
AnchorSideTop.Control = Panel3
AnchorSideRight.Side = asrBottom
Left = 309
Height = 26
@ -746,7 +747,7 @@ object TestForm: TTestForm
AnchorSideTop.Side = asrCenter
Left = 389
Height = 25
Top = 0
Top = 1
Width = 87
AutoSize = True
BorderSpacing.Left = 3
@ -813,4 +814,9 @@ object TestForm: TTestForm
EF52FFE12E6960A0025FC697C5E2
}
end
object IpHtmlDataProvider: TIpHtmlDataProvider
OnGetImage = IpHtmlDataProviderGetImage
Left = 384
Top = 488
end
end

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
EditBtn, ComCtrls, Buttons, SynEdit, SynHighlighterHTML, IpHtml;
EditBtn, ComCtrls, Buttons, SynEdit, SynHighlighterHTML, IpHtml, Ipfilebroker;
type
@ -21,6 +21,7 @@ type
btnSaveResults: TButton;
FileNameEdit1: TFileNameEdit;
ImageList1: TImageList;
IpHtmlDataProvider: TIpHtmlDataProvider;
IpHtmlPanel1: TIpHtmlPanel;
Label1: TLabel;
Memo1: TMemo;
@ -40,6 +41,8 @@ type
procedure btnShowInBrowserClick(Sender: TObject);
procedure btnLoadHtmlFromFileClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure IpHtmlDataProviderGetImage(Sender: TIpHtmlNode;
const URL: string; var Picture: TPicture);
procedure SynEdit1Change(Sender: TObject);
procedure TestTreeDeletion(Sender: TObject; Node: TTreeNode);
procedure TestTreeGetSelectedIndex(Sender: TObject; Node: TTreeNode);
@ -98,6 +101,16 @@ begin
PopulateTests;
end;
procedure TTestForm.IpHtmlDataProviderGetImage(Sender: TIpHtmlNode;
const URL: string; var Picture: TPicture);
begin
if FileExists(URL) then
begin
Picture := TPicture.Create;
Picture.LoadFromFile(URL);
end;
end;
procedure TTestForm.SynEdit1Change(Sender: TObject);
begin
btnPassed.Enabled := false;
@ -233,6 +246,7 @@ begin
AddTest(node1, ColWidth_100perc_title, ColWidth_100perc_descr, ColWidth_100perc_html);
AddTest(node1, ColWidth_30perc_70perc_title, ColWidth_30perc_70perc_descr, ColWidth_30perc_70perc_html);
AddTest(node1, ColWidth_200px_total100perc_title, ColWidth_200px_total100perc_descr, ColWidth_200px_total100perc_html);
AddTest(node1, ColWidth_colspan_fixed_total100perc_title, ColWidth_colspan_fixed_total100perc_descr, ColWidth_colspan_fixed_total100perc_html);
AddTest(node1, ColGroup_ColWidth_200px_total100perc_title, ColGroup_ColWidth_200px_total100perc_descr, ColGroup_ColWidth_200px_total100perc_html);
node1.Expanded := true;
node.Expanded := true;