Ignore:
Timestamp:
Nov 25, 2012, 5:04:36 PM (12 years ago)
Author:
chronos
Message:
  • Added: Export results to text file in mediawiki format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/UMainForm.pas

    r451 r453  
    99  Graphics, Dialogs, ComCtrls, ExtCtrls, StdCtrls, DateUtils, UPlatform,
    1010  LCLType, IntfGraphics, fpImage, Math, GraphType, Contnrs, LclIntf, Spin,
    11   UFastBitmap, UDrawMethod;
     11  ActnList, Menus, StdActns, UFastBitmap, UDrawMethod;
    1212
    1313const
     
    1919
    2020  TMainForm = class(TForm)
     21    Action1: TAction;
     22    AExportAsWikiText: TAction;
     23    ActionList1: TActionList;
    2124    ButtonBenchmark: TButton;
    2225    ButtonSingleTest: TButton;
     
    2528    CheckBoxDoubleBuffered: TCheckBox;
    2629    CheckBoxEraseBackground: TCheckBox;
     30    FileExit1: TFileExit;
    2731    FloatSpinEdit1: TFloatSpinEdit;
    2832    Label1: TLabel;
     
    3135    Label4: TLabel;
    3236    ListViewMethods: TListView;
     37    MainMenu1: TMainMenu;
    3338    Memo1: TMemo;
     39    MenuItem1: TMenuItem;
     40    MenuItem2: TMenuItem;
     41    MenuItem3: TMenuItem;
    3442    PageControl1: TPageControl;
    3543    Panel1: TPanel;
     44    SaveDialog1: TSaveDialog;
    3645    SpinEditHeight: TSpinEdit;
    3746    SpinEditWidth: TSpinEdit;
     
    4251    TabSheet2: TTabSheet;
    4352    TimerUpdateList: TTimer;
     53    procedure AExportAsWikiTextExecute(Sender: TObject);
    4454    procedure ButtonBenchmarkClick(Sender: TObject);
    4555    procedure ButtonSingleTestClick(Sender: TObject);
     
    187197end;
    188198
     199procedure TMainForm.AExportAsWikiTextExecute(Sender: TObject);
     200var
     201  Output: TStringList;
     202  I: Integer;
     203  Duration: Real;
     204begin
     205  SaveDialog1.FileName := 'GraphicsTest results.txt';
     206  if SaveDialog1.Execute then
     207  try
     208    Output := TStringList.Create;
     209    Output.Add('{| class="wikitable sortable"');
     210    Output.Add('|-');
     211    Output.Add('! Method !! FPS !! Frame duration [ms]');
     212    for I := 0 to DrawMethods.Count - 1 do
     213    with TDrawMethod(DrawMethods[I]) do begin
     214      Output.Add('|-');
     215      if FPS <> 0 then Duration := 1 / FPS * 1000
     216        else Duration := 0;
     217      Output.Add('|' + Caption + ' || ' + FloatToStr(RoundTo(FPS, -1)) +
     218        ' || ' + FloatToStr(RoundTo(Duration, -1)));
     219    end;
     220    Output.Add('|}');
     221    Output.SaveToFile(SaveDialog1.FileName);
     222  finally
     223    Output.Free;
     224  end;
     225end;
     226
    189227procedure TMainForm.ButtonStopClick(Sender: TObject);
    190228begin
Note: See TracChangeset for help on using the changeset viewer.