Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Testing: GTK+ 2 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 2 Reference Manual">
<link rel="up" href="gtkbase.html" title="Part II. GTK+ Core Reference">
<link rel="prev" href="gtk2-Types.html" title="Types">
<link rel="next" href="gtk2-Filesystem-utilities.html" title="Filesystem utilities">
<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#gtk2-Testing.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="gtkbase.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gtk2-Types.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gtk2-Filesystem-utilities.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="gtk2-Testing"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gtk2-Testing.top_of_page"></a>Testing</span></h2>
<p>Testing — Utilities for testing GTK+ applications</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="gtk2-Testing.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-create-simple-window" title="gtk_test_create_simple_window ()">gtk_test_create_simple_window</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-create-widget" title="gtk_test_create_widget ()">gtk_test_create_widget</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-display-button-window" title="gtk_test_display_button_window ()">gtk_test_display_button_window</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-find-label" title="gtk_test_find_label ()">gtk_test_find_label</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-find-sibling" title="gtk_test_find_sibling ()">gtk_test_find_sibling</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-find-widget" title="gtk_test_find_widget ()">gtk_test_find_widget</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-init" title="gtk_test_init ()">gtk_test_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a href="../gobject/gobject-Type-Information.html#GType"><span class="returnvalue">GType</span></a> *
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-list-all-types" title="gtk_test_list_all_types ()">gtk_test_list_all_types</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-register-all-types" title="gtk_test_register_all_types ()">gtk_test_register_all_types</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">double</span>
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-slider-get-value" title="gtk_test_slider_get_value ()">gtk_test_slider_get_value</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-slider-set-perc" title="gtk_test_slider_set_perc ()">gtk_test_slider_set_perc</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-spin-button-click" title="gtk_test_spin_button_click ()">gtk_test_spin_button_click</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-text-get" title="gtk_test_text_get ()">gtk_test_text_get</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-text-set" title="gtk_test_text_set ()">gtk_test_text_set</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-widget-click" title="gtk_test_widget_click ()">gtk_test_widget_click</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="gtk2-Testing.html#gtk-test-widget-send-key" title="gtk_test_widget_send_key ()">gtk_test_widget_send_key</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gtk2-Testing.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gtk/gtkpagesetupunixdialog.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="gtk2-Testing.description"></a><h2>Description</h2>
</div>
<div class="refsect1">
<a name="gtk2-Testing.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gtk-test-create-simple-window"></a><h3>gtk_test_create_simple_window ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_test_create_simple_window (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *window_title</code></em>,
                               <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *dialog_text</code></em>);</pre>
<p>Create a simple window with window title <em class="parameter"><code>window_title</code></em>
 and
text contents <em class="parameter"><code>dialog_text</code></em>
.
The window will quit any running <a class="link" href="gtk2-General.html#gtk-main" title="gtk_main ()"><code class="function">gtk_main()</code></a>-loop when destroyed, and it
will automatically be destroyed upon test function teardown.</p>
<div class="refsect3">
<a name="gtk-test-create-simple-window.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>window_title</p></td>
<td class="parameter_description"><p>Title of the window to be displayed.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dialog_text</p></td>
<td class="parameter_description"><p>Text inside the window to be displayed.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-test-create-simple-window.returns"></a><h4>Returns</h4>
<p>a widget pointer to the newly created GtkWindow. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-create-widget"></a><h3>gtk_test_create_widget ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_test_create_widget (<em class="parameter"><code><a href="../gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> widget_type</code></em>,
                        <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_property_name</code></em>,
                        <em class="parameter"><code>...</code></em>);</pre>
