diff --git a/KEYBINDINGS.txt b/KEYBINDINGS.txt index 07463ee..b8939c8 100644 --- a/KEYBINDINGS.txt +++ b/KEYBINDINGS.txt @@ -1,4 +1,4 @@ -Ruen UI - ESDF key map (2026.11.22.3-beta.1) +Ruen UI - ESDF key map (2026.11.22.4-beta.1) MOVEMENT Q W [E] R T @@ -194,7 +194,9 @@ Nearby stock gunfire is muted while enabled; off restores native audio. LAYOUT RECOVERY (outside combat, with Edit Mode closed) /ruen chat reset Restore compact chat size/position; reposition nearby bars. -/ruen layout reset Restore Ruen-managed default positions/sizes. +/ruen layout reset Reset all native Edit Mode positions, Ruen controls and + supported bundled windows (Spoken/Compendium/world map). + Bags/tooltips/alerts reflow; unsupported resets are listed. Both save the active Ruen layout; graphics, bindings and placed abilities stay. Other characters using this same layout see the saved geometry too. /reload loads updated code; it does not undo saved layout edits. diff --git a/README.md b/README.md index 65506bf..d5e3ffb 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A compact, class-aware **WoW: Forever** interface with ESDF controls, English/Ru **[Download the beta](https://scm.bstein.dev/bstein/ruen-ui/releases)** · **[Windows installation](docs/INSTALL.md)** · **[Инструкция на русском](docs/INSTALL-RU.md)** · **[Release review](docs/RELEASE-REVIEW.md)** · **[Report a problem](https://scm.bstein.dev/bstein/ruen-ui/issues)** -Choose **Ruen-UI-2026.11.22.3-beta.1.zip** under release assets, not Gitea's automatic source ZIP. No account is needed to download. The download is small; setup then retrieves the selected companion addons directly from their authors. +Choose **Ruen-UI-2026.11.22.4-beta.1.zip** under release assets, not Gitea's automatic source ZIP. No account is needed to download. The download is small; setup then retrieves the selected companion addons directly from their authors. ## Windows quick start diff --git a/RuenUI/ClassAssist.lua b/RuenUI/ClassAssist.lua index b34aa8d..98ca6a8 100644 --- a/RuenUI/ClassAssist.lua +++ b/RuenUI/ClassAssist.lua @@ -265,6 +265,11 @@ local function refresh() end end +function P.ResetClassAssistLayoutState() + appliedContext = nil + P.classAssistReserved = {} +end + function P.RefreshClassAssist() if busy or not owns then return end if InCombatLockdown() then return end -- native code handles combat visibility diff --git a/RuenUI/ClassLayout.lua b/RuenUI/ClassLayout.lua index b6b2296..72401fe 100644 --- a/RuenUI/ClassLayout.lua +++ b/RuenUI/ClassLayout.lua @@ -171,6 +171,10 @@ function P.MigrateClassLayout() end local widgetBaseScale,widgetAppliedScale +function P.ResetClassLayoutState() + widgetBaseScale, widgetAppliedScale = 1, nil +end + function P.PositionEncounterWidgets(place,edge) local f=UIWidgetTopCenterContainerFrame if not f then return end diff --git a/RuenUI/Controls.lua b/RuenUI/Controls.lua index 04ac02b..3368f51 100644 --- a/RuenUI/Controls.lua +++ b/RuenUI/Controls.lua @@ -126,8 +126,8 @@ function P.Help() say("F6 enemy nameplates, Shift-F6 all, Ctrl-F6 friendly; F8 macros; F9 settings; Shift-F9 keybindings; F10 housing (where available); Esc game menu.") say("U interact, Shift-U assist, Alt-U ping; Ctrl-I sit, Shift-I sheathe. F12 this help; Shift-F12 support.") say("/ruen language en|ru: game text/audio + narration; client restart required. /ruen voice en|ru: narration only, immediate. /ruen language: status.") - say(P.Localized("/ruen chat reset: restore chat size/position. /ruen layout reset: restore Ruen positions/sizes; keep graphics, keys and assigned abilities.", - "/ruen chat reset: сброс размера и положения чата. /ruen layout reset: сброс положения и размеров элементов Ruen; графика, клавиши и способности сохраняются.")) + say(P.Localized("/ruen chat reset: restore chat size/position. /ruen layout reset: reset native UI, Ruen and bundled window positions; keep graphics, keys and assigned abilities.", + "/ruen chat reset: сброс размера и положения чата. /ruen layout reset: сброс положения стандартных элементов, Ruen и окон комплекта; графика, клавиши и способности сохраняются.")) say("/ruen bindings: reapply mouse/menu keys; /ruen bags: reposition bags; /ruen pet auto: reset the two extra pet buttons. /ruen status | balanced | performance | bench | export | restore. /ruen apply reapplies gameplay/key defaults and selects the saved Ruen layout.") end diff --git a/RuenUI/Core.lua b/RuenUI/Core.lua index f2f0529..afd0865 100644 --- a/RuenUI/Core.lua +++ b/RuenUI/Core.lua @@ -671,6 +671,7 @@ local function restoreClickBar() end local function configureChatSystem(system) + system.anchorInfo2 = nil local chat=P.layoutPolicy.chat changeSetting(system, Enum.EditModeChatFrameSetting.WidthHundreds, math.floor(chat.width/100)) changeSetting(system, Enum.EditModeChatFrameSetting.WidthTensAndOnes, chat.width%100) @@ -793,6 +794,7 @@ end local function recordLayoutStatus(announce) local status = {bars = {}, time = time(), verified = true, release=P.release, uiWidth=UIParent:GetWidth(),uiHeight=UIParent:GetHeight(),uiScale=UIParent:GetEffectiveScale()} + status.layoutReset = RuenUICharacter.layoutResetStatus status.cooldowns={} for _,name in ipairs({"EssentialCooldownViewer","UtilityCooldownViewer","BuffIconCooldownViewer","BuffBarCooldownViewer"}) do local f=_G[name] @@ -930,19 +932,38 @@ local function resetLayout(chatOnly) local data = P.CopyEditModeLayouts() local layout = data.layouts[data.activeLayout] local before = C_EditMode.ConvertLayoutInfoToString(layout) + local report = not chatOnly and P.ResetNativeLayoutPositions(layout) configureDefaultLayout(layout, chatOnly) chatBaseWidth, chatAppliedWidth = nil, nil - if not chatOnly then trackerBaseWidth, trackerAppliedWidth = nil, nil end + if not chatOnly then + trackerBaseWidth, trackerAppliedWidth = nil, nil + bagBaseScale, bagAppliedScale = 1, nil + P.ResetClassLayoutState() + P.ResetOverlayLayoutState() + P.ResetClassAssistLayoutState() + end P.SaveEditModeLayouts(data) -- Bounded recovery export, available for native Edit Mode import. RuenUICharacter.layoutBeforeReset = before + if report then + P.ResetNativePanelPositions(report) + P.ResetCompanionPositions(report) + RuenUICharacter.layoutResetStatus = report + end C_Timer.After(0.5, function() refreshUILayout() + if not chatOnly and not InCombatLockdown() and ownsLayout() and GameTooltip:IsShown() then + positionCombinedBags() + P.PositionTooltip(GameTooltip, true) + end recordLayoutStatus(false) say(chatOnly and P.Localized("Chat size and position reset; nearby bars repositioned. Layout saved.", "Размер и положение чата сброшены; соседние панели перемещены. Расположение сохранено.") - or P.Localized("Ruen layout positions and sizes reset and saved. Graphics, keybindings and assigned abilities preserved.", - "Положение и размеры элементов Ruen сброшены и сохранены. Графика, клавиши и назначенные способности сохранены.")) + or P.Localized("UI positions reset and saved: native frames, Ruen controls and bundled windows. Graphics, keybindings and assigned abilities preserved.", + "Положение элементов интерфейса сброшено и сохранено: стандартные элементы, панели Ruen и окна комплекта. Графика, клавиши и способности сохранены.")) + if report and #report.unavailable > 0 then + say(P.Localized("Position reset unavailable for: ", "Не удалось сбросить положение: ") .. table.concat(report.unavailable, ", ")) + end end) end diff --git a/RuenUI/LayoutRecovery.lua b/RuenUI/LayoutRecovery.lua new file mode 100644 index 0000000..cb2dbec --- /dev/null +++ b/RuenUI/LayoutRecovery.lua @@ -0,0 +1,97 @@ +local _, P = ... + +-- Explicit recovery only: no recurring work and no edits to live systemInfo. +-- Cover every native system, including ones this class has not displayed yet. +function P.ResetNativeLayoutPositions(layout) + local manager = EditModePresetLayoutManager + local defaults = manager and manager:GetCopyOfPresetLayouts() + assert(defaults and defaults[1], "Native layout defaults are not ready") + local index = {} + for _, system in ipairs(defaults[1].systems or {}) do + local key = system.system .. ":" .. tostring(system.systemIndex or 0) + index[key] = system + end + local report = {native = 0, unavailable = {}, companions = {}} + for _, system in ipairs(layout.systems or {}) do + local key = system.system .. ":" .. tostring(system.systemIndex or 0) + local preset = index[key] + local position = preset and preset.anchorInfo + if not position and manager.GetDefaultSystemAnchorInfo then + local ok, result = pcall(manager.GetDefaultSystemAnchorInfo, manager, system.system, system.systemIndex) + if ok then position = result end + end + if position then + system.anchorInfo = CopyTable(position) + system.anchorInfo2 = nil -- discard secondary snap anchors too + system.isInDefaultPosition = true + report.native = report.native + 1 + else + report.unavailable[#report.unavailable + 1] = "native system " .. key + end + end + return report +end + +local function attempt(report, label, fn) + local ok, result = pcall(fn) + if not ok or result == false then + report.unavailable[#report.unavailable + 1] = label + else + report.companions[#report.companions + 1] = label + end +end + +function P.ResetCompanionPositions(report) + local spoken = SpokenEnv + if spoken and spoken.Options and spoken.Options.ResetPositions then + -- Upstream's position-only reset preserves narration, volume and style. + attempt(report, "Spoken narration", function() spoken.Options:ResetPositions() end) + end + local compendium = SpokenCompendium and SpokenCompendium.window + if compendium then + attempt(report, "Compendium", function() + compendium:ClearAllPoints() + compendium:SetPoint("CENTER", UIParent, "CENTER", 0, 0) + if compendium.SetUserPlaced then compendium:SetUserPlaced(false) end + end) + end + if C_AddOns and C_AddOns.IsAddOnLoaded("Leatrix_Maps") then + -- Leatrix keeps a private live copy of its DB and overwrites saved + -- values at logout. Use its own position-only reset, not a DB write + -- that appears to work and is then silently undone. The pinned build + -- exposes this button on its main panel; tiptext is locale-independent. + attempt(report, "Leatrix Maps", function() + for _, name in ipairs(UISpecialFrames or {}) do + local panel = _G[name] + if panel and panel.GetChildren and not (panel.IsForbidden and panel:IsForbidden()) then + for _, child in ipairs({panel:GetChildren()}) do + if not (child.IsForbidden and child:IsForbidden()) + and child.tiptext == "Click to reset the map position and scale to the game default." then + local click = child:GetScript("OnClick") + if not click or (child.IsEnabled and not child:IsEnabled()) then return false end + click(child, "LeftButton") + return true + end + end + end + end + return false + end) + end +end + +function P.ResetNativePanelPositions(report) + -- Hand ordinary windows (bank, professions, spellbook, merchant, etc.) + -- back to Blizzard's panel manager. Never replace protected handlers or + -- write UIPanelWindows/UIPanelLayout attributes from addon code. + if not UpdateUIPanelPositions then return end + attempt(report, "Native panels", function() + for name in pairs(UIPanelWindows or {}) do + local panel = _G[name] + if panel and panel.SetUserPlaced and not (panel.IsForbidden and panel:IsForbidden()) then + panel:SetUserPlaced(false) + end + end + UpdateUIPanelPositions() + end) +end diff --git a/RuenUI/OverlayLayout.lua b/RuenUI/OverlayLayout.lua index 8c8ce92..3067d38 100644 --- a/RuenUI/OverlayLayout.lua +++ b/RuenUI/OverlayLayout.lua @@ -295,6 +295,13 @@ end local tooltipPositions=setmetatable({},{__mode="k"}) +function P.ResetOverlayLayoutState() + tooltipPositions = setmetatable({},{__mode="k"}) + for _, state in pairs(alertScales) do state.base=1 end + P.tooltipUnplaced, P.tooltipOverInventory, P.tooltipOverSocial = nil, nil, nil + P.overlayRevision = (P.overlayRevision or 0) + 1 +end + function P.ResetTooltipPosition(tooltip) tooltipPositions[tooltip]=nil P.tooltipUnplaced=nil diff --git a/RuenUI/Profile.lua b/RuenUI/Profile.lua index 152cb6c..9be5d9a 100644 --- a/RuenUI/Profile.lua +++ b/RuenUI/Profile.lua @@ -1,6 +1,6 @@ local _, P = ... P.version = 5 -P.release = "2026.11.22.3-beta.1" +P.release = "2026.11.22.4-beta.1" P.graphicsVersion = 2 P.layoutName = "Ruen UI - Clear ESDF" function P.IsOurLayout(layout) diff --git a/RuenUI/RuenUI.toc b/RuenUI/RuenUI.toc index 61b3c30..543bb68 100644 --- a/RuenUI/RuenUI.toc +++ b/RuenUI/RuenUI.toc @@ -1,7 +1,7 @@ ## Interface: 16001 ## Title: Ruen UI ## Notes: ESDF, mouse and menu controls, inventory layout and Spoken language controls. /ruen help -## Version: 2026.11.22.3-beta.1 +## Version: 2026.11.22.4-beta.1 ## Author: Ruen UI contributors ## SavedVariables: RuenUIDB ## SavedVariablesPerCharacter: RuenUICharacter @@ -28,4 +28,5 @@ FrameTiming.lua Optimizer.lua Benchmark.lua AddonPresets.lua +LayoutRecovery.lua Core.lua diff --git a/docs/INSTALL-RU.md b/docs/INSTALL-RU.md index 3d4d113..ea379cf 100644 --- a/docs/INSTALL-RU.md +++ b/docs/INSTALL-RU.md @@ -34,7 +34,7 @@ Панель питомца — это **10 стандартных ячеек и 2 расширения** с использованием свободных ячеек второй страницы панели действий. Игра не получает дополнительные стандартные ячейки питомца. Если свободных ячеек нет, Ruen сообщает об этом и не затирает существующие способности. -Чтобы отменить увеличение или перемещение чата, закройте режим редактирования, выйдите из боя и введите `/ruen chat reset`. Команда восстановит компактный размер и положение чата и переместит соседние панели. `/ruen layout reset` восстановит стандартное положение и размеры всех управляемых элементов в активном расположении Ruen. Графика, клавиши, способности, шрифт и фильтры чата, режимы перезарядок и счётчиков сохраняются. Другие расположения не меняются. Сохранённое расположение Ruen используется всеми персонажами, выбравшими его. Предыдущая строка экспорта хранится в `RuenUICharacter.layoutBeforeReset`. `/reload` загружает обновлённый код, но не отменяет сохранённые изменения расположения. +Чтобы отменить увеличение или перемещение чата, закройте режим редактирования, выйдите из боя и введите `/ruen chat reset`. Команда восстановит компактный размер и положение чата и переместит соседние панели. `/ruen layout reset` сбрасывает положение всех элементов режима редактирования WoW, включая эффекты, питомца, боссов, арену и предупреждения рейда, затем применяет расположение и размеры Ruen. Также пересчитываются сумки, подсказки и уведомления, перемещаются открытые стандартные окна, сбрасывается положение окон Spoken/Compendium и карты Leatrix Maps. Неподдерживаемые элементы перечисляются в чате; сторонние аддоны вне комплекта управляют своим расположением самостоятельно. Графика, клавиши, способности, шрифт и фильтры чата, режимы перезарядок и счётчиков сохраняются. Другие расположения не меняются. Сохранённое расположение Ruen используется всеми персонажами, выбравшими его. Предыдущая строка экспорта хранится в `RuenUICharacter.layoutBeforeReset`. `/reload` загружает обновлённый код, но не отменяет сохранённые изменения расположения. После обновления проверьте `/ruen status`, цифровые клавиши, смену защитной/пассивной стойки, вызов питомца и сумки при выбранной цели. Для сравнения FPS запустите `/ruen bench` и три минуты играйте, не переключаясь в другое окно: фоновое ограничение FPS иначе исказит результат. Следующая строка показывает время CPU Ruen, если встроенный профилировщик доступен. При рывках сообщите обе строки; измерение не меняет настройки графики. Подробные ограничения беты: [RELEASE-REVIEW.md](RELEASE-REVIEW.md). diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 0e3f15d..1711f9c 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -54,7 +54,7 @@ This update keeps existing actions, personal keybindings and saved language/grap The pet bar is **ten native pet slots plus two extensions**, backed by spare slots on unused action page 2. It cannot create native pet slots 11 and 12. If the backing page is full, Ruen reports the limitation and preserves the existing actions. The two extensions use the same selected-state artwork as native buttons; the game determines which stance is active. -To undo an enlarged or moved chatbox, close Edit Mode and leave combat, then use `/ruen chat reset`. This restores the compact default size/position and repositions the nearby bars. `/ruen layout reset` restores all Ruen-managed default positions and sizes in the active Ruen layout. Both save the result without changing graphics, keybindings, assigned abilities, chat font/filter preferences or the selected cooldown/meter modes. Other Edit Mode layouts are retained. Ruen layouts are shared, so their saved geometry also applies to other characters using that layout. The previous layout export is retained in `RuenUICharacter.layoutBeforeReset` for recovery. `/reload` loads updated code; it does not itself undo your saved layout edits. `/ruen apply` reapplies gameplay/key defaults and selects the existing saved layout, so it is not the command for undoing a chat resize. +To undo an enlarged or moved chatbox, close Edit Mode and leave combat, then use `/ruen chat reset`. This restores the compact default size/position and repositions the nearby bars. `/ruen layout reset` restores every native Edit Mode system position (including buffs/debuffs, pet/boss/arena frames, raid warnings and hidden class elements), then applies Ruen's default controls and sizes. It also resets bag/tooltip/alert placement caches, repositions the current native panels, restores Spoken narration/Compendium positions and invokes Leatrix Maps' own map-position reset. Frames that are not currently visible receive their saved native positions when they appear. Unsupported native systems or changed companion APIs are reported explicitly instead of silently claiming success; unrelated third-party addons retain their own layout controls. Both save the result without changing graphics, keybindings, assigned abilities, chat font/filter preferences or the selected cooldown/meter modes. Other Edit Mode layouts are retained. Ruen layouts are shared, so their saved geometry also applies to other characters using that layout. The previous layout export is retained in `RuenUICharacter.layoutBeforeReset` for recovery. `/reload` loads updated code; it does not itself undo your saved layout edits. `/ruen apply` reapplies gameplay/key defaults and selects the existing saved layout, so it is not the command for undoing a chat resize. Before relying on new bindings in combat, check `/ruen status`, press the number keys, and verify the indicated actions. On a pet character, test Defensive on an extra button, then Passive on a native button: only the active stance should remain selected. Check click/key activation, right-click autocast where supported, dismissal/resummon, bags with a selected target, and an item comparison tooltip. The release review distinguishes automated checks from live coverage. diff --git a/docs/RELEASE-REVIEW.md b/docs/RELEASE-REVIEW.md index c4e22ee..82aa1bb 100644 --- a/docs/RELEASE-REVIEW.md +++ b/docs/RELEASE-REVIEW.md @@ -1,12 +1,14 @@ -# Release review — 2026.11.22.3-beta.1 +# Release review — 2026.11.22.4-beta.1 -## Layout recovery follow-up (2026-11-22) +## Complete layout recovery follow-up (2026-11-22) -- Added `/ruen chat reset` and `/ruen layout reset`; both share initial-install defaults and save detached native layout data. No setup replay, graphics/binding/action changes, or per-frame work is added. -- Chat-only reset repairs saved size/position and reflows nearby bars. Full reset restores Ruen-managed geometry while retaining layout identity and unrelated layouts. Both require the active Ruen layout, no combat, and closed Edit Mode; a single prior layout export is retained for recovery. -- Regression coverage uses the actual slash commands against moved/enlarged chat and all nine class layouts, verifies persistence and preservation of CVars, bindings, assigned actions and unrelated layouts, and checks combat/edit/override/disabled guards. Live in-game reset confirmation remains pending. +- Full reset now starts with every native Edit Mode system anchor, including pet/boss/arena unit frames, buff/debuff groups, raid warnings, timer/resource displays, durability and hidden class features. Secondary snap anchors are discarded. Native defaults come from this client's preset; existing functional settings and other saved layouts are retained. +- Ruen's control/class geometry is then reapplied. Bag scaling, encounter-widget scaling, tooltip caches, alert scaling and optional cooldown layout caches are reset before reflow; meter/cooldown visibility preferences stay unchanged. +- Standard loaded panels are returned to the native panel manager without replacing protected handlers. Spoken's position-only reset and the Compendium window are included. Leatrix Maps uses its pinned upstream reset button (identified by its locale-independent tooltip property) so the private live settings are saved correctly; writing its public DB alone would be undone on logout. +- Unknown native systems and unavailable companion reset APIs are reported in chat and saved diagnostics. Arbitrary third-party addons are outside this reset's ownership. The operation is explicit, guarded out of combat/Edit Mode, and adds no recurring per-frame work. Chat-only reset remains available. +- Regression coverage exercises all 31 native system kinds, indexed unit/action/aura systems, snap-anchor removal, persistence, companion handoff/failures, all nine class layouts and preservation of unrelated settings/actions/bindings. Live in-game full-reset confirmation remains pending. -Reviewed 22 November 2026. **Opt-in public beta; not a general-availability certification.** This release adds explicit chat/layout recovery to the existing graphics feedback and frame-timing updates. It retains the user-confirmed beta8 pet highlight fix and coordinated layout/profile work. The optimizer has detected roughly 0.6-second stalls even at its lowest graphics tier and reports the target as unmet; this layout update does not claim to resolve those stalls. +Reviewed 22 November 2026. **Opt-in public beta; not a general-availability certification.** This release expands explicit chat/layout recovery to the existing graphics feedback and frame-timing updates. It retains the user-confirmed beta8 pet highlight fix and coordinated layout/profile work. The optimizer has detected roughly 0.6-second stalls even at its lowest graphics tier and reports the target as unmet; this layout update does not claim to resolve those stalls. ## Frame timing and scene optimization diff --git a/scripts/build_release.py b/scripts/build_release.py index 26cbb2f..17bfaa3 100644 --- a/scripts/build_release.py +++ b/scripts/build_release.py @@ -7,7 +7,7 @@ from pathlib import Path import zipfile ROOT = Path(__file__).resolve().parents[1] -VERSION = '2026.11.22.3-beta.1' +VERSION = '2026.11.22.4-beta.1' FILES = ['Ruen-Setup', 'Ruen-Setup.exe', 'Install-Ruen-UI.ps1', 'Install-Ruen-UI.cmd', 'Install-Ruen-UI-Russian.cmd', 'Install-Windows.cmd', 'Install-Russian.cmd', 'Optimize-Ruen-UI.ps1', 'dependencies.lock.json', 'README.md', 'LICENSE', diff --git a/scripts/check_release.py b/scripts/check_release.py index 6ead43c..e11f98d 100644 --- a/scripts/check_release.py +++ b/scripts/check_release.py @@ -24,6 +24,7 @@ def main(): checks = [ ('profiles', ['luajit', 'tests/check-profiles.lua', addon]), ('layout-policy', ['luajit', 'tests/check-layout-policy.lua', addon]), + ('layout-recovery', ['luajit', 'tests/check-layout-recovery.lua', addon]), ('pets', ['luajit', 'tests/check-pet-actions.lua', addon]), ('layout', ['luajit', 'tests/check-layout.lua', addon, 'unused', str(args.output.resolve() / 'matrix.txt')]), ('meter', ['luajit', 'tests/check-meter.lua', addon]), diff --git a/tests/check-layout-recovery.lua b/tests/check-layout-recovery.lua new file mode 100644 index 0000000..59af8af --- /dev/null +++ b/tests/check-layout-recovery.lua @@ -0,0 +1,86 @@ +local root=assert(arg[1]) +local P={} +function CopyTable(t) + if type(t)~='table'then return t end + local r={};for k,v in pairs(t)do r[k]=CopyTable(v)end;return r +end +Enum={EditModePresetLayouts={Modern=1}} +APIDocumentation={AddDocumentationTable=function(_,d) + for _,t in ipairs(d.Tables or {})do + if t.Type=='Enumeration'then + Enum[t.Name]={};for _,v in ipairs(t.Fields)do Enum[t.Name][v.Name]=v.EnumValue end + end + end +end} +dofile(assert(os.getenv('RUEN_NATIVE_UI'))..'/EditModeManagerConstantsDocumentation.lua') +local systems={} +for name,kind in pairs(Enum.EditModeSystem)do + local count=name=='UnitFrame' and 8 or name=='ActionBar' and 13 or name=='AuraFrame' and 2 or 1 + for i=1,count do + systems[#systems+1]={system=kind,systemIndex=i,anchorInfo={point='TOPLEFT',relativeTo='UIParent',relativePoint='TOPLEFT',offsetX=kind,offsetY=-i}, + settings={{setting=999,value='PRESERVE PREFERENCE'}}} + end +end +EditModePresetLayoutManager={GetCopyOfPresetLayouts=function()return {{systems=systems}}end} +assert(loadfile(root..'LayoutRecovery.lua'))('RuenUI',P) +local layout={systems=CopyTable(systems)} +for _,s in ipairs(layout.systems)do s.anchorInfo={offsetX=9999};s.anchorInfo2={offsetY=9999};s.isInDefaultPosition=false end +local report=P.ResetNativeLayoutPositions(layout) +assert(report.native==#systems and #report.unavailable==0) +for i,s in ipairs(layout.systems)do + assert(s.anchorInfo.offsetX==systems[i].anchorInfo.offsetX and s.anchorInfo.offsetY==systems[i].anchorInfo.offsetY) + assert(s.anchorInfo~=systems[i].anchorInfo and s.anchorInfo2==nil and s.isInDefaultPosition) + assert(s.settings[1].value=='PRESERVE PREFERENCE','position reset changed a functional setting') +end +layout.systems[1].anchorInfo.offsetX=222 +assert(systems[1].anchorInfo.offsetX~=222,'reset retained shared native anchors') +-- New/unsupported native systems are reported; never assigned guessed points. +layout={systems={{system=999,anchorInfo={offsetX=123}}}} +report=P.ResetNativeLayoutPositions(layout) +assert(#report.unavailable==1 and layout.systems[1].anchorInfo.offsetX==123) +function EditModePresetLayoutManager:GetDefaultSystemAnchorInfo()return {offsetX=456}end +report=P.ResetNativeLayoutPositions(layout) +assert(report.native==1 and #report.unavailable==0 and layout.systems[1].anchorInfo.offsetX==456) + +UIParent={} +local spokenReset=0 +SpokenEnv={Options={ResetPositions=function()spokenReset=spokenReset+1 end}} +local window={} +function window:ClearAllPoints()self.point=nil end +function window:SetPoint(...)self.point={...}end +function window:SetUserPlaced(v)self.userPlaced=v end +SpokenCompendium={window=window} +local liveMap={x=999,scale=2,language='ruRU',key='N'} +local clicks=0 +local button={tiptext='Click to reset the map position and scale to the game default.'} +function button:GetScript(event) + assert(event=='OnClick') + return function()clicks=clicks+1;liveMap.x=16;liveMap.scale=1 end +end +function button:IsEnabled()return true end +-- Random panel names and localized button labels must not affect discovery. +F123random={GetChildren=function()return button end} +UISpecialFrames={'F123random'} +C_AddOns={IsAddOnLoaded=function(name)return name=='Leatrix_Maps'end} +report={unavailable={},companions={}} +P.ResetCompanionPositions(report) +assert(spokenReset==1 and clicks==1 and #report.unavailable==0) +assert(window.point[1]=='CENTER' and window.userPlaced==false) +assert(liveMap.x==16 and liveMap.scale==1 and liveMap.language=='ruRU' and liveMap.key=='N') +function button:IsEnabled()return false end +P.ResetCompanionPositions(report) +assert(clicks==1 and report.unavailable[1]=='Leatrix Maps','locked map reset was not reported') +button.IsEnabled=nil;F123random.GetChildren=function()return end +P.ResetCompanionPositions(report) +assert(clicks==1 and #report.unavailable==2,'unavailable upstream reset was silently claimed') + +local panels=0 +BankFrame={SetUserPlaced=function(_,v)assert(v==false);panels=panels+1 end} +OtherFrame={IsForbidden=function()return true end,SetUserPlaced=function()error('forbidden frame touched')end} +UIPanelWindows={BankFrame={},OtherFrame={},UnloadedPanel={}} +local updates=0 +function UpdateUIPanelPositions()updates=updates+1 end +local original=UIPanelWindows.BankFrame +P.ResetNativePanelPositions(report) +assert(panels==1 and updates==1 and UIPanelWindows.BankFrame==original,'panel reset replaced native bookkeeping') +print('PASS: all 31 native system kinds, indexed pet/boss/arena/aura/action frames, secondary anchors, native fallback, independent preferences, companion live reset and panel-manager handoff') diff --git a/tests/check-layout.lua b/tests/check-layout.lua index ae769c5..71f2662 100644 --- a/tests/check-layout.lua +++ b/tests/check-layout.lua @@ -269,6 +269,7 @@ ContainerFrameCombinedBags.shown=false ContainerFrameCombinedBags.SetScale=ContainerFrameCombinedBags.SetScaleBase if bundled then assert(loadfile(root..'AddonPresets.lua'))('RuenUI',P) end +assert(loadfile(root..'LayoutRecovery.lua'))('RuenUI',P) assert(loadfile(root..'Core.lua'))('RuenUI',P) RuenUICharacter={original={},version=2,addedBindings={['ALT-F']='INTERACTTARGET'}} RuenUIDB={original={},reports={},graphicsVersion=P.graphicsVersion}