Skip to content

Commit

Permalink
Merge pull request element-hq#3705 from element-hq/feature/bma/sheetC…
Browse files Browse the repository at this point in the history
…ontentPreview

Rename some function to avoid name clash
  • Loading branch information
bmarty authored Oct 18, 2024
2 parents b0df319 + ab59a73 commit 714f74a
Show file tree
Hide file tree
Showing 31 changed files with 39 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fun ActionListView(
onDismissRequest = ::onDismiss,
modifier = modifier,
) {
SheetContent(
ActionListViewContent(
state = state,
onActionClick = ::onItemActionClick,
onEmojiReactionClick = ::onEmojiReactionClick,
Expand All @@ -161,7 +161,7 @@ fun ActionListView(
}

@Composable
private fun SheetContent(
private fun ActionListViewContent(
state: ActionListState,
onActionClick: (TimelineItemAction) -> Unit,
onEmojiReactionClick: (String) -> Unit,
Expand Down Expand Up @@ -442,10 +442,10 @@ private fun EmojiButton(

@PreviewsDayNight
@Composable
internal fun SheetContentPreview(
internal fun ActionListViewContentPreview(
@PreviewParameter(ActionListStateProvider::class) state: ActionListState
) = ElementPreview {
SheetContent(
ActionListViewContent(
state = state,
onActionClick = {},
onEmojiReactionClick = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ fun ReactionSummaryView(
sheetState = sheetState,
modifier = modifier
) {
SheetContent(summary = state.target)
ReactionSummaryViewContent(summary = state.target)
}
}
}

@OptIn(ExperimentalFoundationApi::class)
@Composable
private fun SheetContent(
private fun ReactionSummaryViewContent(
summary: ReactionSummaryState.Summary,
) {
val animationScope = rememberCoroutineScope()
Expand Down Expand Up @@ -274,8 +274,8 @@ private fun SenderRow(

@PreviewsDayNight
@Composable
internal fun SheetContentPreview(
internal fun ReactionSummaryViewContentPreview(
@PreviewParameter(ReactionSummaryStateProvider::class) state: ReactionSummaryState
) = ElementPreview {
SheetContent(summary = state.target as ReactionSummaryState.Summary)
ReactionSummaryViewContent(summary = state.target as ReactionSummaryState.Summary)
}
31 changes: 31 additions & 0 deletions tools/test/generateAllScreenshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import re
import sys
import time

from util import compare


Expand Down Expand Up @@ -100,6 +101,34 @@ def computeDarkFileName(lightFileName):
return match.group(1) + "_Night_" + match.group(2) + "_" + match.group(3)
return ""


def checkForScreenshotNameDuplication():
__doc__ = "Check for screenshots name duplication"
print("Check for screenshots name duplication...")
files = os.listdir("tests/uitests/src/test/snapshots/images/")
dict = {}
for file in files:
start = file.find("_") + 1
end = file.find("_", start)
screenshotName = file[start:end]
if screenshotName in dict:
dict[screenshotName].append(file[:end])
else:
dict[screenshotName] = [file[:end]]
error = 0
for key in dict:
if key in ["Icon", "RoundIcon"]:
continue
values = set(dict[key])
if len(values) > 1:
print("Duplicated screenshot name: %s" % key)
for value in values:
print(" - %s" % value)
error += 1
if error:
print("Warning: %d duplicated screenshot name(s) found" % error)


def generateJavascriptFile():
__doc__ = "Generate a javascript file to load the screenshots"
print("Generating javascript file...")
Expand Down Expand Up @@ -151,11 +180,13 @@ def generateJavascriptFile():


def main():
checkForScreenshotNameDuplication()
generateAllScreenshots(readArguments())
lang = detectLanguages()
for l in lang:
deleteDuplicatedScreenshots(l)
moveScreenshots(l)
generateJavascriptFile()


main()

0 comments on commit 714f74a

Please sign in to comment.