%% Generated by lilypond-book
%% Options: [exampleindent=10.16\mm,indent=0\mm,line-width=160\mm,paper-height=845.047\pt,paper-width=597.508\pt,papersize='(cons (* 597.508 pt) (* 845.047 pt))]
\include "lilypond-book-preamble.ly"


% ****************************************************************
% Start cut-&-pastable-section
% ****************************************************************

#(ly:set-option 'eps-box-padding 3.000000)



\paper {
  #(set-paper-size '(cons (* 597.508 pt) (* 845.047 pt)))
  indent = 0\mm
  line-width = 160\mm
  % offset the left padding, also add 1mm as lilypond creates cropped
  % images with a little space on the right
  line-width = #(- line-width (* mm  3.000000) (* mm 1))
}

\layout {
  
}




% ****************************************************************
% ly snippet:
% ****************************************************************
\sourcefilename "/lilypond-2.26.0/input/regression/other/context-property-check.ly"
\sourcefileline 0
\version "2.25.31"

\header {
  texidoc="This test covers @code{\\contextPropertyCheck}.  It should run with
expected warnings.  The visual output is not important."
}

#(ly:set-option 'warning-as-error #t)

{
  %% Warning about Score.timing after failing to access Global is less than
  %% ideal, but users are unlikely to try using Global.
  #(ly:expect-warning
    (ly:translate-cpp-warning-scheme "cannot find context: %s")
    "Global")
  #(ly:expect-warning
    (G_ "~a.~a is ~a; expected ~a")
    "Score" "timing" #t "dummy A")
  \contextPropertyCheck Global.timing "dummy A"

  #(ly:expect-warning
    (G_ "~a.~a is ~a; expected ~a")
    "Score" "timing" #t "dummy B")
  \contextPropertyCheck timing "dummy B"

  s
}

\context VaticanaScore {
  \contextPropertyCheck Score.timing ##f
  \contextPropertyCheck Score.vocalName \default

  #(ly:expect-warning
    (ly:translate-cpp-warning-scheme "cannot find context: %s")
    "VaticanaDrumVoice")
  \contextPropertyCheck VaticanaDrumVoice.timing ##f

  \context VaticanaStaff {
    \set VaticanaScore.measureBarType = "-span|"
    \contextPropertyCheck Score.measureBarType "-span|"
    #(ly:expect-warning
      (G_ "~a.~a is ~a; expected ~a")
      "VaticanaScore" "measureBarType" "-span|" "dummy D")
    \contextPropertyCheck Score.measureBarType "dummy D"

    \contextPropertyCheck Staff.measureBarType #'()
    #(ly:expect-warning
      (G_ "~a.~a is ~a; expected ~a")
      "VaticanaStaff" "measureBarType" "()" "dummy E")
    \contextPropertyCheck Staff.measureBarType "dummy E"

    \unset VaticanaStaff.measureBarType
    \contextPropertyCheck Staff.measureBarType \default
    #(ly:expect-warning
      (G_ "~a.~a is ~a; expected ~a")
      "VaticanaStaff" "measureBarType" (G_ "unset") "dummy F")
    \contextPropertyCheck Staff.measureBarType "dummy F"

    s % descends to Bottom (VaticanaVoice)

    \contextPropertyCheck timing \default
    \contextPropertyCheck Bottom.timing \default
    \contextPropertyCheck VaticanaVoice.timing \default
    \contextPropertyCheck Voice.timing \default

    \contextPropertyCheck autoBeaming ##f
    \contextPropertyCheck Bottom.autoBeaming ##f
    \contextPropertyCheck VaticanaVoice.autoBeaming ##f
    \contextPropertyCheck Voice.autoBeaming ##f

    #(ly:expect-warning
      (G_ "~a.~a is ~a; expected ~a")
      "VaticanaVoice" "autoBeaming" "#f" "dummy G")
    \contextPropertyCheck Voice.autoBeaming "dummy G"

    #(ly:expect-warning
      (ly:translate-cpp-warning-scheme "cannot find context: %s")
      "DrumVoice")
    \contextPropertyCheck DrumVoice.autoBeaming ##f

    \set measureBarType = "dummy H"
    #(ly:expect-warning
      (G_ "~a.~a is ~a; expected ~a")
      "VaticanaVoice" "measureBarType" "dummy H" "#<unspecified>")
    \contextPropertyCheck measureBarType #*unspecified*

    %% It's a bit weird that a string property is allowed to be set to
    %% *unspecified*, but since it is, we want \contextPropertyCheck to be
    %% able to handle it.
    \set measureBarType = #*unspecified*
    \contextPropertyCheck measureBarType #*unspecified*
  }
}

testModImplicit = \with {
  \propertySet instrumentName "dummy L"
  \contextPropertyCheck instrumentName "dummy L"
  \contextPropertyCheck instrumentName "dummy M"
}

#(ly:expect-warning
  (G_ "~a.~a is ~a; expected ~a")
  "Score" "instrumentName" "dummy L" "dummy M")
\new Score \with { \testModImplicit } <<
  R1
>>

#(ly:expect-warning
  (G_ "~a.~a is ~a; expected ~a")
  "Staff" "instrumentName" "dummy L" "dummy M")
\new Score <<
  \new Staff \with { \testModImplicit } <<
    R1
  >>
>>

testModExplicit = \with {
  \propertySet Staff.instrumentName "dummy J"
  \contextPropertyCheck Staff.instrumentName "dummy J"
  \contextPropertyCheck Staff.instrumentName "dummy K"
}

#(ly:expect-warning
  (G_ "~a.~a is ~a; expected ~a")
  "Score" "instrumentName" "dummy J" "dummy K")
\new Score \with { \testModExplicit } <<
  R1
>>

#(ly:expect-warning
  (G_ "~a.~a is ~a; expected ~a")
  "Staff" "instrumentName" "dummy J" "dummy K")
\new Score <<
  \new Staff \with { \testModExplicit } <<
    R1
  >>
>>



% ****************************************************************
% end ly snippet
% ****************************************************************
