[gtk+] Added test case to testheightforwidth.c to show GtkComboBox/GtkMenu wrapping in action



commit d73c11b549b5d33841962c1b518921234071366a
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Wed Aug 18 19:43:34 2010 -0400

    Added test case to testheightforwidth.c to show GtkComboBox/GtkMenu wrapping in action

 tests/testheightforwidth.c |  255 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 255 insertions(+), 0 deletions(-)
---
diff --git a/tests/testheightforwidth.c b/tests/testheightforwidth.c
index f784864..5bac79f 100644
--- a/tests/testheightforwidth.c
+++ b/tests/testheightforwidth.c
@@ -658,6 +658,261 @@ TestInterface interfaces[] = {
     "</interface>",
     NULL
   },
+
+  {
+    "Combo Boxes and Menus",
+    "This test shows wrapping and ellipsizing text in combo boxes (and consequently in menu items).",
+    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+    "<interface>"
+    "  <requires lib=\"gtk+\" version=\"2.20\"/>"
+    "  <!-- interface-naming-policy project-wide -->"
+    "  <object class=\"GtkWindow\" id=\"window\">"
+    "    <property name=\"border_width\">8</property>"
+    "    <property name=\"default_width\">600</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>"
+    "            <property name=\"spacing\">5</property>"
+    "            <child>"
+    "              <object class=\"GtkHBox\" id=\"hbox1\">"
+    "                <property name=\"visible\">True</property>"
+    "                <property name=\"spacing\">5</property>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label1\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">this combo box</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#b3460000eb1c\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">True</property>"
+    "                    <property name=\"fill\">True</property>"
+    "                    <property name=\"position\">0</property>"
+    "                  </packing>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label2\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">contains some wrapping locations</property>"
+    "                    <property name=\"ellipsize\">end</property>"
+    "                    <property name=\"width_chars\">10</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#b3460000eb1c\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">True</property>"
+    "                    <property name=\"fill\">True</property>"
+    "                    <property name=\"position\">1</property>"
+    "                  </packing>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkComboBox\" id=\"combobox1\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"model\">liststore1</property>"
+    "                    <property name=\"active\">0</property>"
+    "                    <child>"
+    "                      <object class=\"GtkCellRendererPixbuf\" id=\"cellrenderertext1\"/>"
+    "                      <attributes>"
+    "                        <attribute name=\"stock-id\">1</attribute>"
+    "                      </attributes>"
+    "                    </child>"
+    "                    <child>"
+    "                      <object class=\"GtkCellRendererText\" id=\"cellrenderertext2\">"
+    "                        <property name=\"foreground\">purple</property>"
+    "                        <property name=\"weight\">600</property>"
+    "                        <property name=\"wrap_mode\">word</property>"
+    "                        <property name=\"wrap_width\">100</property>"
+    "                      </object>"
+    "                      <attributes>"
+    "                        <attribute name=\"text\">0</attribute>"
+    "                      </attributes>"
+    "                    </child>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">True</property>"
+    "                    <property name=\"fill\">True</property>"
+    "                    <property name=\"position\">2</property>"
+    "                  </packing>"
+    "                </child>"
+    "              </object>"
+    "              <packing>"
+    "                <property name=\"expand\">False</property>"
+    "                <property name=\"fill\">True</property>"
+    "                <property name=\"position\">0</property>"
+    "              </packing>"
+    "            </child>"
+    "            <child>"
+    "              <object class=\"GtkFrame\" id=\"frame1\">"
+    "                <property name=\"visible\">True</property>"
+    "                <property name=\"label_xalign\">0</property>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label3\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">This test shows combo boxes\n"
+    "requesting and allocating space\n"
+    "for its backing content using\n"
+    "height-for-width geometry\n"
+    "management.\n"
+    "\n"
+    "Note this test also demonstrates\n"
+    "height-for-width menu items.</property>"
+    "                    <property name=\"justify\">center</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#00000000ffff\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                </child>"
+    "              </object>"
+    "              <packing>"
+    "                <property name=\"expand\">True</property>"
+    "                <property name=\"fill\">True</property>"
+    "                <property name=\"position\">1</property>"
+    "              </packing>"
+    "            </child>"
+    "            <child>"
+    "              <object class=\"GtkHBox\" id=\"hbox2\">"
+    "                <property name=\"visible\">True</property>"
+    "                <property name=\"spacing\">5</property>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label4\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">this combo box</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#ffffa5a50000\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">True</property>"
+    "                    <property name=\"fill\">True</property>"
+    "                    <property name=\"position\">0</property>"
+    "                  </packing>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkLabel\" id=\"label5\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"label\" translatable=\"yes\">contains some ellipsizing locations</property>"
+    "                    <property name=\"ellipsize\">end</property>"
+    "                    <property name=\"width_chars\">10</property>"
+    "                    <attributes>"
+    "                      <attribute name=\"weight\" value=\"bold\"/>"
+    "                      <attribute name=\"foreground\" value=\"#ffffa5a50000\"/>"
+    "                    </attributes>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">True</property>"
+    "                    <property name=\"fill\">True</property>"
+    "                    <property name=\"position\">1</property>"
+    "                  </packing>"
+    "                </child>"
+    "                <child>"
+    "                  <object class=\"GtkComboBox\" id=\"combobox2\">"
+    "                    <property name=\"visible\">True</property>"
+    "                    <property name=\"model\">liststore1</property>"
+    "                    <property name=\"active\">0</property>"
+    "                    <child>"
+    "                      <object class=\"GtkCellRendererPixbuf\" id=\"cellrenderertext3\"/>"
+    "                      <attributes>"
+    "                        <attribute name=\"stock-id\">1</attribute>"
+    "                      </attributes>"
+    "                    </child>"
+    "                    <child>"
+    "                      <object class=\"GtkCellRendererText\" id=\"cellrenderertext4\">"
+    "                        <property name=\"ellipsize\">end</property>"
+    "                        <property name=\"foreground\">orange</property>"
+    "                        <property name=\"weight\">600</property>"
+    "                        <property name=\"width_chars\">10</property>"
+    "                      </object>"
+    "                      <attributes>"
+    "                        <attribute name=\"text\">0</attribute>"
+    "                      </attributes>"
+    "                    </child>"
+    "                  </object>"
+    "                  <packing>"
+    "                    <property name=\"expand\">True</property>"
+    "                    <property name=\"fill\">True</property>"
+    "                    <property name=\"position\">2</property>"
+    "                  </packing>"
+    "                </child>"
+    "              </object>"
+    "              <packing>"
+    "                <property name=\"expand\">False</property>"
+    "                <property name=\"fill\">True</property>"
+    "                <property name=\"position\">2</property>"
+    "              </packing>"
+    "            </child>"
+    "          </object>"
+    "          <packing>"
+    "            <property name=\"resize\">True</property>"
+    "            <property name=\"shrink\">False</property>"
+    "          </packing>"
+    "        </child>"
+    "        <child>"
+    "          <object class=\"GtkLabel\" id=\"label6\">"
+    "            <property name=\"visible\">True</property>"
+    "            <property name=\"label\" translatable=\"yes\">Some static\n"
+    "text here\n"
+    "that shrinks.</property>"
+    "            <property name=\"justify\">center</property>"
+    "            <attributes>"
+    "              <attribute name=\"foreground\" value=\"#ffff00000000\"/>"
+    "            </attributes>"
+    "          </object>"
+    "          <packing>"
+    "            <property name=\"resize\">False</property>"
+    "            <property name=\"shrink\">True</property>"
+    "          </packing>"
+    "        </child>"
+    "      </object>"
+    "    </child>"
+    "  </object>"
+    "  <object class=\"GtkListStore\" id=\"liststore1\">"
+    "    <columns>"
+    "      <!-- column-name item-text -->"
+    "      <column type=\"gchararray\"/>"
+    "      <!-- column-name icon-name -->"
+    "      <column type=\"gchararray\"/>"
+    "    </columns>"
+    "    <data>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">Montreal, Quebec Canada</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-yes</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">Sao Paulo, SP Brazil</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-no</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">Buenos Aires, Argentina</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-stop</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">Los Angelos, California USA</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-media-record</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">Rio de Janeiro, RJ Brazil</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-dialog-error</col>"
+    "      </row>"
+    "      <row>"
+    "        <col id=\"0\" translatable=\"yes\">Seoul, South Korea</col>"
+    "        <col id=\"1\" translatable=\"yes\">gtk-info</col>"
+    "      </row>"
+    "    </data>"
+    "  </object>"
+    "</interface>",
+    NULL
+  },
+  
 };
 
 



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