Merge lp:~mc-return/unity/unity.merge-fix-launcher-should-never-autohide-when-pointer-hovers-it into lp:unity
| Status: | Work in progress |
|---|---|
| Proposed branch: | lp:~mc-return/unity/unity.merge-fix-launcher-should-never-autohide-when-pointer-hovers-it |
| Merge into: | lp:unity |
| Diff against target: |
33 lines (+2/-7) 2 files modified
launcher/LauncherHideMachine.cpp (+2/-5) launcher/LauncherHideMachine.h (+0/-2) |
| To merge this branch: | bzr merge lp:~mc-return/unity/unity.merge-fix-launcher-should-never-autohide-when-pointer-hovers-it |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Unity Team | 2012-09-07 | Pending | |
|
Review via email:
|
|||
Commit Message
Simplified the check if the launcher should hide again once it is revealed. It should never hide if
1. VISIBLE_REQUIRED is true or
2. MOUSE_OVER_LAUNCHER is true
There is no need to check for movement of the mouse (which is set to true once decaymulator_.value > reveal_pressure)
Also removed remains of the hide_modes DODGE_WINDOWS and DODGE_ACTIVE_WINDOW forgotten in rev1933, which removed the dodge window modes.
| MC Return (mc-return) wrote : | # |
| Didier Roche (didrocks) wrote : | # |
This is breaking this use case:
- put the mouse in the launcher area (launcher hidden)
- press super
- release it
-> the launcher will still be shown.
what it should do: it should hide as you triggered a keyboard-only event.
| Sam Spilsbury (smspillaz) wrote : | # |
Hey, looks good.
Do you know if this code is covered by unit tests? Or will tests need to be written?
| MC Return (mc-return) wrote : | # |
I did not check if it is already covered by unit tests, but I could write a manual test.
| Sam Spilsbury (smspillaz) wrote : | # |
Nah, unit tests are the way to go.
I had a look and its not covered by any so far. The good news is that it should be fairly easy to get this class under test.
Lets have a look at an existing testcase:
test_launcher.cpp
using namespace testing; // pulls in the ::testing namespace. I usually don't do this and prefer using ::testing::_; for the various bits I need but I guess its the unity style
#include <Nux/Nux.h>
#include <Nux/BaseWindow.h>
#include "launcher/
#include "test_utils.h"
using namespace unity;
namespace unity
{
namespace launcher
{
class TestLauncher : public Test // This is the test fixture class, so in your case you'd have TestLauncherHid
{
public:
...
TestLauncher()
: ...
, launcher_(new MockLauncher(
{
launcher_
launcher_
}
...
nux::
};
TEST_F(
{
MockMockLaunc
model_
MockMockLaunc
model_
MockMockLaunc
model_
EXPECT_
.
EXPECT_
.
EXPECT_
.
std::list<char*> uris;
dnd_collectio
Utils:
EXPECT_
EXPECT_
EXPECT_
}
}
}
So in your case, you want to instantiate LauncherHideMachine and then check LauncherHideMac
As an aside, _should_show_quirk is unintialized when you hit this point in the code:
12 + _should_show_quirk = (HideQuirk)
So this can be expressed as:
12 + _should_show_quirk = (HideQuirk)
Bonus points for initializing _should_show_quirk when it is declared too. Eg
HideQuirk _should_show_quirk = DEFAULT;
| MC Return (mc-return) wrote : | # |
> Nah, unit tests are the way to go.
>
> I had a look and its not covered by any so far. The good news is that it
> should be fairly easy to get this class under test.
>
Okay, I'll try it.
> Lets have a look at an existing testcase:
>
> test_launcher.cpp
>
> using namespace testing; // pulls in the ::testing namespace. I usually don't
> do this and prefer using ::testing::_; for the various bits I need but I guess
> its the unity style
>
> #include <Nux/Nux.h>
> #include <Nux/BaseWindow.h>
>
> #include "launcher/
> #include "test_utils.h"
> using namespace unity;
>
> namespace unity
> {
> namespace launcher
> {
>
> class TestLauncher : public Test // This is the test fixture class, so in your
> case you'd have TestLauncherHid
> {
> public:
> ...
>
> TestLauncher()
> : ...
> , launcher_(new MockLauncher(
> initialize "MockLauncher" in our case it would be LauncherHideMachine
> {
> launcher_->options = options_;
> launcher_
> }
>
> ...
> nux::ObjectPtr<
> };
>
> TEST_F(
> TestLauncher test fixture
> {
> MockMockLaunche
> can have their function calls traced.
> model_-
>
> MockMockLaunche
> model_-
>
> MockMockLaunche
> model_-
>
> EXPECT_CALL(*first, ShouldHighlight
> .WillRepeatedly
>
> EXPECT_
> .WillRepeatedly
>
> EXPECT_CALL(*third, ShouldHighlight
> class
> .WillRepeatedly
>
> std::list<char*> uris;
> dnd_collection_
>
> Utils::
>
> EXPECT_
> // Expecting the value of GetQuirk
> (launcher:
> EXPECT_
> EXPECT_
> }
>
> }
> }
>
>
> So in your case, you want to instantiate LauncherHideMachine and then check
> LauncherHideMac
> LauncherHideMac
> (VISIBLE_REQUIRED | MOUSE_OVER_
>
Thanks for the detailed explanation. This is really appreciated :)
> As an aside, _should_show_quirk is unintialized when you hit this point in the
> code:
> 12 + _should_show_quirk = (HideQuirk)
> (VISIBLE_REQUIRED) | MOUSE_OVER_
>
> So this can be expressed as:
>
> 12 + _should_show_quirk = (HideQuirk)
> MOUSE_OVER_
>
> Bonus points for initializing _should_show_quirk when it is declared too. Eg
>
> HideQuirk _should_show_quirk = DEFAU...
Unmerged revisions
- 2662. By MC Return on 2012-09-07
-
Removed DODGE_WINDOWS and DODGE_ACTIVE_WINDOW because these modes are not available anymore
- 2661. By MC Return on 2012-09-07
-
More simplifying for better readability
- 2660. By MC Return on 2012-09-07
-
Fixed usage of the uninitialized variable _should_show_quirk
- 2659. By MC Return on 2012-09-07
-
Rebased on latest lp:unity
- 2658. By MC Return on 2012-09-07
-
Simplify the check if the launcher should hide again once it is revealed. It should never hide if
1. _should_show_quirk is true or
2. VISIBLE_REQUIRED is true or
3. MOUSE_OVER_LAUNCHER is trueThere is no need to check for movement of the mouse (which is set to true once decaymulator_.value > reveal_pressure)


Simplifies the check if the launcher should hide again once it is revealed. It should never hide if
1. _should_show_quirk is true or
2. VISIBLE_REQUIRED is true or
3. MOUSE_OVER_LAUNCHER is true
There is no need to check for movement of the mouse (which is set to true once decaymulator_.value > reveal_pressure)