pace_row_combobox_entry_test.vala 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* -*- Mode: Vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
  2. using Pace;
  3. class PaceRowComboBoxEntryTest {
  4. public static int main ( string[] args ) {
  5. Test.init ( ref args );
  6. if ( !Gtk.init_check ( ref args ) )
  7. {
  8. return 77; //meson exit code to skip test
  9. }
  10. PaceRowComboBoxEntryTest.add_tests ();
  11. Test.run ();
  12. return 0;
  13. }
  14. public static void add_tests () {
  15. Test.add_func ( "/pace/row_combobox_entry", () => {
  16. RowComboBoxEntry test_row_combobox_entry = new RowComboBoxEntry ( "Server" );
  17. assert ( test_row_combobox_entry is RowComboBoxEntry );
  18. } );
  19. Test.add_func ( "/pace/row_combobox_entry/get_key", () => {
  20. RowComboBoxEntry test_row_combobox_entry = new RowComboBoxEntry ( "Include" );
  21. assert ( test_row_combobox_entry.get_key () == "Include" );
  22. } );
  23. Test.add_func ( "/pace/row_combobox_entry/get_key/wrong_key_name", () => {
  24. RowComboBoxEntry test_row_combobox_entry = new RowComboBoxEntry ( "key" );
  25. assert ( test_row_combobox_entry.get_key () == "Server" );
  26. } );
  27. Test.add_func ( "/pace/row_combobox_entry/set_key", () => {
  28. RowComboBoxEntry test_row_combobox_entry = new RowComboBoxEntry ( "key" );
  29. test_row_combobox_entry.set_key ( "Server" );
  30. assert ( test_row_combobox_entry.get_key () == "Server" );
  31. } );
  32. Test.add_func ( "/pace/row_combobox_entry/set_key/get_key/wrong_key_name", () => {
  33. RowComboBoxEntry test_row_combobox_entry = new RowComboBoxEntry ( "Include" );
  34. test_row_combobox_entry.set_key ( "key2" );
  35. assert ( test_row_combobox_entry.get_key () == "Include" );
  36. } );
  37. Test.add_func ( "/pace/row_combobox_entry/get_value/unassigned", () => {
  38. RowComboBoxEntry test_row = new RowComboBoxEntry ( "Server" );
  39. assert ( test_row.get_value () == "" );
  40. } );
  41. Test.add_func ( "/pace/row_combobox_entry/get_value/constructor", () => {
  42. RowComboBoxEntry test_row = new RowComboBoxEntry ( "Server", "value" );
  43. assert ( test_row.get_value () == "value" );
  44. } );
  45. Test.add_func ( "/pace/row_combobox_entry/set_value", () => {
  46. RowComboBoxEntry test_row = new RowComboBoxEntry ( "Server" );
  47. test_row.set_value ( "value" );
  48. assert ( test_row.get_value () == "value" );
  49. } );
  50. }
  51. }