<p>This function wraps <a href="../gobject/gobject-The-Base-Object-Type.html#g-object-new"><code class="function">g_object_new()</code></a> for widget types.
It'll automatically show all created non window widgets, also
<a href="../gobject/gobject-The-Base-Object-Type.html#g-object-ref-sink"><code class="function">g_object_ref_sink()</code></a> them (to keep them alive across a running test)
and set them up for destruction during the next test teardown phase.</p>
<div class="refsect3">
<a name="gtk-test-create-widget.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>widget_type</p></td>
<td class="parameter_description"><p>a valid widget type.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>first_property_name</p></td>
<td class="parameter_description"><p>Name of first property to set or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>Varargs</p></td>
<td class="parameter_description"><p>value to set the first property to, followed by more
name-value pairs, terminated by <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-test-create-widget.returns"></a><h4>Returns</h4>
<p> a newly created widget.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-display-button-window"></a><h3>gtk_test_display_button_window ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_test_display_button_window (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *window_title</code></em>,
                                <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *dialog_text</code></em>,
                                <em class="parameter"><code>...</code></em>);</pre>
<p>Create a window with window title <em class="parameter"><code>window_title</code></em>
, text contents <em class="parameter"><code>dialog_text</code></em>
,
and a number of buttons, according to the paired argument list given
as @... parameters.
Each button is created with a <em class="parameter"><code>label</code></em>
 and a ::clicked signal handler that
incremrents the integer stored in <em class="parameter"><code>nump</code></em>
.
The window will be automatically shown with <a class="link" href="GtkWidget.html#gtk-widget-show-now" title="gtk_widget_show_now ()"><code class="function">gtk_widget_show_now()</code></a> after
creation, so when this function returns it has already been mapped,
resized and positioned on screen.
The window will quit any running <a class="link" href="gtk2-General.html#gtk-main" title="gtk_main ()"><code class="function">gtk_main()</code></a>-loop when destroyed, and it
will automatically be destroyed upon test function teardown.</p>
<div class="refsect3">
<a name="gtk-test-display-button-window.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>window_title</p></td>
<td class="parameter_description"><p>Title of the window to be displayed.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dialog_text</p></td>
<td class="parameter_description"><p>Text inside the window to be displayed.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p><a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> terminated list of (const char *label, int *nump) pairs.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-test-display-button-window.returns"></a><h4>Returns</h4>
<p> a widget pointer to the newly created GtkWindow.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-find-label"></a><h3>gtk_test_find_label ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_test_find_label (<em class="parameter"><code><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                     <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *label_pattern</code></em>);</pre>
<p>This function will search <em class="parameter"><code>widget</code></em>
 and all its descendants for a GtkLabel
widget with a text string matching <em class="parameter"><code>label_pattern</code></em>
.
The <em class="parameter"><code>label_pattern</code></em>
 may contain asterisks '*' and question marks '?' as
