Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Gnome/testsuite/gtk/   (Gnome Linux Desktop Version 4.23.2©)  Datei vom 30.5.2026 mit Größe 1 kB image not shown  

Quelle  tooltips.c

  Sprache: C
 

/* tooltips.c: Unit test for GtkWidget tooltip accessors
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 * Copyright 2020  GNOME Foundation
 */


#include <gtk/gtk.h>

static void
test_tooltips_widget_accessors (void)
{
  GtkWidget *w;
  const char *text, *markup;

  g_test_message ("A button using tooltip-markup");
  w = gtk_check_button_new_with_label ("This one uses the tooltip-markup property");
  g_object_ref_sink (w);
  gtk_widget_set_tooltip_text (w, "Hello, I am a static tooltip.");

  text = gtk_widget_get_tooltip_text (w);
  markup = gtk_widget_get_tooltip_markup (w);
  g_assert_cmpstr (text, ==, "Hello, I am a static tooltip.");
  g_assert_cmpstr (markup, ==, "Hello, I am a static tooltip.");
  g_object_unref (w);

  g_test_message ("A label using tooltip-text");
  w = gtk_label_new ("I am just a label");
  g_object_ref_sink (w);
  gtk_widget_set_tooltip_text (w, "Label & and tooltip");

  text = gtk_widget_get_tooltip_text (w);
  markup = gtk_widget_get_tooltip_markup (w);
  g_assert_cmpstr (text, ==, "Label & and tooltip");
  g_assert_cmpstr (markup, ==, "Label & and tooltip");
  g_object_unref (w);

  g_test_message ("A label using tooltip-markup");
  w = gtk_label_new ("I am a selectable label");
  g_object_ref_sink (w);
  gtk_label_set_selectable (GTK_LABEL (w), TRUE);
  gtk_widget_set_tooltip_markup (w, "<b>Another</b> Label tooltip");

  text = gtk_widget_get_tooltip_text (w);
  markup = gtk_widget_get_tooltip_markup (w);
  g_assert_cmpstr (text, ==, "Another Label tooltip");
  g_assert_cmpstr (markup, ==,"<b>Another</b> Label tooltip");
  g_object_unref (w);
}

int
main (int   argc,
      char *argv[])
{
  gtk_test_init (&argc, &argv);

  g_test_add_func ("/tooltips/widget-accessors", test_tooltips_widget_accessors);

  return g_test_run ();
}

Messung V0.5 in Prozent
C=100 H=92 G=95

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-07-02) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.