from pathlib import Path
import sys
root=Path(__file__).resolve().parents[2]
checks=[]
def need(path,text,label):
    data=(root/path).read_text(encoding='utf-8')
    checks.append((label,text in data))

factory='MASSystem/Application/Facade/MASApplicationWindowControls.ControlFactory.Inputs.vb'
need(factory,'Public Function AddMultilineTextBox','factory multiline')
need(factory,'Public Function AddPasswordTextBox','factory password')
need(factory,'Public Function AddNumericTextBox','factory numeric')
need(factory,'Public Function AddPathTextBox','factory path')
need('Component/Inputs/TextBox/Controls/MASTextBox/MASMultilineTextBox.vb','Me.Multiline = True','multiline default')
need('Component/Inputs/TextBox/Controls/MASTextBox/MASMultilineTextBox.vb','Me.MultilineWordWrap =','word wrap default')
need('Component/Inputs/TextBox/Controls/MASPasswordTextBox/MASPasswordTextBox.vb','Public Event PasswordVisibilityChanged','password event public')
need('Component/Inputs/TextBox/Controls/MASPasswordTextBox/MASPasswordTextBox.vb','Me.UseSystemPasswordChar = True','password masked default')
need('Component/Inputs/TextBox/Controls/MASPasswordTextBox/MASPasswordTextBoxPolicy.vb','normalized = Keys.C OrElse normalized = Keys.X OrElse normalized = Keys.Insert','clipboard block')
need('Component/Inputs/TextBox/Controls/MASNumericTextBox/MASNumericTextBox.vb','Private _allowNegative As Boolean = True','numeric negative default')
need('Component/Inputs/TextBox/Controls/MASNumericTextBox/MASNumericTextBox.vb','Private _allowDecimal As Boolean = False','numeric decimal default')
need('Component/Inputs/TextBox/Controls/MASNumericTextBox/MASNumericTextBoxPolicy.vb','Friend Const DefaultIntegerStep As Double = 1.0R','numeric step')
need('Component/Inputs/TextBox/Controls/MASNumericTextBox/MASNumericTextBoxPolicy.vb','Friend Const DefaultPageStep As Double = 10.0R','numeric page step')
need('Component/Inputs/TextBox/Controls/MASPathTextBox/MASPathTextBox.vb','Private _trimOuterSpacesOnAssign As Boolean = True','path trim default')
need('Component/Inputs/TextBox/Controls/MASPathTextBox/MASPathTextBox.vb','Private _normalizeSlashes As Boolean = False','path slash default')
need('Component/Inputs/TextBox/Controls/MASPathTextBox/MASPathTextBox.vb','Friend Event PathBrowseRequested As EventHandler','browse event nonpublic')
need('docs/reference/api/all-public-types-index.md','| `MASNumericTextBox` | Class | Advanced |','numeric advanced')
need('docs/reference/api/all-public-types-index.md','| `MASPasswordTextBox` | Class | Advanced |','password advanced')
need('docs/reference/api/all-public-types-index.md','| `MASPathTextBox` | Class | Advanced |','path advanced')
need('docs/reference/api/all-public-types-index.md','| `MASMultilineTextBox` | Class | Advanced |','multiline advanced')
need('docs/reference-guide.md','reference/controls/specialized-text-inputs.md','reference link')
need('docs/user/controls.md','../reference/controls/specialized-text-inputs.md','user link')
failed=[label for label,ok in checks if not ok]
print(f'Assertions: {len(checks)-len(failed)} passed, {len(failed)} failed')
if failed:
    print('\n'.join('FAIL: '+x for x in failed))
    sys.exit(1)
