• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Martomate / TriPaint / 9275511596

28 May 2024 07:51PM UTC coverage: 29.682% (+1.8%) from 27.877%
9275511596

push

github

Martomate
Updated to Scala 3.4 and MUnit 1.0

2 of 11 new or added lines in 9 files covered. (18.18%)

430 existing lines in 38 files now uncovered.

401 of 1351 relevant lines covered (29.68%)

0.3 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/scala/tripaint/view/gui/TheMenuBar.scala
1
package tripaint.view.gui
2

3
import tripaint.view.{MenuBarAction, TriPaintViewListener}
4

5
import scalafx.scene.control.{Menu, MenuBar, MenuItem, SeparatorMenuItem}
6
import scalafx.scene.image.ImageView
7

8
object TheMenuBar {
9
  def create(controls: TriPaintViewListener): MenuBar = {
×
UNCOV
10
    val menu_file = makeMenu(
×
11
      "File",
12
      makeMenuItem(controls, MainStageButtons.New),
×
13
      makeMenuItem(controls, MainStageButtons.Open),
×
14
      makeMenuItem(controls, MainStageButtons.OpenHexagon),
×
15
      new SeparatorMenuItem,
×
16
      makeMenuItem(controls, MainStageButtons.Save),
×
17
      makeMenuItem(controls, MainStageButtons.SaveAs),
×
18
      new SeparatorMenuItem,
×
UNCOV
19
      makeMenuItem(controls, MainStageButtons.Exit)
×
20
    )
21

UNCOV
22
    val menu_edit = makeMenu(
×
23
      "Edit",
24
      makeMenuItem(controls, MainStageButtons.Undo),
×
25
      makeMenuItem(controls, MainStageButtons.Redo),
×
26
      new SeparatorMenuItem,
×
27
      makeMenuItem(controls, MainStageButtons.Cut),
×
28
      makeMenuItem(controls, MainStageButtons.Copy),
×
UNCOV
29
      makeMenuItem(controls, MainStageButtons.Paste)
×
30
    )
31

32
    val menu_organize =
UNCOV
33
      makeMenu(
×
34
        "Organize",
35
        makeMenuItem(controls, MainStageButtons.Move),
×
36
        makeMenuItem(controls, MainStageButtons.Scale),
×
UNCOV
37
        makeMenuItem(controls, MainStageButtons.Rotate)
×
38
      )
39

UNCOV
40
    val menu_effects = makeMenu(
×
41
      "Effects",
42
      makeMenuItem(controls, MainStageButtons.Blur),
×
43
      makeMenuItem(controls, MainStageButtons.MotionBlur),
×
44
      makeMenuItem(controls, MainStageButtons.RandomNoise),
×
45
      makeMenuItem(controls, MainStageButtons.Scramble),
×
UNCOV
46
      makeMenuItem(controls, MainStageButtons.Cell)
×
47
    )
48

49
    val menuBar = new MenuBar
×
50
    menuBar.useSystemMenuBar = true
×
UNCOV
51
    menuBar.menus = Seq(menu_file, menu_edit, menu_organize, menu_effects)
×
52
    menuBar
53
  }
54

55
  private def makeMenu(text: String, menuItems: MenuItem*): Menu = {
×
56
    val menu = new Menu(text)
×
UNCOV
57
    menu.items = menuItems
×
58
    menu
59
  }
60

61
  private def makeMenuItem(controls: TriPaintViewListener, action: MenuBarAction): MenuItem = {
×
62
    val item = if action.imagePath == null then {
×
63
      new MenuItem(action.text)
×
64
    } else {
×
UNCOV
65
      new MenuItem(action.text, new ImageView(s"icons/${action.imagePath}.png"))
×
66
    }
67
    item.onAction = _ => {
×
68
      if action.action != null then {
×
UNCOV
69
        controls.perform(action.action)
×
UNCOV
70
      }
×
71
    }
72
    if action.accelerator != null then {
×
UNCOV
73
      item.accelerator = action.accelerator
×
UNCOV
74
    }
×
75
    item
76
  }
77
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc