[haiku-commits] r40299 - haiku/trunk/src/tests/libs/alm

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 27 Jan 2011 22:50:43 +0100 (CET)

Author: czeidler
Date: 2011-01-27 22:50:42 +0100 (Thu, 27 Jan 2011)
New Revision: 40299
Changeset: http://dev.haiku-os.org/changeset/40299

Added:
   haiku/trunk/src/tests/libs/alm/ComplexButtons.cpp
   haiku/trunk/src/tests/libs/alm/ThreeButtons.cpp
Modified:
   haiku/trunk/src/tests/libs/alm/Areas.cpp
   haiku/trunk/src/tests/libs/alm/Jamfile
   haiku/trunk/src/tests/libs/alm/TableDemo.cpp
Log:
Add two more test, cleanup.



Modified: haiku/trunk/src/tests/libs/alm/Areas.cpp
===================================================================
--- haiku/trunk/src/tests/libs/alm/Areas.cpp    2011-01-26 22:58:47 UTC (rev 
40298)
+++ haiku/trunk/src/tests/libs/alm/Areas.cpp    2011-01-27 21:50:42 UTC (rev 
40299)
@@ -47,7 +47,12 @@
                layout->AddView(button4, layout->Left(), y3, layout->Right(),
                        layout->Bottom());
                button4->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT,
-                       B_ALIGN_BOTTOM));       
+                       B_ALIGN_BOTTOM));
+
+               // test size limits
+               BSize min = layout->MinSize();
+               BSize max = layout->MaxSize();
+               SetSizeLimits(min.Width(), max.Width(), min.Height(), 
max.Height());
        }
        
 private:

Added: haiku/trunk/src/tests/libs/alm/ComplexButtons.cpp
===================================================================
--- haiku/trunk/src/tests/libs/alm/ComplexButtons.cpp                           
(rev 0)
+++ haiku/trunk/src/tests/libs/alm/ComplexButtons.cpp   2011-01-27 21:50:42 UTC 
(rev 40299)
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2010, Clemens Zeidler <haiku@xxxxxxxxxxxxxxxxxx>
+ * Distributed under the terms of the MIT License.
+ */
+
+#include <stdio.h>
+
+#include <Application.h>
+#include <Button.h>
+#include <List.h>
+#include <Window.h>
+
+// include this for ALM
+#include "ALMLayout.h"
+
+
+class ComplexButtonsWindow : public BWindow {
+public:
+       ComplexButtonsWindow(BRect frame) 
+               :
+               BWindow(frame, "ALM Complex Buttons", B_TITLED_WINDOW,
+                       B_QUIT_ON_WINDOW_CLOSE)
+       {
+               BButton* button1 = new BButton("A");
+               BButton* button2 = new BButton("B");
+               BButton* button3 = new BButton("GHIJ");
+
+               BButton* button4 = new BButton("abcdefghijklmnop");
+               BButton* button5 = new BButton("Foo");
+
+               const int32 kOffset = 80;
+
+               button1->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
+                       B_ALIGN_USE_FULL_HEIGHT));
+               button1->SetExplicitMaxSize(BSize(500, 500));
+               button1->SetExplicitPreferredSize(BSize(10 + kOffset, 
B_SIZE_UNSET));
+
+               button2->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
+                       B_ALIGN_USE_FULL_HEIGHT));
+               button2->SetExplicitMaxSize(BSize(500, 500));
+               button2->SetExplicitPreferredSize(BSize(10 + kOffset, 
B_SIZE_UNSET));
+
+               button3->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
+                       B_ALIGN_USE_FULL_HEIGHT));
+               button3->SetExplicitMaxSize(BSize(500, 500));
+               button3->SetExplicitPreferredSize(BSize(40 + kOffset, 
B_SIZE_UNSET));
+
+               button4->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
+                       B_ALIGN_USE_FULL_HEIGHT));
+               button4->SetExplicitMaxSize(BSize(500, 500));
+               button4->SetExplicitPreferredSize(BSize(160 + kOffset, 
B_SIZE_UNSET));
+               
+               button5->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
+                       B_ALIGN_USE_FULL_HEIGHT));
+               button5->SetExplicitMaxSize(BSize(500, 500));
+               button5->SetExplicitPreferredSize(BSize(30 + kOffset, 
B_SIZE_UNSET));
+
+               // create a new BALMLayout and use  it for this window
+               fLayout = new BALMLayout();
+               SetLayout(fLayout);
+
+               fLayout->AddView(button1, fLayout->Left(), fLayout->Top(), NULL,
+                       NULL);
+               fLayout->AddViewToRight(button2);
+               fLayout->AddViewToRight(button3, fLayout->Right());
+               fLayout->AddView(button4, fLayout->Left(), 
fLayout->BottomOf(button1),
+                       NULL, fLayout->Bottom());
+               fLayout->AddViewToRight(button5, fLayout->Right());
+
+               // test size limits
+               BSize min = fLayout->MinSize();
+               BSize max = fLayout->MaxSize();
+               SetSizeLimits(min.Width(), max.Width(), min.Height(), 
max.Height());
+       }
+       
+private:
+       BALMLayout* fLayout;
+
+};
+
+
+int
+main()
+{
+       BApplication app("application/x-vnd.haiku.ComplexButtons");
+
+       BRect frameRect;
+       frameRect.Set(100, 100, 600, 300);
+       ComplexButtonsWindow* window = new ComplexButtonsWindow(frameRect);
+       window->Show();
+
+       app.Run();
+       return 0;
+}

