[gtk+/native-layout] Added test reflecting the usage of GtkLabel parameters.



commit 7db18bb726d6c04f4d4623a680dac7ab706c1024
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Tue Apr 20 20:44:24 2010 -0400

    Added test reflecting the usage of GtkLabel parameters.

 tests/testextendedlayout2.c |  123 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 123 insertions(+), 0 deletions(-)
---
diff --git a/tests/testextendedlayout2.c b/tests/testextendedlayout2.c
index 73875ea..8741463 100644
--- a/tests/testextendedlayout2.c
+++ b/tests/testextendedlayout2.c
@@ -417,6 +417,129 @@ TestInterface interfaces[] = {
     NULL
   },
 
+  {
+    "Label Parameters",
+    "This test demonstrates how \"width-chars\" and \"max-width-chars\" can be used "
+    "to effect minimum and natural widths in wrapping labels.",
+    "<interface>"
+    "  <requires lib=\"gtk+\" version=\"2.20\"/>"
+    "  <!-- interface-naming-policy project-wide -->"
+    "  <object class=\"GtkWindow\" id=\"window\">"
+    "    <property name=\"default_width\">900</property>"
+    "    <child>"
+    "      <object class=\"GtkHPaned\" id=\"hpaned1\">"
+    "        <property name=\"visible\">True</property>"
+    "        <property name=\"can_focus\">True</property>"
+    "        <child>"
+    "          <object class=\"GtkVBox\" id=\"vbox1\">"
+    "            <property name=\"visible\">True</property>"
+    "            <child>"
+    "              <object class=\"GtkHBox\" id=\"hbox1\">"
+    "                <property name=\"visible\">True</property>"
+    "                <property name=\"spacing\">6</property>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label1\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">These first 2 labels explicitly require only 10 charachters in width.</property>"
+    "                    <property name=\"wrap\">True</property>"
+    "                    <property name=\"width_chars\">10</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#ffff00000000\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">False</property>"
+    "                    <property name=\"fill\">False</property>"
+    "                    <property name=\"position\">0</property>"
+    "                  </packing>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label2\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">This label has a maximum natural width of 20 charachters. Otherwise it would unwrap much further.</property>"
+    "                    <property name=\"wrap\">True</property>"
+    "                    <property name=\"width_chars\">10</property>"
+    "                    <property name=\"max_width_chars\">20</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#05c2a161134b\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">False</property>"
+    "                    <property name=\"fill\">False</property>"
+    "                    <property name=\"position\">1</property>"
+    "                  </packing>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label3\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">This label is set to expand and requires a default minimum size.</property>"
+    "                    <property name=\"wrap\">True</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#03e30758fb5f\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"position\">2</property>"
+    "                  </packing>"
+    "                </child>"
+    "              </object>"
+    "              <packing>"
+    "                <property name=\"position\">0</property>"
+    "              </packing>"
+    "            </child>"
+    "            <child>"
+    "              <object class=\"GtkLabel\" id=\"label4\">"
+    "                <property name=\"visible\">True</property>"
+    "                <property name=\"label\" translatable=\"yes\">This test demonstrates how the \"width-chars\" and \"max-width-chars\"\n"
+    "properties can be used to specify the minimum requested wrap width\n"
+    "and the maximum natural wrap width respectively.</property>"
+    "                <property name=\"ellipsize\">end</property>"
+    "                <property name=\"width_chars\">30</property>"
+    "                <attributes>"
+    "                  <attribute name=\"style\" value=\"normal\"/>"
+    "                  <attribute name=\"foreground\" value=\"#05470000abaf\"/>"
+    "                </attributes>"
+    "              </object>"
+    "              <packing>"
+    "                <property name=\"position\">1</property>"
+    "              </packing>"
+    "            </child>"
+    "          </object>"
+    "          <packing>"
+    "            <property name=\"resize\">False</property>"
+    "            <property name=\"shrink\">False</property>"
+    "          </packing>"
+    "        </child>"
+    "        <child>"
+    "          <object class=\"GtkLabel\" id=\"label5\">"
+    "            <property name=\"visible\">True</property>"
+    "            <property name=\"label\" translatable=\"yes\">Some static\n"
+    "text that shrinks.\n"
+    "\n"
+    "You will need to stretch\n"
+    "this window quite wide\n"
+    "to see the effects.</property>"
+    "            <property name=\"justify\">center</property>"
+    "            <attributes>"
+    "              <attribute name=\"foreground\" value=\"#ffff00000000\"/>"
+    "            </attributes>"
+    "          </object>"
+    "          <packing>"
+    "            <property name=\"resize\">True</property>"
+    "            <property name=\"shrink\">True</property>"
+    "          </packing>"
+    "        </child>"
+    "      </object>"
+    "    </child>"
+    "  </object>"
+    "</interface>",
+    NULL
+  },
+
 };
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]