Use one current deposit quote for Dew top-up conversions
This commit is contained in:
1 parent
e72875f367
commit
33965188c5
18 files changed
+128
-98
No files matched your search
@@ -5139,9 +5139,6 @@ Tento uzel nenabízí rozšíření úložiště.
|
||||
Na tuto adresu pošli alespoň %s XMR. Dew se připíše po %d potvrzeních.
|
||||
---
|
||||
|
||||
[profile_dew_rate]
|
||||
%s XMR odpovídá %s Dew
|
||||
---
|
||||
|
||||
[profile_dew_full]
|
||||
Úložiště je plné. Stávající data zůstávají dostupná; nové nahrávání počká na rozšíření nebo uvolnění místa.
|
||||
@@ -5211,9 +5208,6 @@ Pošli Monero na tuto adresu. Dew se objeví po %d potvrzeních.
|
||||
%s XMR, asi %s USD
|
||||
---
|
||||
|
||||
[dew_about_usd]
|
||||
asi %s USD
|
||||
---
|
||||
[dew_gift_title]
|
||||
Darovat Dew
|
||||
---
|
||||
|
||||
@@ -5133,9 +5133,6 @@ Dieser Knoten bietet keine Speichererweiterungen an.
|
||||
Sende mindestens %s XMR an diese Adresse. Dew wird nach %d Bestätigungen gutgeschrieben.
|
||||
---
|
||||
|
||||
[profile_dew_rate]
|
||||
%s XMR entsprechen %s Dew
|
||||
---
|
||||
|
||||
[profile_dew_full]
|
||||
Dein Speicher ist voll. Vorhandene Daten bleiben zugänglich; neue Uploads warten, bis du erweiterst oder Speicher freigibst.
|
||||
@@ -5205,9 +5202,6 @@ Sende Monero an diese Adresse. Dew erscheint nach %d Bestätigungen.
|
||||
%s XMR, etwa %s USD
|
||||
---
|
||||
|
||||
[dew_about_usd]
|
||||
etwa %s USD
|
||||
---
|
||||
[dew_gift_title]
|
||||
Dew schenken
|
||||
---
|
||||
|
||||
@@ -5157,9 +5157,6 @@ Storage upgrades are not available on this node.
|
||||
Send at least %s XMR to this address. Dew appears after %d confirmations.
|
||||
---
|
||||
|
||||
[profile_dew_rate]
|
||||
%s XMR = %s Dew
|
||||
---
|
||||
|
||||
[profile_dew_full]
|
||||
Your storage allowance is full. Existing data stays accessible; new uploads wait until you upgrade or free space.
|
||||
@@ -5229,9 +5226,6 @@ Send Monero to this address. Dew appears after %d confirmations.
|
||||
%s XMR, about %s USD
|
||||
---
|
||||
|
||||
[dew_about_usd]
|
||||
about %s USD
|
||||
---
|
||||
[dew_gift_title]
|
||||
Gift Dew
|
||||
---
|
||||
|
||||
@@ -5133,9 +5133,6 @@ Este nodo no ofrece ampliaciones de almacenamiento.
|
||||
Envía al menos %s XMR a esta dirección. Dew aparece tras %d confirmaciones.
|
||||
---
|
||||
|
||||
[profile_dew_rate]
|
||||
%s XMR equivalen a %s Dew
|
||||
---
|
||||
|
||||
[profile_dew_full]
|
||||
El almacenamiento está lleno. Tus datos siguen accesibles; las nuevas subidas esperan hasta que amplíes el plan o liberes espacio.
|
||||
@@ -5205,9 +5202,6 @@ Envía Monero a esta dirección. Dew aparece tras %d confirmaciones.
|
||||
%s XMR, unos %s USD
|
||||
---
|
||||
|
||||
[dew_about_usd]
|
||||
unos %s USD
|
||||
---
|
||||
[dew_gift_title]
|
||||
Regalar Dew
|
||||
---
|
||||
|
||||
@@ -5121,9 +5121,6 @@ Ce nœud ne propose pas d’extension de stockage.
|
||||
Envoyez au moins %s XMR à cette adresse. Les Dew apparaissent après %d confirmations.
|
||||
---
|
||||
|
||||
[profile_dew_rate]
|
||||
%s XMR correspondent à %s Dew
|
||||
---
|
||||
|
||||
[profile_dew_full]
|
||||
Votre stockage est plein. Les données restent accessibles ; les nouveaux envois attendent une extension ou de l’espace libre.
|
||||
@@ -5193,9 +5190,6 @@ Envoyez des Monero à cette adresse. Les Dew apparaissent après %d confirmation
|
||||
%s XMR, environ %s USD
|
||||
---
|
||||
|
||||
[dew_about_usd]
|
||||
environ %s USD
|
||||
---
|
||||
[dew_gift_title]
|
||||
Offrir des Dew
|
||||
---
|
||||
|
||||
@@ -5122,9 +5122,6 @@ Node ini tidak menyediakan peningkatan penyimpanan.
|
||||
Kirim setidaknya %s XMR ke alamat ini. Dew masuk setelah %d konfirmasi.
|
||||
---
|
||||
|
||||
[profile_dew_rate]
|
||||
%s XMR setara dengan %s Dew
|
||||
---
|
||||
|
||||
[profile_dew_full]
|
||||
Penyimpanan penuh. Data tetap dapat diakses; unggahan baru menunggu hingga paket ditingkatkan atau ruang dikosongkan.
|
||||
@@ -5194,9 +5191,6 @@ Kirim Monero ke alamat ini. Dew muncul setelah %d konfirmasi.
|
||||
%s XMR, sekitar %s USD
|
||||
---
|
||||
|
||||
[dew_about_usd]
|
||||
sekitar %s USD
|
||||
---
|
||||
[dew_gift_title]
|
||||
Hadiahkan Dew
|
||||
---
|
||||
|
||||
@@ -5122,9 +5122,6 @@ Questo nodo non offre ampliamenti dello spazio.
|
||||
Invia almeno %s XMR a questo indirizzo. Dew compare dopo %d conferme.
|
||||
---
|
||||
|
||||
[profile_dew_rate]
|
||||
%s XMR equivalgono a %s Dew
|
||||
---
|
||||
|
||||
[profile_dew_full]
|
||||
Lo spazio è pieno. I dati restano accessibili; i nuovi caricamenti attendono un ampliamento o spazio libero.
|
||||
@@ -5194,9 +5191,6 @@ Invia Monero a questo indirizzo. Dew appare dopo %d conferme.
|
||||
%s XMR, circa %s USD
|
||||
---
|
||||
|
||||
[dew_about_usd]
|
||||
circa %s USD
|
||||
---
|
||||
[dew_gift_title]
|
||||
Regala Dew
|
||||
---
|
||||
|
||||
@@ -5118,9 +5118,6 @@ Dewが不足しています。先にMoneroでチャージしてください。
|
||||
このアドレスに%s XMR以上を送ってください。%d回の承認後にDewが反映されます。
|
||||
---
|
||||
|
||||
[profile_dew_rate]
|
||||
%s XMRは%s Dewに相当します
|
||||
---
|
||||
|
||||
[profile_dew_full]
|
||||
保存容量の上限に達しました。既存のデータは引き続き利用できます。容量を拡張するか空きを作るまで、新しいアップロードは待機します。
|
||||
@@ -5190,9 +5187,6 @@ Moneroアドレスを取得できませんでした。もう一度お試しく
|
||||
%s XMR(約%s USD)
|
||||
---
|
||||
|
||||
[dew_about_usd]
|
||||
約%s USD
|
||||
---
|
||||
[dew_gift_title]
|
||||
Dewを贈る
|
||||
---
|
||||
|
||||
@@ -5128,9 +5128,6 @@ Dew가 부족해요. 먼저 Monero로 충전하세요.
|
||||
이 주소로 최소 %s XMR를 보내세요. %d회 확인 후 Dew가 반영돼요.
|
||||
---
|
||||
|
||||
[profile_dew_rate]
|
||||
%s XMR은 %s Dew에 해당해요
|
||||
---
|
||||
|
||||
[profile_dew_full]
|
||||
저장 공간이 가득 찼어요. 기존 데이터는 계속 이용할 수 있어요. 공간을 늘리거나 비울 때까지 새 업로드는 대기해요.
|
||||
@@ -5200,9 +5197,6 @@ Monero 주소를 가져오지 못했습니다. 다시 시도하세요.
|
||||
%s XMR (약 %s USD)
|
||||
---
|
||||
|
||||
[dew_about_usd]
|
||||
약 %s USD
|
||||
---
|
||||
[dew_gift_title]
|
||||
Dew 선물하기
|
||||
---
|
||||
|
||||
@@ -5131,9 +5131,6 @@ Este nó não oferece ampliações de armazenamento.
|
||||
Envie pelo menos %s XMR para este endereço. Dew aparece após %d confirmações.
|
||||
---
|
||||
|
||||
[profile_dew_rate]
|
||||
%s XMR equivalem a %s Dew
|
||||
---
|
||||
|
||||
[profile_dew_full]
|
||||
Seu armazenamento está cheio. Os dados continuam acessíveis; novos envios aguardam até você ampliar o plano ou liberar espaço.
|
||||
@@ -5203,9 +5200,6 @@ Envie Monero para este endereço. Dew aparece após %d confirmações.
|
||||
%s XMR, cerca de %s USD
|
||||
---
|
||||
|
||||
[dew_about_usd]
|
||||
cerca de %s USD
|
||||
---
|
||||
[dew_gift_title]
|
||||
Presentear Dew
|
||||
---
|
||||
|
||||
@@ -5127,9 +5127,6 @@ Lumi остаётся без сети, пока вы не примете её у
|
||||
Отправь не менее %s XMR на этот адрес. Dew появится после %d подтверждений.
|
||||
---
|
||||
|
||||
[profile_dew_rate]
|
||||
%s XMR соответствуют %s Dew
|
||||
---
|
||||
|
||||
[profile_dew_full]
|
||||
Хранилище заполнено. Данные остаются доступны; новые загрузки ждут расширения тарифа или освобождения места.
|
||||
@@ -5199,9 +5196,6 @@ Lumi остаётся без сети, пока вы не примете её у
|
||||
%s XMR, примерно %s USD
|
||||
---
|
||||
|
||||
[dew_about_usd]
|
||||
примерно %s USD
|
||||
---
|
||||
[dew_gift_title]
|
||||
Подарить Dew
|
||||
---
|
||||
|
||||
@@ -5133,9 +5133,6 @@ Dew不足,请先使用Monero充值。
|
||||
向此地址发送至少%s XMR。经过%d次确认后,Dew将到账。
|
||||
---
|
||||
|
||||
[profile_dew_rate]
|
||||
%s XMR相当于%s Dew
|
||||
---
|
||||
|
||||
[profile_dew_full]
|
||||
存储空间已满。现有数据仍可访问;升级方案或释放空间后,才能继续上传新数据。
|
||||
@@ -5205,9 +5202,6 @@ Dew不足,请先使用Monero充值。
|
||||
%s XMR(约%s USD)
|
||||
---
|
||||
|
||||
[dew_about_usd]
|
||||
约%s USD
|
||||
---
|
||||
[dew_gift_title]
|
||||
赠送 Dew
|
||||
---
|
||||
|
||||
@@ -63,6 +63,12 @@ entity-profile-ui-test: $(TARGET)
|
||||
-u SESSION_MANAGER -u GDK_DISPLAY YUE_DESKTOP_RECOVERY=0 \
|
||||
python3 tests/entity_profile_ui_test.py $(abspath $(TARGET))
|
||||
|
||||
.PHONY: dew-topup-ui-test
|
||||
dew-topup-ui-test: $(TARGET)
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
|
||||
-u SESSION_MANAGER -u GDK_DISPLAY YUE_DESKTOP_RECOVERY=0 \
|
||||
python3 tests/dew_topup_ui_test.py $(abspath $(TARGET))
|
||||
|
||||
.PHONY: native-text-pixels-test
|
||||
native-text-pixels-test: $(TARGET)
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS YUE_DESKTOP_RECOVERY=0 \
|
||||
@@ -76,6 +82,7 @@ native-text-pixels-test: $(TARGET)
|
||||
VISUAL_TEST_TARGETS := $(NATIVE_VISUAL_TARGETS) launcher-ui-test lumi-ui-test practice-images-ui-test leaderboard-ui-test native-screenshot-test native-text-pixels-test native-zoom-test settings-sidebar-ui-test startup-quit-ui-test locale-render-ui-test lumi-history-ui-test habits-table-ui-test habits-count-ui-test habit-day-ui-test habit-schedule-tool-test habit-tracking-tool-test lists-ui-test sync-review-ui-test data-back-ui-test lumi-selection-ui-test lumi-harness-ui-test lumi-guide-ui-test lumi-emphasis-ui-test customize-nav-ui-test
|
||||
VISUAL_TEST_TARGETS += audio-setup-ui-test apps-onboarding-test practice-downloads-ui-test tab-switch-performance-test habit-unsaved-ui-test
|
||||
VISUAL_TEST_TARGETS += entity-profile-ui-test
|
||||
VISUAL_TEST_TARGETS += dew-topup-ui-test
|
||||
VISUAL_TEST_TARGETS += music-navigation-test
|
||||
visual-test: $(TARGET) $(INBE_FULL_BUNDLE) $(NODE_APP_BUNDLES)
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u GDK_DISPLAY \
|
||||
|
||||
@@ -1051,6 +1051,7 @@ setup_screenshot_scene :: (app: *InnerBreeze, request: *ScreenshotRequest) {
|
||||
profile_storage_tab = 1
|
||||
}
|
||||
if scene_text == "dew_top_up" {
|
||||
ProfileTopUpOpen(app)
|
||||
// A placeholder deposit address at the node's 10000 Dew per XMR.
|
||||
unused AppCopyText("4", dew_address[:])
|
||||
for index: 0..93 {
|
||||
@@ -1060,7 +1061,6 @@ setup_screenshot_scene :: (app: *InnerBreeze, request: *ScreenshotRequest) {
|
||||
dew_rate_units = 10000 * DewUnits
|
||||
dew_minimum_atomic = 1000000000
|
||||
dew_confirmations = 10
|
||||
ProfileTopUpOpen(app)
|
||||
}
|
||||
if scene_text == "dew_gift" {
|
||||
// A fixture friend; nothing is sent.
|
||||
|
||||
+11
-21
@@ -268,14 +268,15 @@ ProfileDewDraw :: (app: *InnerBreeze, x: s32, y: *s32, width: s32) {
|
||||
y.* += height
|
||||
}
|
||||
|
||||
// "0.1 XMR = 1000 Dew, about 55.66 USD" from the node's published rates; the
|
||||
// "0.1 XMR = 1000 Dew, about 55.66 USD" from the node's funding quote; the
|
||||
// USD part only while the node has a current Monero price.
|
||||
ProfileDewExchangeText :: (output: []u8) -> bool {
|
||||
if !dew_rates.known {
|
||||
rates := DewFundingRate()
|
||||
if !rates.known {
|
||||
return false
|
||||
}
|
||||
atomic: s64 = DewExampleAtomic
|
||||
units := DewUnitsForXmr(atomic, dew_rates.xmr_atomic_units, dew_rates.token_units)
|
||||
units := DewUnitsForXmr(atomic, rates.xmr_atomic_units, rates.token_units)
|
||||
if units <= 0 {
|
||||
return false
|
||||
}
|
||||
@@ -445,6 +446,13 @@ ProfileTopUpOpen :: (app: *InnerBreeze) {
|
||||
profile_topup_started = false
|
||||
profile_topup_failed = false
|
||||
profile_topup_copied = false
|
||||
// Reopening asks for a fresh quote, even if this account has deposited
|
||||
// before. Never keep an old address rate for the lifetime of the app.
|
||||
dew_address = .{}
|
||||
dew_rate_atomic = 0
|
||||
dew_rate_units = 0
|
||||
dew_confirmations = 0
|
||||
dew_minimum_atomic = 0
|
||||
app_open_modal(app, cast(ModalType)ModalDewTopUp)
|
||||
}
|
||||
|
||||
@@ -508,24 +516,6 @@ ProfileTopUpContent :: (app: *InnerBreeze, x: s32, y: *s32, width: s32, draw: bo
|
||||
}
|
||||
return
|
||||
}
|
||||
// The address's rate, shown for 0.1 XMR like every Dew price.
|
||||
xmr: [48]u8
|
||||
dew: [48]u8
|
||||
unused DewFormat(DewExampleAtomic, 1000000000000LL, xmr[:])
|
||||
unused DewFormat(DewUnitsForXmr(DewExampleAtomic, dew_rate_atomic, dew_rate_units), DewUnits, dew[:])
|
||||
rate_arguments: [2]FormatArg = .[
|
||||
FormatArg.{.text = TextUntilNul(xmr[:]), .is_text = true},
|
||||
FormatArg.{.text = TextUntilNul(dew[:]), .is_text = true}]
|
||||
unused FormatTemplate(LocaleText("profile_dew_rate"), rate_arguments[:], line[:])
|
||||
rate_usd: [48]u8
|
||||
if DewUsdText(DewExampleAtomic, rate_usd[:]) {
|
||||
about: [96]u8
|
||||
usd_arguments: [1]FormatArg = .[FormatArg.{.text = TextUntilNul(rate_usd[:]), .is_text = true}]
|
||||
unused FormatTemplate(LocaleText("dew_about_usd"), usd_arguments[:], about[:])
|
||||
unused AppAppendText(" · ", line[:])
|
||||
unused AppAppendText(TextUntilNul(about[:]), line[:])
|
||||
}
|
||||
ProfileDewText(app, TextUntilNul(line[:]), x, y, width, AppFontSize(), draw)
|
||||
// A minimum below one Dew's worth is noise, so only a real one is named.
|
||||
line = .{}
|
||||
if dew_minimum_atomic >= TopUpMinimumShown {
|
||||
|
||||
+17
-4
@@ -466,13 +466,26 @@ DewRatesRefresh :: () {
|
||||
dew_rates_response[:])
|
||||
}
|
||||
|
||||
// Dew units in Monero atomic units at the node's funding ratio.
|
||||
// The address quote is the rate that will actually credit a deposit. The
|
||||
// public response can have been fetched before that quote changed.
|
||||
DewFundingRate :: () -> DewRates {
|
||||
rates := dew_rates
|
||||
if dew_address[0] != cast(u8)0 && dew_rate_atomic > 0 && dew_rate_units > 0 {
|
||||
rates.known = true
|
||||
rates.xmr_atomic_units = dew_rate_atomic
|
||||
rates.token_units = dew_rate_units
|
||||
}
|
||||
return rates
|
||||
}
|
||||
|
||||
// Dew units in Monero atomic units at the same rate as the top-up quote.
|
||||
DewXmrAtomic :: (units: s64) -> s64 {
|
||||
if !dew_rates.known {
|
||||
rates := DewFundingRate()
|
||||
if !rates.known {
|
||||
return 0
|
||||
}
|
||||
return cast(s64)(cast(float64)units * cast(float64)dew_rates.xmr_atomic_units /
|
||||
cast(float64)dew_rates.token_units + 0.5)
|
||||
return cast(s64)(cast(float64)units * cast(float64)rates.xmr_atomic_units /
|
||||
cast(float64)rates.token_units + 0.5)
|
||||
}
|
||||
|
||||
// Every Dew price is shown by what 0.1 XMR buys: "0.1 XMR = 1000 Dew".
|
||||
|
||||
@@ -312,8 +312,31 @@ Check :: () -> s32 {
|
||||
"{\"xmr_usd_cents\":34512,\"updated_at\":1789000000,\"sources\":[\"coingecko\",\"kraken\"],\"xmr_atomic_units\":1000000000000,\"token_units\":10000000000}",
|
||||
*rates) && rates.known && rates.usd_cents_per_xmr == 34512)
|
||||
dew_rates = rates
|
||||
dew_address = .{}
|
||||
check_true("100 Dew is 0.01 XMR at 10000 Dew per XMR", DewXmrAtomic(100 * DewUnits) == 10000000000)
|
||||
check_true("0.01 XMR at 345.12 USD is 3.45 USD", DewUsdCents(10000000000) == 345)
|
||||
// The public response can predate a changed deposit quote. The balance
|
||||
// must use the quote that will actually credit this address.
|
||||
dew_rates.token_units = 1000 * DewUnits
|
||||
unused AppCopyText(TestAddress, dew_address[:])
|
||||
dew_rate_atomic = 1000000000000LL
|
||||
dew_rate_units = 10000 * DewUnits
|
||||
check_true("98 Dew uses the deposit quote despite an older public ratio",
|
||||
DewXmrAtomic(98 * DewUnits) == 9800000000LL)
|
||||
check_true("98 Dew dollar value follows the same deposit quote",
|
||||
DewUsdCents(DewXmrAtomic(98 * DewUnits)) == 338)
|
||||
funding := DewFundingRate()
|
||||
check_true("displayed exchange and balance use one invertible quote",
|
||||
DewUnitsForXmr(DewXmrAtomic(98 * DewUnits), funding.xmr_atomic_units,
|
||||
funding.token_units) == 98 * DewUnits)
|
||||
dew_rates = DewRates.{}
|
||||
check_true("a deposit quote works without a public rates response",
|
||||
DewXmrAtomic(98 * DewUnits) == 9800000000LL)
|
||||
check_true("a deposit quote alone never invents a dollar price",
|
||||
DewUsdCents(DewXmrAtomic(98 * DewUnits)) == 0)
|
||||
dew_address = .{}
|
||||
check_true("a quote without its address is not reused",
|
||||
DewXmrAtomic(98 * DewUnits) == 0)
|
||||
stale: DewRates
|
||||
check_true("a node without a current price still gives the Dew ratio", DewParseRates(
|
||||
"{\"xmr_usd_cents\":0,\"updated_at\":0,\"sources\":[],\"xmr_atomic_units\":1000000000000,\"token_units\":10000000000}",
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
"""The top-up modal shows one exchange quote on an isolated desktop."""
|
||||
import contextlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from ui_driver import UiDriver
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
OUTPUT = ROOT / "build/dew-topup-ui-test"
|
||||
OUTPUT.mkdir(parents=True, exist_ok=True)
|
||||
BINARY = Path(sys.argv[1]).resolve()
|
||||
DESKTOP_ENV = ("DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS",
|
||||
"SESSION_MANAGER", "GDK_DISPLAY")
|
||||
assert all(not os.environ.get(key) for key in DESKTOP_ENV), "Inherited desktop environment"
|
||||
|
||||
|
||||
def stop(process):
|
||||
if process.poll() is None:
|
||||
process.terminate()
|
||||
try:
|
||||
process.wait(timeout=5)
|
||||
except subprocess.TimeoutExpired:
|
||||
process.kill()
|
||||
process.wait(timeout=5)
|
||||
|
||||
|
||||
with contextlib.ExitStack() as stack:
|
||||
profile = Path(stack.enter_context(tempfile.TemporaryDirectory(dir=OUTPUT, prefix="profile-")))
|
||||
driver = UiDriver(profile / "driver")
|
||||
environment = {key: value for key, value in os.environ.items() if key not in DESKTOP_ENV}
|
||||
environment.update(driver.environment())
|
||||
environment.update(APP_DATA_ROOT=str(profile), INBE_SCREENSHOT_DATA_ROOT=str(profile),
|
||||
APP_NO_TRAY="1", APP_SHOT_WINDOW="1", YUE_DESKTOP_RECOVERY="0",
|
||||
SDL_VIDEODRIVER="x11", SDL_AUDIODRIVER="dummy", LIBGL_ALWAYS_SOFTWARE="1",
|
||||
https_proxy="http://127.0.0.1:9", http_proxy="http://127.0.0.1:9", NO_PROXY="")
|
||||
display_log = stack.enter_context((OUTPUT / "display.log").open("w"))
|
||||
display = subprocess.Popen(["Xvfb", "-noreset", "-displayfd", "1", "-screen", "0", "600x1000x24",
|
||||
"-nolisten", "tcp"], env=environment,
|
||||
stdout=subprocess.PIPE, stderr=display_log)
|
||||
stack.callback(stop, display)
|
||||
number = display.stdout.readline().decode().strip()
|
||||
display.stdout.close()
|
||||
assert number.isdecimal(), "Private display did not start"
|
||||
environment["DISPLAY"] = ":" + number
|
||||
log_path = OUTPUT / "app.log"
|
||||
log = stack.enter_context(log_path.open("w"))
|
||||
process = subprocess.Popen([str(BINARY), "--screenshot", str(OUTPUT / "topup.png"),
|
||||
"--screenshot-scene", "dew_top_up", "--screenshot-width", "480",
|
||||
"--screenshot-height", "900"], cwd=ROOT, env=environment,
|
||||
stdout=log, stderr=subprocess.STDOUT)
|
||||
stack.callback(stop, process)
|
||||
driver.attach(process, log_path)
|
||||
driver.wait(contains="1000 Dew", role="text", visible=False)
|
||||
nodes = driver.tree()
|
||||
(OUTPUT / "tree.json").write_text(json.dumps(nodes, indent=2) + "\n")
|
||||
quotes = [node["label"] for node in nodes if " XMR = " in node.get("label", "")]
|
||||
assert quotes == ["0.1 XMR = 1000 Dew, about 55.66 USD"], quotes
|
||||
assert driver.find(label="Balance · 120 Dew · 0.012 XMR, about 6.68 USD", role="text")
|
||||
assert driver.find(label="Copy", role="button", visible=False)
|
||||
assert driver.find(label="Wallet", role="button", visible=False)
|
||||
assert "frame rejected" not in log_path.read_text()
|
||||
assert process.poll() is None, "Top-up test app exited unexpectedly"
|
||||
|
||||
print("Dew top-up: one quote, consistent balance conversion, and deposit controls passed")
|
||||
Reference in new issue
Block a user