------------------------------------------------------------
revno: 222
committer: Seif Lotfy <s...@lotfy.com>
branch nick: bluebird
timestamp: Mon 2011-09-05 10:46:11 +0200
message:
  added new failing test case for disabled datasources
modified:
  extensions/ds-registry.vala
  test/dbus/dsr-test.py


--
lp:~zeitgeist/zeitgeist/bluebird
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird

Your team Zeitgeist Framework Team is subscribed to branch 
lp:~zeitgeist/zeitgeist/bluebird.
To unsubscribe from this branch go to 
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'extensions/ds-registry.vala'
--- extensions/ds-registry.vala	2011-09-04 18:35:10 +0000
+++ extensions/ds-registry.vala	2011-09-05 08:46:11 +0000
@@ -268,10 +268,12 @@
                     data_source.timestamp =  Timestamp.now ();
                     dirty = false;
                     if (!data_source.enabled)
+                    {
                         for (int i=0; i < events.length; i++)
                         {
                             events[i] = null;
                         }
+                    }
                 }
             }
         }

=== modified file 'test/dbus/dsr-test.py'
--- test/dbus/dsr-test.py	2011-08-31 00:30:01 +0000
+++ test/dbus/dsr-test.py	2011-09-05 08:46:11 +0000
@@ -164,6 +164,28 @@
 		ds = list(self.client._registry.GetDataSources())[0]
 		self.assertEquals(ds[DataSource.Enabled], True)
 
+	def testSetDataSourceDisabled(self):
+		# Insert a data-source -- it should be enabled by default
+		self.client._registry.RegisterDataSource(*self._ds1)
+		ds = list(self.client._registry.GetDataSources())[0]
+		self.assertEquals(ds[DataSource.Enabled], True)
+		
+		# Now we can choose to disable it...
+		self.client._registry.SetDataSourceEnabled(self._ds1[0], False)
+		ds = list(self.client._registry.GetDataSources())[0]
+		self.assertEquals(ds[DataSource.Enabled], False)
+		
+		ids = self.insertEventsAndWait([Event.new_for_values(
+			subject_manifestation = "!stfu:File")])
+			
+		self.assertEquals(ids[0], 0)
+		
+		# And enable it again!
+		self.client._registry.SetDataSourceEnabled(self._ds1[0], True)
+		ds = list(self.client._registry.GetDataSources())[0]
+		self.assertEquals(ds[DataSource.Enabled], True)
+
+
 	def testGetDataSourceFromId(self):
 		# Insert a data-source -- and then retrieve it by id
 		self.client._registry.RegisterDataSource(*self._ds1)

_______________________________________________
Mailing list: https://launchpad.net/~zeitgeist
Post to     : zeitgeist@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zeitgeist
More help   : https://help.launchpad.net/ListHelp

Reply via email to