feat: add read-only attr lock views for exchange, shop and storage tooltips
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# AVA2 属性锁定提示:其他物品视图
|
||||
|
||||
AVA2 `uitooltip.py` 从属性槽7/8取锁定序号,普通属性用 SPECIAL_TITLE_COLOR 和 `<<文字>>` 显示;背包、交易、商店、仓库和装备查看共用这条渲染路径。本项目保持七属性基础封包和独立锁定表,通过只读桥接取得相同的显示信息。
|
||||
|
||||
`AttrLockViewsScript.inc` 调用原 tooltip setter 重画完整内容,保留商店价格、仓库 flags 等;只替换锁定属性行的样式。摆摊编辑仍查询自己的背包。使用弱引用保存 tooltip/他人装备窗口,避免 Python 2 含析构对象的引用环。
|
||||
|
||||
## 查询契约
|
||||
|
||||
保留原 `/attr_lock_info token window cell` 自有物品请求,视图扩展为 `/attr_lock_info token context cell vid`。
|
||||
|
||||
| context | 范围 | 服务端约束 |
|
||||
| --- | --- | --- |
|
||||
| 101 | 自己的交易栏 | 当前互相关联的交易,按显示格查找,物品仍属自己且处于交易中 |
|
||||
| 102 | 对方的交易栏 | 同一交易的对手,只查已摆出的物品 |
|
||||
| 103 | 当前玩家商店 | 查询者仍是访客,物品仍属于店主,ID/vnum与在售记录一致 |
|
||||
| 104 | 自己的仓库 | 仓库已加载,格子在实际容量范围内 |
|
||||
| 105 | 自己的商城仓库 | 商城仓库已加载,格子在实际容量范围内 |
|
||||
| 106 | 他人装备查看 | 沿用当前服 do_view_equip 的GM权限,只能取装备槽;vid为已查看的角色 |
|
||||
|
||||
除106外,vid必须为0;不能用其他玩家ID查询背包、仓库或交易以外的物品。每个角色每秒至多一次查询,SQL首次加载失败返回-1,不能当作“没有锁定”。旧服务端忽略新上下文时,仍显示原始物品内容。
|
||||
|
||||
客户端收到回复时检查请求序号、视图、格子、vnum、属性/孔快照和容器代次。交易/商店刷新、关闭、仓库关闭以及装备查看内容变化会隐藏旧提示;迟到回复不能把已关闭视图重新染色。断线清理全部视图状态。
|
||||
|
||||
## 验证
|
||||
|
||||
- 服务端 `tests/features/test_attr_lock_views.py` 直接编译实际查询、显示格查找和访客物品函数,验证归属、访客关系、非连续显示格、关闭容器、GM权限、非法参数、限频和SQL失败。
|
||||
- 客户端 `tests/wiki/test_attr_lock_views.py` 执行实际嵌入脚本,验证各视图高亮、价格保留、刷新/关闭后的迟到回复,以及弱引用释放。
|
||||
- macOS 两个独立普通QA角色已完成双方交易、自有摆摊预览、查看在售物品、仓库管理员正常开仓和商城仓库提示;高亮值为第4条 `(4,6)`,mask=8。另验证关闭交易/商店后的请求没有返回物品信息,普通玩家无法查询他人装备锁定信息。
|
||||
- 本机证据:`build/parity-acceptance-20261018/attr-view-*.json`、`peer/attr-view-*.json`、`attr-view-exchange-live.png`、`attr-views-warehouse-proof.log`。测试驱动不进入发行包。
|
||||
|
||||
边界:聊天物品链接仍沿用原七属性链接格式;活动中的洗练槽保持原动态提示路径。它们不能因此计作AVA2全量提示能力完成。手机真机验收按用户要求暂停,正式服尚未部署本轮变更。
|
||||
@@ -13,8 +13,10 @@ _command=game.GameWindow.BINARY_ServerCommand_Run
|
||||
_close=game.GameWindow.Close
|
||||
_pending={}
|
||||
_serial=0
|
||||
_views={}
|
||||
|
||||
def Snapshot(window,cell):
|
||||
def Snapshot(window,cell,tip=None):
|
||||
if window in _views:return _views[window][0](tip,cell) if tip else None
|
||||
return (player.GetItemIndex(window,cell),
|
||||
tuple(player.GetItemAttribute(window,cell,i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)),
|
||||
tuple(player.GetItemMetinSocket(window,cell,i) for i in xrange(player.METIN_SOCKET_MAX_NUM)))
|
||||
@@ -29,14 +31,17 @@ def Query(self):
|
||||
context=getattr(self,'attrLockContext',None)
|
||||
if not context:return
|
||||
window,cell,snapshot=context
|
||||
if Snapshot(window,cell)!=snapshot:
|
||||
if Snapshot(window,cell,self)!=snapshot:
|
||||
self.attrLockContext=None;self.attrLockMask=0
|
||||
self.HideToolTip()
|
||||
return
|
||||
_serial=(_serial%2147483646)+1
|
||||
self.attrLockNext=app.GetTime()+1.25
|
||||
# A tooltip can be rebuilt frequently during rolling; retain no old requests or windows.
|
||||
_pending.clear();_pending[_serial]=(weakref.ref(self),context)
|
||||
net.SendChatPacket('/attr_lock_info %d %d %d'%(_serial,window,cell))
|
||||
command='/attr_lock_info %d %d %d'%(_serial,window,cell)
|
||||
if window in _views:command+=' %d'%getattr(self,'attrLockVid',0)
|
||||
net.SendChatPacket(command)
|
||||
|
||||
def Inventory(self,cell,window_type=player.INVENTORY):
|
||||
_inventory(self,cell,window_type)
|
||||
@@ -49,9 +54,11 @@ def Rebuild(self):
|
||||
context=getattr(self,'attrLockContext',None)
|
||||
if not context:return
|
||||
window,cell,snapshot=context
|
||||
if Snapshot(window,cell)!=snapshot:return
|
||||
if Snapshot(window,cell,self)!=snapshot:return
|
||||
self.attrLockRendering=True
|
||||
try:_inventory(self,cell,window)
|
||||
try:
|
||||
if window in _views:_views[window][1](self,cell)
|
||||
else:_inventory(self,cell,window)
|
||||
finally:self.attrLockRendering=False
|
||||
|
||||
def Update(self):
|
||||
@@ -91,7 +98,7 @@ def Command(self,line):
|
||||
if request and -1<=mask<=31:
|
||||
owner,context=request;tip=owner()
|
||||
if tip and tip.IsShow() and getattr(tip,'attrLockContext',None)==context:
|
||||
if (window,cell)==context[:2] and vnum==context[2][0] and Snapshot(window,cell)==context[2]:
|
||||
if (window,cell)==context[:2] and vnum==context[2][0] and Snapshot(window,cell,tip)==context[2]:
|
||||
if mask>=0 and mask!=getattr(tip,'attrLockMask',0):
|
||||
tip.attrLockMask=mask;Rebuild(tip)
|
||||
return 1
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
// AVA2 lock lines apply to every real item container; keep the seven-attribute base packet.
|
||||
static const char c_szAttrLockViewsScript[] = R"PY(# -*- coding: utf-8 -*-
|
||||
import exchange,shop,safebox,player,uiToolTip,uiEquipmentDialog,uiSafebox,game,weakref,mt_attr_lock as core
|
||||
Tip=uiToolTip.ItemToolTip
|
||||
_epochs={101:0,102:0,103:0,104:0,105:0,106:0}
|
||||
_visible={104:False,105:False}
|
||||
_tips=weakref.WeakKeyDictionary()
|
||||
|
||||
def Invalidate(kinds):
|
||||
for kind in kinds:_epochs[kind]+=1
|
||||
for tip in list(_tips.keys()):
|
||||
context=getattr(tip,'attrLockContext',None)
|
||||
if context and context[0] in kinds:
|
||||
tip.attrLockContext=None;tip.attrLockMask=0;tip.HideToolTip()
|
||||
|
||||
def Triple(vnum,attribute,socket,epoch):
|
||||
return (vnum,tuple(attribute(i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)),
|
||||
tuple(socket(i) for i in xrange(player.METIN_SOCKET_MAX_NUM)),epoch)
|
||||
|
||||
def Read(tip,cell,kind):
|
||||
if not tip:return None
|
||||
epoch=_epochs[kind]
|
||||
if kind in (101,102):
|
||||
if not exchange.isTrading():return None
|
||||
side='Self' if kind==101 else 'Target'
|
||||
return Triple(getattr(exchange,'GetItemVnumFrom'+side)(cell),lambda i:getattr(exchange,'GetItemAttributeFrom'+side)(cell,i),lambda i:getattr(exchange,'GetItemMetinSocketFrom'+side)(cell,i),epoch)
|
||||
if kind==103:
|
||||
if not shop.IsOpen():return None
|
||||
return Triple(shop.GetItemID(cell),lambda i:shop.GetItemAttribute(cell,i),lambda i:shop.GetItemMetinSocket(cell,i),epoch)
|
||||
if kind in (104,105):
|
||||
if not _visible[kind]:return None
|
||||
prefix='Get' if kind==104 else 'GetMall'
|
||||
return Triple(getattr(safebox,prefix+'ItemID')(cell),lambda i:getattr(safebox,prefix+'ItemAttribute')(cell,i),lambda i:getattr(safebox,prefix+'ItemMetinSocket')(cell,i),epoch)
|
||||
if kind==106:
|
||||
dialog=tip.attrLockViewOwner()
|
||||
if not dialog or not dialog.IsShow() or dialog.vid!=tip.attrLockVid:return None
|
||||
data=dialog.itemDataDict.get(cell)
|
||||
if not data:return None
|
||||
return (data[0],tuple(data[3]),tuple(data[2]),epoch)
|
||||
|
||||
def Bind(tip,kind,cell,render,args,owner=None):
|
||||
# The original setter clears and draws the complete tooltip, including prices/flags.
|
||||
tip.attrLockRender=(render,args,weakref.ref(owner) if owner else None)
|
||||
tip.attrLockVid=owner.vid if owner else 0
|
||||
tip.attrLockViewOwner=weakref.ref(owner) if owner else None
|
||||
snapshot=Read(tip,cell,kind)
|
||||
if not snapshot or not snapshot[0] or not any(a[0] for a in snapshot[1][:5]):return
|
||||
tip.attrLockContext=(kind,cell,snapshot);tip.attrLockMask=0
|
||||
_tips[tip]=True;core.Query(tip)
|
||||
|
||||
def Render(tip,cell):
|
||||
render,args,owner=tip.attrLockRender
|
||||
target=owner() if owner else tip
|
||||
if target:render(target,*args)
|
||||
|
||||
for _kind in _epochs:
|
||||
core._views[_kind]=(lambda tip,cell,kind=_kind:Read(tip,cell,kind),Render)
|
||||
|
||||
def WrapTip(name,kind):
|
||||
original=getattr(Tip,name)
|
||||
def Wrapped(self,cell,*args):
|
||||
self.ClearToolTip();self.HideToolTip()
|
||||
original(self,cell,*args)
|
||||
Bind(self,kind,cell,original,(cell,)+args)
|
||||
setattr(Tip,name,Wrapped)
|
||||
for _name,_kind in (('SetExchangeOwnerItem',101),('SetExchangeTargetItem',102),('SetShopItem',103),('SetShopItemBySecondaryCoin',103),('SetSafeBoxItem',104),('SetMallItem',105)):
|
||||
if hasattr(Tip,_name):WrapTip(_name,_kind)
|
||||
|
||||
_builder=Tip.SetPrivateShopBuilderItem
|
||||
def Builder(self,window,cell,shopcell):
|
||||
self.ClearToolTip();self.HideToolTip()
|
||||
_builder(self,window,cell,shopcell)
|
||||
snapshot=core.Snapshot(window,cell)
|
||||
if snapshot[0] and any(a[0] for a in snapshot[1][:5]):
|
||||
# Register the original price-preserving renderer as a normal own-item context.
|
||||
self.attrLockContext=(window,cell,snapshot)
|
||||
self.attrLockBuilderRender=(_builder,(window,cell,shopcell))
|
||||
core.Query(self)
|
||||
Tip.SetPrivateShopBuilderItem=Builder
|
||||
# Own-item rebuilding normally uses SetInventoryItem; retain the builder's selling price.
|
||||
_rebuild=core.Rebuild
|
||||
def Rebuild(self):
|
||||
builder=getattr(self,'attrLockBuilderRender',None)
|
||||
context=getattr(self,'attrLockContext',None)
|
||||
if builder and context and core.Snapshot(context[0],context[1],self)==context[2]:
|
||||
self.attrLockRendering=True
|
||||
try:builder[0](self,*builder[1])
|
||||
finally:self.attrLockRendering=False
|
||||
else:_rebuild(self)
|
||||
core.Rebuild=Rebuild
|
||||
_clear=Tip.ClearToolTip
|
||||
def Clear(self):
|
||||
if not getattr(self,'attrLockRendering',False):self.attrLockBuilderRender=None
|
||||
return _clear(self)
|
||||
Tip.ClearToolTip=Clear
|
||||
|
||||
_equip=uiEquipmentDialog.EquipmentDialog.OverInItem
|
||||
def Equipment(self,cell):
|
||||
if self.tooltipItem:self.tooltipItem.ClearToolTip();self.tooltipItem.HideToolTip()
|
||||
_equip(self,cell)
|
||||
if self.tooltipItem:Bind(self.tooltipItem,106,cell,_equip,(cell,),self)
|
||||
uiEquipmentDialog.EquipmentDialog.OverInItem=Equipment
|
||||
|
||||
def Wrap(cls,name,kinds,visible=None):
|
||||
original=getattr(cls,name)
|
||||
def Wrapped(self,*args,**kwargs):
|
||||
Invalidate(kinds)
|
||||
result=original(self,*args,**kwargs)
|
||||
if visible is not None:
|
||||
for kind in kinds:_visible[kind]=visible
|
||||
return result
|
||||
setattr(cls,name,Wrapped)
|
||||
for _name in ('StartExchange','EndExchange','RefreshExchange'):Wrap(game.GameWindow,_name,(101,102))
|
||||
for _name in ('StartShop','EndShop','RefreshShop'):Wrap(game.GameWindow,_name,(103,))
|
||||
Wrap(uiSafebox.SafeboxWindow,'ShowWindow',(104,),True)
|
||||
Wrap(uiSafebox.SafeboxWindow,'CommandCloseSafebox',(104,),False)
|
||||
Wrap(uiSafebox.MallWindow,'ShowWindow',(105,),True)
|
||||
Wrap(uiSafebox.MallWindow,'CommandCloseMall',(105,),False)
|
||||
for _name in ('Open','Close','SetEquipmentDialogItem','SetEquipmentDialogSocket','SetEquipmentDialogAttr'):
|
||||
Wrap(uiEquipmentDialog.EquipmentDialog,_name,(106,))
|
||||
_close=game.GameWindow.Close
|
||||
def Close(self):
|
||||
Invalidate(tuple(_epochs));_visible[104]=False;_visible[105]=False
|
||||
return _close(self)
|
||||
game.GameWindow.Close=Close
|
||||
)PY";
|
||||
@@ -1042,6 +1042,7 @@ namespace PythonBoot
|
||||
#include "RingsScript.inc"
|
||||
#include "ItemActionsScript.inc"
|
||||
#include "AttrLockScript.inc"
|
||||
#include "AttrLockViewsScript.inc"
|
||||
#include "LiveEndpointScript.inc"
|
||||
#include "NativeChannelScript.inc"
|
||||
#include "MinimapOuterRingScript.inc"
|
||||
@@ -1148,6 +1149,7 @@ bool RunMainScript(const char* lpCmdLine, std::string* error)
|
||||
install_script_module("mt_rings", c_szRingsScript);
|
||||
install_script_module("mt_item_actions", c_szItemActionsScript);
|
||||
install_script_module("mt_attr_lock", c_szAttrLockScript);
|
||||
install_script_module("mt_attr_lock_views", c_szAttrLockViewsScript);
|
||||
install_script_module("mt_live_endpoint", c_szLiveEndpointScript);
|
||||
install_script_module("mt_native_channel", c_szNativeChannelScript);
|
||||
install_script_module("mt_minimap_buttons", c_szMinimapOuterRingScript);
|
||||
|
||||
@@ -32,7 +32,7 @@ class AttrLockUI(unittest.TestCase):
|
||||
m['game'].GameWindow=type('GameWindow',(),{'Close':lambda s:9,'BINARY_ServerCommand_Run':lambda s,line:0})
|
||||
m['mt_switchbot'].SwitchbotItemTab=type('Tab',(),{'OverInItem':lambda s,slot:'original'})
|
||||
for n,mod in m.items():self.previous[n]=sys.modules.get(n);sys.modules[n]=mod
|
||||
self.ns={'xrange':range};source=(ROOT/'src/platform/ScriptLib/AttrLockScript.inc').read_text().split('R"PY(',1)[1].rsplit(')PY";',1)[0];exec(source,self.ns)
|
||||
self.core=types.ModuleType('mt_attr_lock');self.ns=self.core.__dict__;self.ns['xrange']=range;source=(ROOT/'src/platform/ScriptLib/AttrLockScript.inc').read_text().split('R"PY(',1)[1].rsplit(')PY";',1)[0];exec(source,self.ns)
|
||||
self.tip=tip();self.game=m['game'].GameWindow()
|
||||
def tearDown(self):
|
||||
for n,old in self.previous.items():
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
"""Exercise real view bridge: every source keeps original prices, bounds and stale-state guards."""
|
||||
import sys,types,unittest
|
||||
from pathlib import Path
|
||||
from test_attr_lock_ui import AttrLockUI
|
||||
_baseSetUp=AttrLockUI.setUp
|
||||
_baseTearDown=AttrLockUI.tearDown
|
||||
del AttrLockUI
|
||||
ROOT=Path(__file__).resolve().parents[2]
|
||||
class AttrLockViews(unittest.TestCase):
|
||||
def setUp(self):
|
||||
_baseSetUp(self);self.extra={}
|
||||
for n in ('exchange','shop','safebox','uiEquipmentDialog','uiSafebox','mt_attr_lock'):
|
||||
self.extra[n]=sys.modules.get(n);sys.modules[n]=types.ModuleType(n)
|
||||
core=self.core;sys.modules['mt_attr_lock']=core
|
||||
self.ns=core.__dict__;self.tip=self.mods['uiToolTip'].ItemToolTip();Tip=self.mods['uiToolTip'].ItemToolTip
|
||||
Tip.HideToolTip=lambda s:setattr(s,'shown',False)
|
||||
self.store={k:[100,list(self.items[(1,4)][1]),[0,0,0]] for k in range(101,106)}
|
||||
ex=sys.modules['exchange'];ex.isTrading=lambda:True
|
||||
for side,k in (('Self',101),('Target',102)):
|
||||
setattr(ex,'GetItemVnumFrom'+side,lambda c,k=k:self.store[k][0])
|
||||
setattr(ex,'GetItemAttributeFrom'+side,lambda c,i,k=k:self.store[k][1][i])
|
||||
setattr(ex,'GetItemMetinSocketFrom'+side,lambda c,i,k=k:self.store[k][2][i])
|
||||
shop=sys.modules['shop'];shop.IsOpen=lambda:True
|
||||
shop.GetItemID=lambda c:self.store[103][0];shop.GetItemAttribute=lambda c,i:self.store[103][1][i];shop.GetItemMetinSocket=lambda c,i:self.store[103][2][i]
|
||||
safe=sys.modules['safebox']
|
||||
for prefix,k in (('Get',104),('GetMall',105)):
|
||||
setattr(safe,prefix+'ItemID',lambda c,k=k:self.store[k][0]);setattr(safe,prefix+'ItemAttribute',lambda c,i,k=k:self.store[k][1][i]);setattr(safe,prefix+'ItemMetinSocket',lambda c,i,k=k:self.store[k][2][i])
|
||||
for name,k in (('SetExchangeOwnerItem',101),('SetExchangeTargetItem',102),('SetShopItem',103),('SetShopItemBySecondaryCoin',103),('SetSafeBoxItem',104),('SetMallItem',105)):
|
||||
def render(s,c,k=k):
|
||||
data=self.store[k];s.ClearToolTip();s.AddItemData(data[0],data[2],data[1]);s.AppendTextLine('price/flags','original');s.ShowToolTip()
|
||||
setattr(Tip,name,render)
|
||||
def builder(s,w,c,sc):s.SetInventoryItem(c,w);s.AppendTextLine('builder-price','original')
|
||||
Tip.SetPrivateShopBuilderItem=builder
|
||||
Game=self.mods['game'].GameWindow
|
||||
for name in ('StartExchange','EndExchange','RefreshExchange','StartShop','EndShop','RefreshShop'):setattr(Game,name,lambda s,*a:None)
|
||||
for name,close in (('SafeboxWindow','CommandCloseSafebox'),('MallWindow','CommandCloseMall')):
|
||||
setattr(sys.modules['uiSafebox'],name,type(name,(),{'ShowWindow':lambda s,*a:None,close:lambda s:None}))
|
||||
class Equip:
|
||||
def __init__(s):s.vid=123;s.itemDataDict={2:(100,1,[0,0,0],list(self.items[(1,4)][1]))};s.tooltipItem=self.tip;s.shown=True
|
||||
def IsShow(s):return s.shown
|
||||
def OverInItem(s,c):
|
||||
d=s.itemDataDict[c];s.tooltipItem.ClearToolTip();s.tooltipItem.AddItemData(d[0],d[2],d[3]);s.tooltipItem.ShowToolTip()
|
||||
for name in ('Open','Close','SetEquipmentDialogItem','SetEquipmentDialogSocket','SetEquipmentDialogAttr'):setattr(Equip,name,lambda s,*a:None)
|
||||
sys.modules['uiEquipmentDialog'].EquipmentDialog=Equip
|
||||
self.view={'xrange':range};exec((ROOT/'src/platform/ScriptLib/AttrLockViewsScript.inc').read_text().split('R"PY(',1)[1].rsplit(')PY";',1)[0],self.view)
|
||||
self.view['_visible'].update({104:True,105:True})
|
||||
def tearDown(self):
|
||||
_baseTearDown(self)
|
||||
for n,old in self.extra.items():
|
||||
if old is None:sys.modules.pop(n,None)
|
||||
else:sys.modules[n]=old
|
||||
def reply(self,mask,command=None):
|
||||
words=(command or self.sent[-1]).split()[1:];token,w,c=words[:3]
|
||||
return self.game.BINARY_ServerCommand_Run('AttrLockInfo %s %s %s 100 %s'%(token,w,c,mask))
|
||||
def test_all_view_sources_highlight_and_preserve_original_rendering(self):
|
||||
for name in ('SetExchangeOwnerItem','SetExchangeTargetItem','SetShopItem','SetShopItemBySecondaryCoin','SetSafeBoxItem','SetMallItem'):
|
||||
getattr(self.tip,name)(0);self.reply(8)
|
||||
self.assertIn(('<<attr4=40>>','lock'),self.tip.lines,name)
|
||||
self.assertIn(('price/flags','original'),self.tip.lines,name)
|
||||
def test_closed_or_updated_exchange_discards_old_reply(self):
|
||||
self.tip.SetExchangeTargetItem(0);request=self.sent[-1];self.game.RefreshExchange()
|
||||
self.reply(8,request);self.assertFalse(self.tip.shown);self.assertEqual(self.tip.attrLockMask,0)
|
||||
self.tip.SetExchangeTargetItem(0);self.reply(8);self.game.EndExchange();self.assertFalse(self.tip.shown)
|
||||
def test_item_change_hides_old_highlight(self):
|
||||
self.tip.SetShopItem(0);self.reply(8);self.store[103][1][3]=(4,99)
|
||||
self.now=3;self.tip.OnUpdate();self.assertFalse(self.tip.shown)
|
||||
def test_safebox_close_and_reopen_prevent_late_reply(self):
|
||||
self.tip.SetSafeBoxItem(0);request=self.sent[-1]
|
||||
cls=sys.modules['uiSafebox'].SafeboxWindow;obj=cls();obj.CommandCloseSafebox();obj.ShowWindow(45)
|
||||
self.reply(8,request);self.assertEqual(self.tip.attrLockMask,0);self.assertFalse(self.tip.shown)
|
||||
def test_equipment_uses_viewer_target_and_current_dialog_snapshot(self):
|
||||
equip=sys.modules['uiEquipmentDialog'].EquipmentDialog();equip.OverInItem(2)
|
||||
self.assertEqual(self.sent[-1].split()[-1],'123');self.reply(8)
|
||||
self.assertIn(('<<attr4=40>>','lock'),self.tip.lines)
|
||||
equip.Close();self.assertFalse(self.tip.shown)
|
||||
def test_shop_builder_keeps_price_and_own_item_request(self):
|
||||
self.tip.SetPrivateShopBuilderItem(1,4,0);self.reply(8)
|
||||
self.assertIn(('builder-price','original'),self.tip.lines)
|
||||
self.assertEqual(len(self.sent[-1].split()),4)
|
||||
def test_render_metadata_does_not_keep_tooltip_alive(self):
|
||||
import weakref
|
||||
self.tip.SetShopItem(0);ref=weakref.ref(self.tip)
|
||||
del self.tip
|
||||
self.assertIsNone(ref())
|
||||
if __name__=='__main__':unittest.main()
|
||||
Reference in New Issue
Block a user