Back to index

libappindicator  12.10.0
TestIndicator.cs
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009 Canonical Ltd.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU General Public License version 3, as published
00006  * by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranties of
00010  * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License along
00014  * with this program.  If not, see <http://www.gnu.org/licenses/>.
00015  *
00016  * Authors:
00017  *   Cody Russell <cody.russell@canonical.com>
00018  */
00019 
00020 using System;
00021 using GLib;
00022 using Gtk;
00023 using AppIndicator;
00024 
00025 using NUnit.Framework;
00026 
00027 namespace Ayatana.AppIndicator.Test
00028 {
00029         [TestFixture]
00030         public class IndicatorTest
00031         {
00032                 ApplicationIndicator indicator;
00033 
00034                 private void Update ()
00035                 {
00036                         while (MainContext.Pending ())
00037                                 MainContext.Iteration(true);
00038                 }
00039 
00040                 [SetUp]
00041                 public void Init ()
00042                 {
00043                         Application.Init ();
00044 
00045                         Console.WriteLine ("Init()");
00046 
00047                         indicator = new ApplicationIndicator ("my-id", "my-name", Category.ApplicationStatus);
00048 
00049                         Console.WriteLine ("Created indicator");
00050 
00051                         Update();
00052                 }
00053 
00054                 [Test]
00055                 public void TestProperties ()
00056                 {
00057                         Console.WriteLine ("TestProperties()");
00058 
00059                         Assert.AreNotSame (indicator, null);
00060 
00061                         Assert.AreEqual (indicator.IconName, "my-name");
00062                         Assert.AreEqual (indicator.ID, "my-id");
00063                         Assert.AreEqual (indicator.Status, Category.ApplicationStatus);
00064 
00065                         Console.WriteLine ("End..");
00066                 }
00067 
00068                 [Test]
00069                 public void TestSetProperties ()
00070                 {
00071                         Console.WriteLine ("TestSetProperties");
00072 
00073                         indicator.Status = Status.Attention;
00074                         indicator.AttentionIconName = "my-attention-name";
00075 
00076                         Assert.AreEqual (indicator.Status, Status.Attention);
00077                         Assert.AreEqual (indicator.AttentionIconName, "my-attention-name");
00078 
00079                         Console.WriteLine ("End..");
00080                 }
00081         }
00082 }