1 /*
2 * *************************************************************************************************************************************************************
3 *
4 * SteelBlue: DCI User Interfaces
5 * http://tidalwave.it/projects/steelblue
6 *
7 * Copyright (C) 2015 - 2025 by Tidalwave s.a.s. (http://tidalwave.it)
8 *
9 * *************************************************************************************************************************************************************
10 *
11 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
18 *
19 * *************************************************************************************************************************************************************
20 *
21 * git clone https://bitbucket.org/tidalwave/steelblue-src
22 * git clone https://github.com/tidalwave-it/steelblue-src
23 *
24 * *************************************************************************************************************************************************************
25 */
26 package it.tidalwave.ui.core.spi;
27
28 import jakarta.annotation.Nonnull;
29 import java.util.List;
30 import it.tidalwave.ui.core.MenuBarControl;
31 import it.tidalwave.util.Callback;
32 import it.tidalwave.ui.core.role.Displayable;
33 import it.tidalwave.ui.core.role.UserAction;
34 import static org.mockito.Mockito.*;
35
36 /***************************************************************************************************************************************************************
37 *
38 * @author Fabrizio Giudici
39 *
40 **************************************************************************************************************************************************************/
41 public class TestUserActions
42 {
43 @Nonnull
44 public final UserAction actionFileOpen;
45
46 @Nonnull
47 public final UserAction actionFileClose;
48
49 @Nonnull
50 public final UserAction actionFileCloseAll;
51
52 @Nonnull
53 public final UserAction actionEditUndo;
54
55 @Nonnull
56 public final UserAction actionEditRedo;
57
58 @Nonnull
59 public final UserAction actionSelectSelectAll;
60
61 @Nonnull
62 public final UserAction actionSelectDeselect;
63
64 @Nonnull
65 public final UserAction actionNoMenuBar;
66
67 public TestUserActions()
68 {
69 actionFileOpen = createAction("Open", "File");
70 actionFileClose = createAction("Close", "File");
71 actionFileCloseAll = createAction("Close all", "File");
72 actionEditUndo = createAction("Undo", "Edit");
73 actionEditRedo = createAction("Redo", "Edit");
74 actionSelectSelectAll = createAction("Select all", "Select");
75 actionSelectDeselect = createAction("Deselect", "Select");
76 actionNoMenuBar = UserAction.of(mock(Callback.class), List.of(Displayable.of("foo bar")));
77 }
78
79 @Nonnull
80 private static UserAction createAction (@Nonnull final String displayName, @Nonnull final String path)
81 {
82 return UserAction.of(mock(Callback.class), List.of(Displayable.of(displayName), MenuBarControl.MenuPlacement.under(path)));
83 }
84 }