Jump to content

Uwe Raabe

Members
  • Content Count

    2558
  • Joined

  • Last visited

  • Days Won

    150

Posts posted by Uwe Raabe


  1. When I run that code in a vanilla VCL Forms Application in a ButtonClick event - nothing happens.

     

    Either commenting out the last line or inserting a Sleep(100) before makes the ShowMessage appear.

     

    The problem here is that the anon method captures the variable and not the value. Thus setting the value of TerminateProc to nil has influence of what is passed to TThread.Queue. It heavily depends on the timing of whether the Queue call comes first or the setting to nil.

     

    Seems not to be a valid solution to avoid the leak.

    • Like 1
    • Thanks 1

  2. Another approach would be to declare a TMessage descendant that the frame (and probably also any form) subscribes to during creation and unsubscribes from on destruction. Then you can broadcast this message when the language changes.

    uses
      System.Messaging;
      
    type
      TLanguageMessage = class(TMessage<string>);
    
    ...
    
    procedure TMyFrame.HandleLanguageMessage(const Sender: TObject; const M: TMessage);
    begin
      var msg := M as TLanguageMessage;
      SwitchToLanguage(M.Value);
    end;
    
    ... TMyFrame.Create
      FLanguageMessageID := TMessageManager.DefaultManager.SubscribeToMessage(TLanguageMessage, HandleLanguageMessage);
      
    ... TMyFrame.Destroy
      TMessageManager.DefaultManager.Unsubscribe(TLanguageMessage, FLanguageMessageID, True);
      
    ... NotifyLanguage
      TMessageManager.DefaultManager.SendMessage(nil, TLanguageMessage.Create('DE'));
    
      
      
        

     

    • Like 2

  3. 3 hours ago, Dave Novo said:

    I had expected that the Guirunner would save the selected tests prior to the test run started. 

    You can always tweak the source of DUnitX.Loggers.GUI.VCL.pas to your needs. Currently the code for saving is located in FormClose. Besides extracting it to a dedicated method, it can be inserted at the beginning of RunExecute.

     

    In Contributing.md you find instructions to make your enhancements available for all.

    • Like 2

  4. 1 hour ago, Gord P said:

    Where as what I want to see is:

    Well, the FormatFloat implementation has the E15 hardcoded and even documented:

    Quote

    If the section for positive values is empty or if the entire format string is empty, the value is formatted using general floating-point formatting with 15 significant digits, corresponding to a call to FloatToStrF with the ffGeneral format. General floating-point formatting is also used if the value has more than 18 digits to the left of the decimal point and the format string does not specify scientific notation.

     

    • Thanks 1

  5. 45 minutes ago, Gord P said:

    Just tried it but it didn't work. Doesn't change it scientific notation when the numbers are really large.  

    Well, FormatFloat acts as expected;

      for var I := 1 to 10 do
        Writeln(FormatFloat('', I/10));
      for var I := 1 to 10 do
        Writeln(FormatFloat('', I*Power10(1, 14)));

    Output:

    Quote

    0,1
    0,2
    0,3
    0,4
    0,5
    0,6
    0,7
    0,8
    0,9
    1
    100000000000000
    200000000000000
    300000000000000
    400000000000000
    500000000000000
    600000000000000
    700000000000000
    800000000000000
    900000000000000
    1E15

     


  6. 7 minutes ago, Anders Melander said:

    And as far as I remember you don't even need a license.

    At least that is how I read the license:

    Quote

    2.4. Command Line Compiler. Licensee may install the command line compiler on a separate computer from the Product itself, provided that the sole purpose of doing so is to allow that computer to perform unattended building of applications.

     


  7. When you create a new test project and add one of the units for testing, the project won't compile unless all dependent units can be found. So you need to add the search paths accordingly.

     

    There is nothing wrong with having dependencies in the first place. It just makes picking only one unit from the project into another one a bit difficult. Nevertheless, it is always worth thinking about minimizing dependencies, but not only because of simpler testing.

    3 hours ago, Brian Evans said:

    Is the "not" accurate? Makes no sense at all. 

    The not seems appropriate, but the term project to be tested should be changed to test project.

×