placeholders, <a href="../glib/glib-Glob-style-pattern-matching.html#g-pattern-match"><code class="function">g_pattern_match()</code></a> is used for the matching.
Note that locales other than "C" tend to alter (translate" label strings,
so this function is genrally only useful in test programs with
predetermined locales, see <a class="link" href="gtk2-Testing.html#gtk-test-init" title="gtk_test_init ()"><code class="function">gtk_test_init()</code></a> for more details.</p>
<div class="refsect3">
<a name="gtk-test-find-label.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>widget</p></td>
<td class="parameter_description"><p>Valid label or container widget.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>label_pattern</p></td>
<td class="parameter_description"><p>Shell-glob pattern to match a label string.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-test-find-label.returns"></a><h4>Returns</h4>
<p>a GtkLabel widget if any is found. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-find-sibling"></a><h3>gtk_test_find_sibling ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_test_find_sibling (<em class="parameter"><code><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> *base_widget</code></em>,
                       <em class="parameter"><code><a href="../gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> widget_type</code></em>);</pre>
<p>This function will search siblings of <em class="parameter"><code>base_widget</code></em>
 and siblings of its
ancestors for all widgets matching <em class="parameter"><code>widget_type</code></em>
.
Of the matching widgets, the one that is geometrically closest to
<em class="parameter"><code>base_widget</code></em>
 will be returned.
The general purpose of this function is to find the most likely "action"
widget, relative to another labeling widget. Such as finding a
button or text entry widget, given it's corresponding label widget.</p>
<div class="refsect3">
<a name="gtk-test-find-sibling.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>base_widget</p></td>
<td class="parameter_description"><p>Valid widget, part of a widget hierarchy</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>widget_type</p></td>
<td class="parameter_description"><p>Type of a aearched for sibling widget</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-test-find-sibling.returns"></a><h4>Returns</h4>
<p>a widget of type <em class="parameter"><code>widget_type</code></em>
if any is found. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-find-widget"></a><h3>gtk_test_find_widget ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_test_find_widget (<em class="parameter"><code><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                      <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *label_pattern</code></em>,
                      <em class="parameter"><code><a href="../gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> widget_type</code></em>);</pre>
<p>This function will search the descendants of <em class="parameter"><code>widget</code></em>
 for a widget
of type <em class="parameter"><code>widget_type</code></em>
 that has a label matching <em class="parameter"><code>label_pattern</code></em>
 next
to it. This is most useful for automated GUI testing, e.g. to find
the "OK" button in a dialog and synthesize clicks on it.
However see <a class="link" href="gtk2-Testing.html#gtk-test-find-label" title="gtk_test_find_label ()"><code class="function">gtk_test_find_label()</code></a>, <a class="link" href="gtk2-Testing.html#gtk-test-find-sibling" title="gtk_test_find_sibling ()"><code class="function">gtk_test_find_sibling()</code></a> and
<a class="link" href="gtk2-Testing.html#gtk-test-widget-click" title="gtk_test_widget_click ()"><code class="function">gtk_test_widget_click()</code></a> for possible caveats involving the search of
such widgets and synthesizing widget events.</p>
<div class="refsect3">
<a name="gtk-test-find-widget.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>widget</p></td>
<td class="parameter_description"><p>Container widget, usually a GtkWindow.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>label_pattern</p></td>
<td class="parameter_description"><p>Shell-glob pattern to match a label string.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>widget_type</p></td>
<td class="parameter_description"><p>Type of a aearched for label sibling widget.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-test-find-widget.returns"></a><h4>Returns</h4>
<p>a valid widget if any is found or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-init"></a><h3>gtk_test_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_test_init (<em class="parameter"><code><span class="type">int</span> *argcp</code></em>,
               <em class="parameter"><code><span class="type">char</span> ***argvp</code></em>,
               <em class="parameter"><code>...</code></em>);</pre>
<p>This function is used to initialize a GTK+ test program.</p>
<p>It will in turn call <a href="../glib/glib-Testing.html#g-test-init"><code class="function">g_test_init()</code></a> and <a class="link" href="gtk2-General.html#gtk-init" title="gtk_init ()"><code class="function">gtk_init()</code></a> to properly
initialize the testing framework and graphical toolkit. It'll 
also set the program's locale to "C" and prevent loading of rc 
files and Gtk+ modules. This is done to make tets program
environments as deterministic as possible.</p>
<p>Like <a class="link" href="gtk2-General.html#gtk-init" title="gtk_init ()"><code class="function">gtk_init()</code></a> and <a href="../glib/glib-Testing.html#g-test-init"><code class="function">g_test_init()</code></a>, any known arguments will be
processed and stripped from <em class="parameter"><code>argc</code></em>
 and <em class="parameter"><code>argv</code></em>
