summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2025-01-20 19:15:55 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2025-01-20 19:15:55 +1300
commit67a43ef89ba41ac32b86cda7396c16fffaf691b3 (patch)
treea4c9472f3e9522f94ce72fe3fc09107dc6cb1de3
parent096ec211833d663b3e8976452c3293756a7ededf (diff)
Adjuster test and project file reorg
-rw-r--r--proj/adjuster_test.gpr28
-rw-r--r--proj/compare.gpr28
-rw-r--r--proj/dirlist.gpr28
-rw-r--r--proj/page_formats.gpr28
-rw-r--r--proj/shared.gpr13
-rw-r--r--test.gpr32
-rw-r--r--test/adjuster_test.adb79
-rw-r--r--tests.gpr13
-rw-r--r--tools.gpr (renamed from tool.gpr)4
9 files changed, 219 insertions, 34 deletions
diff --git a/proj/adjuster_test.gpr b/proj/adjuster_test.gpr
new file mode 100644
index 0000000..4197dd5
--- /dev/null
+++ b/proj/adjuster_test.gpr
@@ -0,0 +1,28 @@
+
+
+with
+
+ "fltkada",
+ "shared";
+
+
+project Adjuster_Test is
+
+
+ for Languages use ("Ada");
+
+ for Source_Dirs use ("../test/**");
+ for Object_Dir use "../obj";
+ for Exec_Dir use "../bin";
+ for Main use ("adjuster_test.adb");
+
+ package Builder is
+ for Executable ("adjuster_test.adb") use "adjuster";
+ end Builder;
+
+ package Compiler renames Shared.Compiler;
+
+
+end Adjuster_Test;
+
+
diff --git a/proj/compare.gpr b/proj/compare.gpr
new file mode 100644
index 0000000..fc46807
--- /dev/null
+++ b/proj/compare.gpr
@@ -0,0 +1,28 @@
+
+
+with
+
+ "fltkada",
+ "shared";
+
+
+project Compare is
+
+
+ for Languages use ("Ada");
+
+ for Source_Dirs use ("../test/**");
+ for Object_Dir use "../obj";
+ for Exec_Dir use "../bin";
+ for Main use ("compare.adb");
+
+ package Builder is
+ for Executable ("compare.adb") use "compare";
+ end Builder;
+
+ package Compiler renames Shared.Compiler;
+
+
+end Compare;
+
+
diff --git a/proj/dirlist.gpr b/proj/dirlist.gpr
new file mode 100644
index 0000000..ed096f2
--- /dev/null
+++ b/proj/dirlist.gpr
@@ -0,0 +1,28 @@
+
+
+with
+
+ "fltkada",
+ "shared";
+
+
+project Dirlist is
+
+
+ for Languages use ("Ada");
+
+ for Source_Dirs use ("../test/**");
+ for Object_Dir use "../obj";
+ for Exec_Dir use "../bin";
+ for Main use ("dirlist.adb");
+
+ package Builder is
+ for Executable ("dirlist.adb") use "dirlist";
+ end Builder;
+
+ package Compiler renames Shared.Compiler;
+
+
+end Dirlist;
+
+
diff --git a/proj/page_formats.gpr b/proj/page_formats.gpr
new file mode 100644
index 0000000..0e0ebfe
--- /dev/null
+++ b/proj/page_formats.gpr
@@ -0,0 +1,28 @@
+
+
+with
+
+ "fltkada",
+ "shared";
+
+
+project Page_Formats is
+
+
+ for Languages use ("Ada");
+
+ for Source_Dirs use ("../test/**");
+ for Object_Dir use "../obj";
+ for Exec_Dir use "../bin";
+ for Main use ("page_formats.adb");
+
+ package Builder is
+ for Executable ("page_formats.adb") use "page_formats";
+ end Builder;
+
+ package Compiler renames Shared.Compiler;
+
+
+end Page_Formats;
+
+
diff --git a/proj/shared.gpr b/proj/shared.gpr
new file mode 100644
index 0000000..d16fc1a
--- /dev/null
+++ b/proj/shared.gpr
@@ -0,0 +1,13 @@
+
+
+abstract project Shared is
+
+
+ package Compiler is
+ for Default_Switches ("Ada") use ("-gnaty4aAbcefhiklM100nprt");
+ end Compiler;
+
+
+end Shared;
+
+
diff --git a/test.gpr b/test.gpr
deleted file mode 100644
index 2901be0..0000000
--- a/test.gpr
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-with "fltkada";
-
-
-project Test is
-
-
- for Languages use ("Ada");
-
-
- for Source_Dirs use ("test");
- for Object_Dir use "obj";
- for Exec_Dir use "bin";
- for Main use ("compare.adb", "dirlist.adb", "page_formats.adb");
-
-
- package Builder is
- for Executable ("compare.adb") use "compare";
- for Executable ("dirlist.adb") use "dirlist";
- for Executable ("page_formats.adb") use "page_formats";
- end Builder;
-
-
- package Compiler is
- for Default_Switches("Ada") use ("-gnaty4aAbcefhiklM100nprt");
- end Compiler;
-
-
-end Test;
-
-
diff --git a/test/adjuster_test.adb b/test/adjuster_test.adb
new file mode 100644
index 0000000..6b05b96
--- /dev/null
+++ b/test/adjuster_test.adb
@@ -0,0 +1,79 @@
+
+
+-- Programmed by Jedidiah Barber
+-- Released into the public domain
+
+
+-- Adjuster test program functionality duplicated in Ada
+
+
+with
+
+ Ada.Command_Line,
+ FLTK.Widgets.Boxes,
+ FLTK.Widgets.Groups.Windows.Double,
+ FLTK.Widgets.Valuators.Adjusters;
+
+
+function Adjuster_Test
+ return Integer
+is
+
+
+ package ACom renames Ada.Command_Line;
+ package BX renames FLTK.Widgets.Boxes;
+ package DW renames FLTK.Widgets.Groups.Windows.Double;
+ package AD renames FLTK.Widgets.Valuators.Adjusters;
+
+
+ type My_Adjuster is new AD.Adjuster with record
+ Rect : access BX.Box;
+ end record;
+
+
+ procedure Adjust_Callback
+ (This : in out FLTK.Widgets.Widget'Class)
+ is
+ Just : My_Adjuster renames My_Adjuster (This);
+ begin
+ Just.Rect.Set_Label (Just.Format);
+ Just.Rect.Redraw;
+ end Adjust_Callback;
+
+
+ The_Window : DW.Double_Window :=
+ DW.Forge.Create (320, 100, ACom.Command_Name);
+
+ Box_One : aliased BX.Box :=
+ BX.Forge.Create (The_Window, FLTK.Down_Box, 20, 30, 80, 25);
+ Just_One : My_Adjuster :=
+ (AD.Forge.Create (The_Window, 20 + 80, 30, 3 * 25, 25)
+ with Rect => Box_One'Access);
+
+ Box_Two : aliased BX.Box :=
+ BX.Forge.Create (The_Window, FLTK.Down_Box, 20 + 80 + 4 * 25, 30, 80, 25);
+ Just_Two : My_Adjuster :=
+ (AD.Forge.Create (The_Window, Box_Two.Get_X + Box_Two.Get_W, 10, 25, 3 * 25)
+ with Rect => Box_Two'Access);
+
+
+begin
+
+
+ Box_One.Set_Background_Color (FLTK.White_Color);
+ Just_One.Set_Callback (Adjust_Callback'Unrestricted_Access);
+ Just_One.Do_Callback;
+
+ Box_Two.Set_Background_Color (FLTK.White_Color);
+ Just_Two.Set_Callback (Adjust_Callback'Unrestricted_Access);
+ Just_Two.Do_Callback;
+
+ The_Window.Set_Resizable (The_Window);
+ The_Window.Show_With_Args;
+
+ return FLTK.Run;
+
+
+end Adjuster_Test;
+
+
diff --git a/tests.gpr b/tests.gpr
new file mode 100644
index 0000000..deb6523
--- /dev/null
+++ b/tests.gpr
@@ -0,0 +1,13 @@
+
+
+aggregate project Tests is
+
+ for Project_Files use
+ ("proj/adjuster_test.gpr",
+ "proj/compare.gpr",
+ "proj/dirlist.gpr",
+ "proj/page_formats.gpr");
+
+end Tests;
+
+
diff --git a/tool.gpr b/tools.gpr
index 7f41fcb..faa4a95 100644
--- a/tool.gpr
+++ b/tools.gpr
@@ -1,6 +1,6 @@
-project Tool is
+project Tools is
for Languages use ("Ada");
@@ -22,6 +22,6 @@ project Tool is
end Compiler;
-end Tool;
+end Tools;