Posts

Showing posts from September, 2018

Applying Theme or Style to a Delphi Application

Image
Delphi provides functionality to apply Themes and Styles at runtime to a Delphi application. Once we apply a Style to application it will apply to all default VCL components provided by Delphi IDE only. So note that it may not be applied to some third-party components. In this blog let’s see how to apply Styles to Delphi application at RunTime. So let’s first create a Delphi Project by selecting File -> New -> VCL Form Application and save the project. Save the default form as MainForm.  Now to apply styles and themes first we have to choose the themes we want to apply in our application at runtime. So select Project -> Options -> Appearance -> Then select Custom Styles as per required. Project file will be look like as follow and here we have added 'Amakrits' style as default style on application loading. program Project1; uses   Vcl.Forms,   FormMain in 'FormMain.pas' {MainForm},   Vcl.Themes,   Vcl.Styles; {$R *.res} begin   App

Introducing DUnitX - A new Unit Test Framework for Delphi

Image
Since I wrote an article about Delphi unit testing I also came thorough new DUnitX test framework. And I found that it nicely uses the possibilities of newer Delphi to make work easier. Of course, We can also use old unit test framework DUnit also but we cannot test new Language/RTL features like Generics, Attributes, Anonymous methods etc. DUnitX Overview DUnitX is an open-source unit test framework based on the NUnit test framework, including some ideas from XUnit as well. The RAD Studio integration of DUnitX framework enables you to develop and execute tests against Win32, Win 64 and MacOSX in Delphi. It is designed to work with Delphi 2010 or later, it makes use of language/RTL features that are not available in older versions of Delphi. The DUnitX testing framework provides its own set of methods for testing conditions. You can use the provided methods to test a large number of conditions. These methods represent common assertions although you can also create your own custom

Unit Testing in Delphi by using DUnit

Image
Unit Test Introduction Unit testing defines that each unit test sends a specific input to a method and verifies that the method returns the expected value, or takes the expected action. Unit tests prove that the code you are testing does in fact do what you expect it to do. For more about Unit Testing please visit http://www.extremeprogramming.org/rules/unittests.html The Value of Unit Tests One of the most valuable benefits of unit tests is that they give you confidence that your code works as you expect it to work. Unit tests give you the confidence to do long-term development because with unit tests in place, you know that your foundation code is dependable. Unit tests give you the confidence to refactor your code to make it cleaner and more efficient. Unit tests also save you time because unit tests help prevent regressions from being introduced and released. Once a bug is found, you can write  a unit test for it, you can fix the bug, and the bug can never make it to produ