.</p>
<div class="refsect3">
<a name="gtk-test-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>argcp</p></td>
<td class="parameter_description"><p>Address of the <em class="parameter"><code>argc</code></em> parameter of the
<code class="function">main()</code> function. Changed if any arguments were handled.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>argvp</p></td>
<td class="parameter_description">
<p>Address of the </p>
<em class="parameter"><code>argv</code></em> parameter of <code class="function">main()</code>.
<p>       Any parameters understood by <a href="../glib/glib-Testing.html#g-test-init"><code class="function">g_test_init()</code></a> or <a class="link" href="gtk2-General.html#gtk-init" title="gtk_init ()"><code class="function">gtk_init()</code></a> are
stripped before return. </p>
</td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for input and for returning results. Default is transfer full."><span class="acronym">inout</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=argcp]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>Varargs</p></td>
<td class="parameter_description"><p>currently unused</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-list-all-types"></a><h3>gtk_test_list_all_types ()</h3>
<pre class="programlisting">const <a href="../gobject/gobject-Type-Information.html#GType"><span class="returnvalue">GType</span></a> *
gtk_test_list_all_types (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> *n_types</code></em>);</pre>
<p>Return the type ids that have been registered after
calling <a class="link" href="gtk2-Testing.html#gtk-test-register-all-types" title="gtk_test_register_all_types ()"><code class="function">gtk_test_register_all_types()</code></a>.</p>
<div class="refsect3">
<a name="gtk-test-list-all-types.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>n_types</p></td>
<td class="parameter_description"><p>location to store number of types</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>returns</p></td>
<td class="parameter_description"><p>0-terminated array of type ids. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_types zero-terminated=1][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-register-all-types"></a><h3>gtk_test_register_all_types ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_test_register_all_types (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Force registration of all core Gtk+ and Gdk object types.
This allowes to refer to any of those object types via
<a href="../gobject/gobject-Type-Information.html#g-type-from-name"><code class="function">g_type_from_name()</code></a> after calling this function.</p>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-slider-get-value"></a><h3>gtk_test_slider_get_value ()</h3>
<pre class="programlisting"><span class="returnvalue">double</span>
gtk_test_slider_get_value (<em class="parameter"><code><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>);</pre>
<p>Retrive the literal adjustment value for GtkRange based
widgets and spin buttons. Note that the value returned by
this function is anything between the lower and upper bounds
of the adjustment belonging to <em class="parameter"><code>widget</code></em>
, and is not a percentage
as passed in to <a class="link" href="gtk2-Testing.html#gtk-test-slider-set-perc" title="gtk_test_slider_set_perc ()"><code class="function">gtk_test_slider_set_perc()</code></a>.</p>
<div class="refsect3">
<a name="gtk-test-slider-get-value.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>widget</p></td>
<td class="parameter_description"><p>valid widget pointer.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-test-slider-get-value.returns"></a><h4>Returns</h4>
<p> adjustment-&gt;value for an adjustment belonging to <em class="parameter"><code>widget</code></em>
.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-slider-set-perc"></a><h3>gtk_test_slider_set_perc ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_test_slider_set_perc (<em class="parameter"><code><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                          <em class="parameter"><code><span class="type">double</span> percentage</code></em>);</pre>
<p>This function will adjust the slider position of all GtkRange
based widgets, such as scrollbars or scales, it'll also adjust
spin buttons. The adjustment value of these widgets is set to
a value between the lower and upper limits, according to the
<em class="parameter"><code>percentage</code></em>
 argument.</p>
<div class="refsect3">
<a name="gtk-test-slider-set-perc.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>widget</p></td>
<td class="parameter_description"><p>valid widget pointer.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>percentage</p></td>
<td class="parameter_description"><p>value between 0 and 100.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-spin-button-click"></a><h3>gtk_test_spin_button_click ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
gtk_test_spin_button_click (<em class="parameter"><code><a class="link" href="GtkSpinButton.html" title="GtkSpinButton"><span class="type">GtkSpinButton</span></a> *spinner</code></em>,
                            <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> button</code></em>,
                            <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> upwards</code></em>);</pre>
<p>This function will generate a <em class="parameter"><code>button</code></em>
 click in the upwards or downwards
spin button arrow areas, usually leading to an increase or decrease of
spin button's value.</p>
<div class="refsect3">
<a name="gtk-test-spin-button-click.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>spinner</p></td>
<td class="parameter_description"><p>valid GtkSpinButton widget.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>button</p></td>
<td class="parameter_description"><p>Number of the pointer button for the event, usually 1, 2 or 3.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>upwards</p></td>
<td class="parameter_description"><p><a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for upwards arrow click, <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> for downwards arrow click.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-test-spin-button-click.returns"></a><h4>Returns</h4>
<p> wether all actions neccessary for the button click simulation were carried out successfully.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-text-get"></a><h3>gtk_test_text_get ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
gtk_test_text_get (<em class="parameter"><code><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>);</pre>
<p>Retrive the text string of <em class="parameter"><code>widget</code></em>
 if it is a GtkLabel,
GtkEditable (entry and text widgets) or GtkTextView.</p>
<div class="refsect3">
<a name="gtk-test-text-get.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>widget</p></td>
<td class="parameter_description"><p>valid widget pointer.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-test-text-get.returns"></a><h4>Returns</h4>
<p> new 0-terminated C string, needs to be released with <a href="../glib/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-text-set"></a><h3>gtk_test_text_set ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_test_text_set (<em class="parameter"><code><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                   <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *string</code></em>);</pre>
<p>Set the text string of <em class="parameter"><code>widget</code></em>
 to <em class="parameter"><code>string</code></em>
 if it is a GtkLabel,
GtkEditable (entry and text widgets) or GtkTextView.</p>
<div class="refsect3">
<a name="gtk-test-text-set.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>widget</p></td>
<td class="parameter_description"><p>valid widget pointer.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>string</p></td>
<td class="parameter_description"><p>a 0-terminated C string</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-widget-click"></a><h3>gtk_test_widget_click ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
gtk_test_widget_click (<em class="parameter"><code><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                       <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> button</code></em>,
                       <em class="parameter"><code><a href="../html/gdk2-Windows.html#GdkModifierType"><span class="type">GdkModifierType</span></a> modifiers</code></em>);</pre>
<p>This function will generate a <em class="parameter"><code>button</code></em>
 click (button press and button
release event) in the middle of the first GdkWindow found that belongs
to <em class="parameter"><code>widget</code></em>
.
For <a class="link" href="GtkWidget.html#GTK-NO-WINDOW:CAPS"><code class="literal">GTK_NO_WINDOW</code></a> widgets like GtkButton, this will often be an
input-only event window. For other widgets, this is usually widget-&gt;window.
Certain caveats should be considered when using this function, in
particular because the mouse pointer is warped to the button click
location, see <a href="../html/gdk2-Testing.html#gdk-test-simulate-button"><code class="function">gdk_test_simulate_button()</code></a> for details.</p>
<div class="refsect3">
<a name="gtk-test-widget-click.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>widget</p></td>
<td class="parameter_description"><p>Widget to generate a button click on.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>button</p></td>
<td class="parameter_description"><p>Number of the pointer button for the event, usually 1, 2 or 3.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>modifiers</p></td>
<td class="parameter_description"><p>Keyboard modifiers the event is setup with.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-test-widget-click.returns"></a><h4>Returns</h4>
<p> wether all actions neccessary for the button click simulation were carried out successfully.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-test-widget-send-key"></a><h3>gtk_test_widget_send_key ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
gtk_test_widget_send_key (<em class="parameter"><code><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>,
                          <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint"><span class="type">guint</span></a> keyval</code></em>,
                          <em class="parameter"><code><a href="../html/gdk2-Windows.html#GdkModifierType"><span class="type">GdkModifierType</span></a> modifiers</code></em>);</pre>
<p>This function will generate keyboard press and release events in
the middle of the first GdkWindow found that belongs to <em class="parameter"><code>widget</code></em>
.
For <a class="link" href="GtkWidget.html#GTK-NO-WINDOW:CAPS"><code class="literal">GTK_NO_WINDOW</code></a> widgets like GtkButton, this will often be an
input-only event window. For other widgets, this is usually widget-&gt;window.
Certain caveats should be considered when using this function, in
particular because the mouse pointer is warped to the key press
location, see <a href="../html/gdk2-Testing.html#gdk-test-simulate-key"><code class="function">gdk_test_simulate_key()</code></a> for details.</p>
<div class="refsect3">
<a name="gtk-test-widget-send-key.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>widget</p></td>
<td class="parameter_description"><p>Widget to generate a key press and release on.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>keyval</p></td>
<td class="parameter_description"><p>A Gdk keyboard value.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>modifiers</p></td>
<td class="parameter_description"><p>Keyboard modifiers the event is setup with.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-test-widget-send-key.returns"></a><h4>Returns</h4>
<p> wether all actions neccessary for the key event simulation were carried out successfully.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
</div>
<div class="refsect1">
<a name="gtk2-Testing.other_details"></a><h2>Types and Values</h2>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.26.1</div>
</body>
</html>