Modified: haiku/trunk/src/tests/libs/alm/Jamfile
===================================================================
--- haiku/trunk/src/tests/libs/alm/Jamfile      2011-01-26 22:58:47 UTC (rev 
40298)
+++ haiku/trunk/src/tests/libs/alm/Jamfile      2011-01-27 21:50:42 UTC (rev 
40299)
@@ -39,3 +39,15 @@
        :
        be liblpsolve55.so be libalm.so $(TARGET_LIBSTDC++)
 ;
+
+Application ALMThreeButtons :
+       ThreeButtons.cpp
+       :
+       be liblpsolve55.so be libalm.so $(TARGET_LIBSTDC++)
+;
+
+Application ALMComplexButtons :
+       ComplexButtons.cpp
+       :
+       be liblpsolve55.so be libalm.so $(TARGET_LIBSTDC++)
+;

Modified: haiku/trunk/src/tests/libs/alm/TableDemo.cpp
===================================================================
--- haiku/trunk/src/tests/libs/alm/TableDemo.cpp        2011-01-26 22:58:47 UTC 
(rev 40298)
+++ haiku/trunk/src/tests/libs/alm/TableDemo.cpp        2011-01-27 21:50:42 UTC 
(rev 40299)
@@ -5,6 +5,7 @@
  * Distributed under the terms of the MIT License.
  */
 
+
 #include <Application.h>
 #include <File.h>
 #include <Button.h>
@@ -21,14 +22,14 @@
                // create a new BALMLayout and use  it for this window
                BALMLayout* layout = new BALMLayout();
                SetLayout(layout);
-               
+
                Column* c1 = layout->AddColumn(layout->Left(), layout->Right());
                Row* r1 = layout->AddRow(layout->Top(), NULL);
                Row* r3 = layout->AddRow(NULL, layout->Bottom());
                r1->SetNext(r3);
                Row* r2 = layout->AddRow();
                r2->InsertAfter(r1);
-               
+
                BButton* b1 = new BButton("A1");
                layout->AddView(b1, r1, c1);
                b1->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
@@ -37,13 +38,18 @@
                layout->AddView(b2, r2, c1);
                b2->SetExplicitAlignment(BAlignment(
                        B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER));
-                               
+
                BButton* b3 = new BButton("A3");
                layout->AddView(b3, r3, c1);
                b3->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, 
B_ALIGN_BOTTOM));
-               
+
                r2->HasSameHeightAs(r1);
                r3->HasSameHeightAs(r1);
+
+               // test size limits
+               BSize min = layout->MinSize();
+               BSize max = layout->MaxSize();
+               SetSizeLimits(min.Width(), max.Width(), min.Height(), 
max.Height());
        }
 };
 

Added: haiku/trunk/src/tests/libs/alm/ThreeButtons.cpp
===================================================================
--- haiku/trunk/src/tests/libs/alm/ThreeButtons.cpp                             
(rev 0)
+++ haiku/trunk/src/tests/libs/alm/ThreeButtons.cpp     2011-01-27 21:50:42 UTC 
(rev 40299)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2010, Clemens Zeidler <haiku@xxxxxxxxxxxxxxxxxx>
+ * Distributed under the terms of the MIT License.
+ */
+
+#include <stdio.h>
+
+#include <Application.h>
+#include <Button.h>
+#include <List.h>
+#include <Window.h>
+
+// include this for ALM
+#include "ALMLayout.h"
+
+
+class ThreeButtonsWindow : public BWindow {
+public:
+       ThreeButtonsWindow(BRect frame) 
+               :
+               BWindow(frame, "ALM Three Buttons", B_TITLED_WINDOW,
+                       B_QUIT_ON_WINDOW_CLOSE)
+       {
+               BButton* button1 = new BButton("A");
+               BButton* button2 = new BButton("B");
+               BButton* button3 = new BButton("C");
+
+               button1->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
+                       B_ALIGN_USE_FULL_HEIGHT));
+               button1->SetExplicitMaxSize(BSize(500, 50));
+
+               button2->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
+                       B_ALIGN_USE_FULL_HEIGHT));
+               button2->SetExplicitMaxSize(BSize(500, 500));
+
+               button3->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
+                       B_ALIGN_USE_FULL_HEIGHT));
+               button3->SetExplicitMaxSize(BSize(500, 500));
+
+               // create a new BALMLayout and use  it for this window
+               fLayout = new BALMLayout();
+               SetLayout(fLayout);
+               
+               fLayout->AddView(button1, fLayout->Left(), fLayout->Top(),
+                       fLayout->Right(), NULL);
+               fLayout->AddViewToBottom(button2);
+               fLayout->AddViewToBottom(button3, fLayout->Bottom());
+
+               // test size limits
+               BSize min = fLayout->MinSize();
+               BSize max = fLayout->MaxSize();
+               SetSizeLimits(min.Width(), max.Width(), min.Height(), 
max.Height());
+       }
+       
+private:
+       BALMLayout* fLayout;
+
+};
+
+
+int
+main()
+{
+       BApplication app("application/x-vnd.haiku.ThreeButtons");
+
+       BRect frameRect;
+       frameRect.Set(100, 100, 600, 300);
+       ThreeButtonsWindow* window = new ThreeButtonsWindow(frameRect);
+       window->Show();
+
+       app.Run();
+       return 0;
+}


Other related posts:

  • » [haiku-commits] r40299 - haiku/trunk/src/tests/libs/alm - clemens . zeidler