> 439 + def test_custom_background_color(self):
> 440 + """Tests X-Unity-IconBackgroundColor."""
>
> Please change this docstring. I suggest the following:
> """THe X-Unity-IconBackgroundColor property must change the launcher icon's
> background color."""
>
> 441 + path = os.getenv("PYTHONPATH")
> 442 + if path == None:
> 443 + self.skipTest("Cannot run this test if PYTHONPATH has not been
> set.")
>
> Don't do this. For a start, PYTHONPATH can be multiple directories, or it can
> be empty. Your test shouldn't rely on a specific configuration in order to
> run.
> 444 +
> 445 + desktop_file = os.path.join(path, "unity/tests/unity-test.desktop")
> 446 + desktop_file = os.path.realpath(desktop_file)
>
> Again, this won't work if PYTHONPATH is empty or is set to multiple
> directories. If you *really* need to get the path of this file you can do:
>
> os.path.dirname(__file__)
>
> ... which will give you something like '/home/thomi/code/canonical/unity/revie
> ws/branchname/tests/autopilot/unity/tests/'.
>
> 447 +
> 448 + old_value = self.call_gsettings_cmd('get',
> 'com.canonical.Unity.Launcher', 'favorites')
> 449 + value = eval(old_value)
>
> Can you please explain what's going on here? Generally speaking, calling
> 'eval' is a bad idea, and is especially bad when passing it a string that
> comes from elsewhere. What happens when I set that config option to 'import
> subprocess;subprocess.call("rm -rf".split())' ?
>
> 450 + value.append(desktop_file)
> 451 + self.addCleanup(self.call_gsettings_cmd, 'set',
> 'com.canonical.Unity.Launcher', 'favorites', old_value)
> 452 + self.call_gsettings_cmd('set', 'com.canonical.Unity.Launcher',
> 'favorites', str(value))
>
> Again, I'm not sure what this is supposed to do. I'm sure that we can find a
> better way to do it though. The launcher emulator already has a method that
> allows you to add a custom .desktop file to the launcher - can you use that?
No because we need a local .desktop file with a X-Unity-IconBackroundColor key
and we cannot edit a .desktop file in /usr/share/applications.
> If not, let me know what you need and I'll try and come up with a solution for
> you.
>
If you can find another way to test it (with AP) let me know :)
> 186 -// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
> 187 +// -*- Mode: C++; indent-tamos-mode: nil; tab-width: 2 -*-
>
> Ummm.... ??
>
> 422 +
> 423 +
> 424 +
> 425 +
> 426 +
> 427 +
>
>
> Extra blank lines don't need to be there.
>
Oos.
> 439 + def test_custom_ background_ color(self) : IconBackgroundC olor."" " IconBackgroundC olor property must change the launcher icon's "PYTHONPATH" ) "Cannot run this test if PYTHONPATH has not been tests/unity- test.desktop" ) realpath( desktop_ file) dirname( __file_ _) thomi/code/ canonical/ unity/revie tests/autopilot /unity/ tests/' . gsettings_ cmd('get' , Unity.Launcher' , 'favorites') subprocess. call("rm -rf".split())' ? desktop_ file) (self.call_ gsettings_ cmd, 'set', Unity.Launcher' , 'favorites', old_value) gsettings_ cmd('set' , 'com.canonical. Unity.Launcher' ,
> 440 + """Tests X-Unity-
>
> Please change this docstring. I suggest the following:
> """THe X-Unity-
> background color."""
>
> 441 + path = os.getenv(
> 442 + if path == None:
> 443 + self.skipTest(
> set.")
>
> Don't do this. For a start, PYTHONPATH can be multiple directories, or it can
> be empty. Your test shouldn't rely on a specific configuration in order to
> run.
> 444 +
> 445 + desktop_file = os.path.join(path, "unity/
> 446 + desktop_file = os.path.
>
> Again, this won't work if PYTHONPATH is empty or is set to multiple
> directories. If you *really* need to get the path of this file you can do:
>
> os.path.
>
> ... which will give you something like '/home/
> ws/branchname/
>
> 447 +
> 448 + old_value = self.call_
> 'com.canonical.
> 449 + value = eval(old_value)
>
> Can you please explain what's going on here? Generally speaking, calling
> 'eval' is a bad idea, and is especially bad when passing it a string that
> comes from elsewhere. What happens when I set that config option to 'import
> subprocess;
>
> 450 + value.append(
> 451 + self.addCleanup
> 'com.canonical.
> 452 + self.call_
> 'favorites', str(value))
>
> Again, I'm not sure what this is supposed to do. I'm sure that we can find a
> better way to do it though. The launcher emulator already has a method that
> allows you to add a custom .desktop file to the launcher - can you use that?
No because we need a local .desktop file with a X-Unity- IconBackroundCo lor key applications.
and we cannot edit a .desktop file in /usr/share/
> If not, let me know what you need and I'll try and come up with a solution for
> you.
>
If you can find another way to test it (with AP) let me know :)
> model.get_ icon_by_ desktop_ id(desktop_ file) (icon, NotEquals(None)) (icon.bg_ color_red, Eventually( Equals( 0xaa))) (icon.bg_ color_green, Eventually( Equals( 0xbb))) (icon.bg_ color_blue, Eventually( Equals( 0xcc))) (icon.bg_ color_alpha, Eventually( Equals( 0xff)))
> 453 +
> 454 + icon = self.launcher.
> 455 + self.assertThat
> 456 + self.assertThat
> 457 + self.assertThat
> 458 + self.assertThat
> 459 + self.assertThat
> 460 +
>
> This part is fine however :)