text
stringlengths 6
13.6M
| id
stringlengths 13
176
| metadata
dict | __index_level_0__
int64 0
1.69k
|
---|---|---|---|
/*
* Copyright 2019 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.editor;
import com.google.common.base.Joiner;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionToolbar;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.ui.SimpleToolWindowPanel;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.ui.popup.BalloonBuilder;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.JBColor;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBTextField;
import com.intellij.util.ui.PositionTracker;
import com.jetbrains.lang.dart.assists.AssistUtils;
import com.jetbrains.lang.dart.assists.DartSourceEditException;
import io.flutter.FlutterMessages;
import io.flutter.dart.FlutterDartAnalysisServer;
import io.flutter.hotui.StableWidgetTracker;
import io.flutter.inspector.DiagnosticsNode;
import io.flutter.inspector.InspectorGroupManagerService;
import io.flutter.inspector.InspectorObjectGroupManager;
import io.flutter.inspector.InspectorService;
import io.flutter.preview.OutlineOffsetConverter;
import io.flutter.preview.WidgetEditToolbar;
import io.flutter.run.FlutterReloadManager;
import io.flutter.run.daemon.FlutterApp;
import io.flutter.utils.AsyncRateLimiter;
import io.flutter.utils.AsyncUtils;
import io.flutter.utils.EventStream;
import net.miginfocom.swing.MigLayout;
import org.dartlang.analysis.server.protocol.*;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.util.List;
import java.util.*;
import java.util.concurrent.CompletableFuture;
class EnumValueWrapper {
final FlutterWidgetPropertyValueEnumItem item;
final String expression;
public EnumValueWrapper(FlutterWidgetPropertyValueEnumItem item) {
this.item = item;
this.expression = item.getName();
assert (this.expression != null);
}
public EnumValueWrapper(String expression) {
this.expression = expression;
item = null;
}
@Override
public String toString() {
if (expression != null) {
return expression;
}
return item != null ? item.getName() : "[null]";
}
}
class PropertyEnumComboBoxModel extends AbstractListModel<EnumValueWrapper>
implements ComboBoxModel<EnumValueWrapper> {
private final List<EnumValueWrapper> myList;
private EnumValueWrapper mySelected;
private String expression;
public PropertyEnumComboBoxModel(FlutterWidgetProperty property) {
final FlutterWidgetPropertyEditor editor = property.getEditor();
assert (editor != null);
myList = new ArrayList<>();
for (FlutterWidgetPropertyValueEnumItem item : editor.getEnumItems()) {
myList.add(new EnumValueWrapper(item));
}
String expression = property.getExpression();
if (expression == null) {
mySelected = null;
return;
}
if (property.getValue() != null) {
final FlutterWidgetPropertyValue value = property.getValue();
final FlutterWidgetPropertyValueEnumItem enumValue = value.getEnumValue();
if (enumValue != null) {
for (EnumValueWrapper e : myList) {
if (e != null && e.item != null && Objects.equals(e.item.getName(), enumValue.getName())) {
mySelected = e;
}
}
}
}
else {
final EnumValueWrapper newItem = new EnumValueWrapper(expression);
myList.add(newItem);
mySelected = newItem;
}
final String kind = editor.getKind();
}
@Override
public int getSize() {
return myList.size();
}
@Override
public EnumValueWrapper getElementAt(int index) {
return myList.get(index);
}
@Override
public EnumValueWrapper getSelectedItem() {
return mySelected;
}
@Override
public void setSelectedItem(Object item) {
if (item instanceof String) {
final String expression = (String)item;
for (EnumValueWrapper e : myList) {
if (Objects.equals(e.expression, expression)) {
mySelected = e;
return;
}
}
final EnumValueWrapper wrapper = new EnumValueWrapper(expression);
myList.add(wrapper);
this.fireIntervalAdded(this, myList.size() - 1, myList.size());
setSelectedItem(wrapper);
return;
}
setSelectedItem((EnumValueWrapper)item);
}
public void setSelectedItem(EnumValueWrapper item) {
mySelected = item;
fireContentsChanged(this, 0, getSize());
}
}
/**
* Panel that supports editing properties of a specified widget.
* <p>
* The property panel will update
*/
public class PropertyEditorPanel extends SimpleToolWindowPanel {
protected final AsyncRateLimiter retryLookupPropertiesRateLimiter;
/**
* Whether the property panel is being rendered in a fixed width context such
* as inside a baloon popup window or is within a resizeable window.
*/
private final boolean fixedWidth;
private final InspectorGroupManagerService.Client inspectorStateServiceClient;
private final FlutterDartAnalysisServer flutterDartAnalysisService;
@Nullable private final Project project;
private final boolean showWidgetEditToolbar;
private final Map<String, JComponent> fields = new HashMap<>();
private final Map<String, FlutterWidgetProperty> propertyMap = new HashMap<>();
private final Map<String, String> currentExpressionMap = new HashMap<>();
private final ArrayList<FlutterWidgetProperty> properties = new ArrayList<>();
private final Disposable parentDisposable;
// TODO(jacobr): figure out why this is needed.
int numFailures;
String previouslyFocusedProperty = null;
private DiagnosticsNode node;
/**
* Outline node
*/
private FlutterOutline outline;
private EventStream<VirtualFile> activeFile;
/**
* Whether the property panel has already triggered a pending hot reload.
*/
private boolean pendingHotReload;
/**
* Whether the property panel needs another hot reload to occur after the
* current pending hot reload is complete.
*/
private boolean needHotReload;
private CompletableFuture<List<FlutterWidgetProperty>> propertyFuture;
public PropertyEditorPanel(
@Nullable InspectorGroupManagerService inspectorGroupManagerService,
@Nullable Project project,
FlutterDartAnalysisServer flutterDartAnalysisService,
boolean showWidgetEditToolbar,
boolean fixedWidth,
Disposable parentDisposable
) {
super(true, true);
setFocusable(true);
this.fixedWidth = fixedWidth;
this.parentDisposable = parentDisposable;
inspectorStateServiceClient = new InspectorGroupManagerService.Client(parentDisposable) {
@Override
public void onInspectorAvailabilityChanged() {
// The app has terminated or restarted. No way we are still waiting
// for a pending hot reload.
pendingHotReload = false;
}
@Override
public void notifyAppReloaded() {
pendingHotReload = false;
}
@Override
public void notifyAppRestarted() {
pendingHotReload = false;
}
};
retryLookupPropertiesRateLimiter = new AsyncRateLimiter(10, () -> {
// TODO(jacobr): is this still needed now that we have dealt with timeout
// issues by making the analysis server api async?
maybeLoadProperties();
return CompletableFuture.completedFuture(null);
}, parentDisposable);
inspectorGroupManagerService.addListener(inspectorStateServiceClient, parentDisposable);
this.project = project;
this.flutterDartAnalysisService = flutterDartAnalysisService;
this.showWidgetEditToolbar = showWidgetEditToolbar;
}
/**
* Display a popup containing the property editing panel for the specified widget.
*/
public static Balloon showPopup(
InspectorGroupManagerService inspectorGroupManagerService,
EditorEx editor,
DiagnosticsNode node,
@NotNull InspectorService.Location location,
FlutterDartAnalysisServer service,
Point point
) {
final Balloon balloon = showPopupHelper(inspectorGroupManagerService, editor.getProject(), node, location, service);
if (point != null) {
balloon.show(new PropertyBalloonPositionTrackerScreenshot(editor, point), Balloon.Position.below);
}
else {
final int offset = location.getOffset();
final TextRange textRange = new TextRange(offset, offset + 1);
balloon.show(new PropertyBalloonPositionTracker(editor, textRange), Balloon.Position.below);
}
return balloon;
}
public static Balloon showPopup(
InspectorGroupManagerService inspectorGroupManagerService,
Project project,
Component component,
@Nullable DiagnosticsNode node,
@NonNls InspectorService.Location location,
FlutterDartAnalysisServer service,
Point point
) {
final Balloon balloon = showPopupHelper(inspectorGroupManagerService, project, node, location, service);
balloon.show(new RelativePoint(component, point), Balloon.Position.above);
return balloon;
}
public static Balloon showPopupHelper(
InspectorGroupManagerService inspectorService,
Project project,
@Nullable DiagnosticsNode node,
@NotNull InspectorService.Location location,
FlutterDartAnalysisServer service
) {
final Color GRAPHITE_COLOR = new JBColor(new Color(236, 236, 236, 215), new Color(60, 63, 65, 215));
final Disposable panelDisposable = Disposer.newDisposable();
final PropertyEditorPanel panel =
new PropertyEditorPanel(inspectorService, project, service, true, true, panelDisposable);
final StableWidgetTracker tracker = new StableWidgetTracker(location, service, project, panelDisposable);
final EventStream<VirtualFile> activeFile = new EventStream<>(location.getFile());
panel.initalize(node, tracker.getCurrentOutlines(), activeFile);
panel.setBackground(GRAPHITE_COLOR);
panel.setOpaque(false);
final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(panel);
balloonBuilder.setFadeoutTime(0);
balloonBuilder.setFillColor(GRAPHITE_COLOR);
balloonBuilder.setAnimationCycle(0);
balloonBuilder.setHideOnClickOutside(true);
balloonBuilder.setHideOnKeyOutside(false);
balloonBuilder.setHideOnAction(false);
balloonBuilder.setCloseButtonEnabled(false);
balloonBuilder.setBlockClicksThroughBalloon(true);
balloonBuilder.setRequestFocus(true);
balloonBuilder.setShadow(true);
final Balloon balloon = balloonBuilder.createBalloon();
Disposer.register(balloon, panelDisposable);
return balloon;
}
InspectorObjectGroupManager getGroupManager() {
return inspectorStateServiceClient.getGroupManager();
}
int getOffset() {
if (outline == null) return -1;
final VirtualFile file = activeFile.getValue();
if (file == null) return -1;
final OutlineOffsetConverter converter = new OutlineOffsetConverter(project, file);
return converter.getConvertedOutlineOffset(outline);
}
InspectorService.Location getInspectorLocation() {
final VirtualFile file = activeFile.getValue();
if (file == null || outline == null) {
return null;
}
final Document document = FileDocumentManager.getInstance().getDocument(file);
return InspectorService.Location.outlineToLocation(project, activeFile.getValue(), outline, document);
}
void updateWidgetDescription() {
final VirtualFile file = activeFile.getValue();
final int offset = getOffset();
if (file == null ||
offset < 0 ||
outline == null ||
outline.getClassName() == null ||
(!FlutterOutlineKind.NEW_INSTANCE.equals(outline.getKind()))) {
if (!properties.isEmpty()) {
properties.clear();
rebuildUi();
}
return;
}
final CompletableFuture<List<FlutterWidgetProperty>> future =
flutterDartAnalysisService.getWidgetDescription(file, offset);
propertyFuture = future;
if (propertyFuture == null) return;
AsyncUtils.whenCompleteUiThread(propertyFuture, (updatedProperties, throwable) -> {
if (propertyFuture != future || updatedProperties == null || throwable != null) {
// This response is obsolete as there was a newer request.
return;
}
if (offset != getOffset() || !file.equals(activeFile.getValue())) {
return;
}
properties.clear();
properties.addAll(updatedProperties);
propertyMap.clear();
currentExpressionMap.clear();
for (FlutterWidgetProperty property : updatedProperties) {
final String name = property.getName();
propertyMap.put(name, property);
currentExpressionMap.put(name, property.getExpression());
}
if (propertyMap.isEmpty()) {
// TODO(jacobr): is this still needed now that we have dealt with timeout
// issues by making the analysis server api async?
numFailures++;
if (numFailures < 3) {
retryLookupPropertiesRateLimiter.scheduleRequest();
}
return;
}
numFailures = 0;
rebuildUi();
});
}
public void outlinesChanged(List<FlutterOutline> outlines) {
final FlutterOutline nextOutline = outlines.isEmpty() ? null : outlines.get(0);
if (nextOutline == outline) return;
this.outline = nextOutline;
maybeLoadProperties();
lookupMatchingElements();
}
public void lookupMatchingElements() {
final InspectorObjectGroupManager groupManager = getGroupManager();
if (groupManager == null || outline == null) return;
groupManager.cancelNext();
node = null;
final InspectorService.ObjectGroup group = groupManager.getNext();
final InspectorService.Location location = getInspectorLocation();
group.safeWhenComplete(group.getElementsAtLocation(location, 10), (elements, error) -> {
if (elements == null || error != null) {
return;
}
node = elements.isEmpty() ? null : elements.get(0);
groupManager.promoteNext();
});
}
public DiagnosticsNode getNode() {
return node;
}
void maybeLoadProperties() {
updateWidgetDescription();
}
public void initalize(
DiagnosticsNode node,
EventStream<List<FlutterOutline>> currentOutlines,
EventStream<VirtualFile> activeFile
) {
this.node = node;
this.activeFile = activeFile;
currentOutlines.listen(this::outlinesChanged, true);
if (showWidgetEditToolbar) {
final WidgetEditToolbar widgetEditToolbar =
new WidgetEditToolbar(true, currentOutlines, activeFile, project, flutterDartAnalysisService);
final ActionToolbar toolbar = widgetEditToolbar.getToolbar();
toolbar.setShowSeparatorTitles(true);
setToolbar(toolbar.getComponent());
}
rebuildUi();
}
protected void rebuildUi() {
// TODO(jacobr): be lazier about only rebuilding what changed.
final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (focusOwner != null) {
if (isAncestorOf(focusOwner)) {
for (Map.Entry<String, JComponent> entry : fields.entrySet()) {
if (entry.getValue().isAncestorOf(focusOwner) || entry.getValue() == focusOwner) {
previouslyFocusedProperty = entry.getKey();
break;
}
}
}
else {
previouslyFocusedProperty = null;
}
}
removeAll();
// Layout Constraints
// Column constraints
final MigLayout manager = new MigLayout(
"insets 3", // Layout Constraints
fixedWidth ? "[::120]5[:20:400]" : "[::120]5[grow]", // Column constraints
"[23]4[23]"
);
setLayout(manager);
int added = 0;
for (FlutterWidgetProperty property : properties) {
final String name = property.getName();
if (name.equals("child") || name.equals("children")) {
continue;
}
if (name.equals("Container")) {
final List<FlutterWidgetProperty> containerProperties = property.getChildren();
// TODO(jacobr): add support for container properties.
continue;
}
final String documentation = property.getDocumentation();
JComponent field;
if (property.getEditor() == null) {
// TODO(jacobr): detect color properties more robustly.
final boolean colorProperty = name.equals("color");
final String colorPropertyName = name;
if (colorProperty) {
field = buildColorProperty(name, property);
}
else {
String expression = property.getExpression();
if (expression == null) {
expression = "";
}
final JBTextField textField = new JBTextField(expression);
// Make sure we show the text at the beginning of the text field.
// The default is to show the end if the content scrolls which looks
// bad in a property editor.
textField.setCaretPosition(0);
addTextFieldListeners(name, textField);
field = textField;
}
}
else {
final FlutterWidgetPropertyEditor editor = property.getEditor();
if (editor.getEnumItems() != null) {
final ComboBox<EnumValueWrapper> comboBox = new ComboBox<>();
comboBox.setEditable(true);
comboBox.setModel(new PropertyEnumComboBoxModel(property));
// TODO(jacobr): need a bit more padding around comboBox to make it match the JBTextField.
field = comboBox;
comboBox.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
final EnumValueWrapper wrapper = (EnumValueWrapper)e.getItem();
if (wrapper.item != null) {
setParsedPropertyValue(name, new FlutterWidgetPropertyValue(null, null, null, null, wrapper.item, null), false);
}
else {
setPropertyValue(name, wrapper.expression);
}
}
});
}
else {
// TODO(jacobr): use IntegerField and friends when appropriate.
// TODO(jacobr): we should probably use if (property.isSafeToUpdate())
// but that currently it seems to have a bunch of false positives.
final String kind = property.getEditor().getKind();
if (Objects.equals(kind, FlutterWidgetPropertyEditorKind.BOOL)) {
// TODO(jacobr): show as boolean.
}
final JBTextField textField = new JBTextField(property.getExpression());
// Make sure we show the text at the beginning of the text field.
// The default is to show the end if the content scrolls which looks
// bad in a property editor.
textField.setCaretPosition(0);
field = textField;
addTextFieldListeners(name, textField);
}
}
if (name.equals("data")) {
if (documentation != null) {
field.setToolTipText(documentation);
}
else {
field.setToolTipText("data");
}
add(field, "span, growx");
}
else {
final String propertyName = property.getName();
final JBLabel label = new JBLabel(propertyName);
// 120 is the max width of the column but that does not appear to be
// applied unless it is also set here.
add(label, "right, wmax 120px");
final ArrayList<String> tooltipBlocks = new ArrayList<>();
tooltipBlocks.add("<strong>" + propertyName + "</strong>");
if (documentation != null) {
tooltipBlocks.add(documentation);
}
// Use multiple line breaks so there is a clear separation between blocks.
label.setToolTipText(Joiner.on("\n\n").join(tooltipBlocks));
add(field, "wrap, growx");
}
if (documentation != null) {
field.setToolTipText(documentation);
}
// Hack: set the preferred width of the ui elements to a small value
// so it doesn't cause the overall layout to be wider than it should
// be.
if (!fixedWidth) {
setPreferredFieldSize(field);
}
fields.put(name, field);
added++;
}
if (previouslyFocusedProperty != null && fields.containsKey(previouslyFocusedProperty)) {
fields.get(previouslyFocusedProperty).requestFocus();
}
if (added == 0) {
add(new JBLabel("No editable properties"));
}
// TODO(jacobr): why is this needed?
revalidate();
repaint();
}
private JTextField buildColorProperty(String name, FlutterWidgetProperty property) {
return new ColorField(this, name, property, parentDisposable);
}
public void addTextFieldListeners(String name, JBTextField field) {
final FlutterOutline matchingOutline = outline;
field.addActionListener(e -> setPropertyValue(name, field.getText()));
field.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
}
@Override
public void focusLost(FocusEvent e) {
if (outline != matchingOutline) {
// Don't do anything. The user has moved on to a different outline node.
return;
}
setPropertyValue(name, field.getText());
}
});
}
private void setPreferredFieldSize(JComponent field) {
field.setPreferredSize(new Dimension(20, (int)field.getPreferredSize().getHeight()));
}
public String getDescription() {
final List<String> parts = new ArrayList<>();
if (outline != null && outline.getClassName() != null) {
parts.add(outline.getClassName());
}
parts.add("Properties");
return Joiner.on(" ").join(parts);
}
void setPropertyValue(String propertyName, String expression) {
setPropertyValue(propertyName, expression, false);
}
void setPropertyValue(String propertyName, String expression, boolean force) {
setParsedPropertyValue(propertyName, new FlutterWidgetPropertyValue(null, null, null, null, null, expression), force);
}
private void setParsedPropertyValue(String propertyName, FlutterWidgetPropertyValue value, boolean force) {
final boolean updated = setParsedPropertyValueHelper(propertyName, value);
if (!updated && force) {
hotReload();
}
}
private boolean setParsedPropertyValueHelper(String propertyName, FlutterWidgetPropertyValue value) {
// TODO(jacobr): also do simple tracking of how the previous expression maps to the current expression to avoid spurious edits.
// Treat an empty expression and empty value objects as omitted values
// indicating the property should be removed.
final FlutterWidgetPropertyValue emptyValue = new FlutterWidgetPropertyValue(null, null, null, null, null, null);
final FlutterWidgetProperty property = propertyMap.get(propertyName);
if (property == null) {
// UI is in the process of updating. Skip this action.
return false;
}
if (property.getExpression() != null && property.getExpression().equals(value.getExpression())) {
return false;
}
if (value != null && Objects.equals(value.getExpression(), "") || emptyValue.equals(value)) {
// Normalize empty expressions to simplify calling this api.
value = null;
}
final String lastExpression = currentExpressionMap.get(propertyName);
if (lastExpression != null && value != null && lastExpression.equals(value.getExpression())) {
return false;
}
currentExpressionMap.put(propertyName, value != null ? value.getExpression() : null);
final FlutterWidgetPropertyEditor editor = property.getEditor();
if (editor != null && value != null && value.getExpression() != null) {
final String expression = value.getExpression();
// Normalize expressions as primitive values.
final String kind = editor.getKind();
switch (kind) {
case FlutterWidgetPropertyEditorKind.BOOL: {
if (expression.equals("true")) {
value = new FlutterWidgetPropertyValue(true, null, null, null, null, null);
}
else if (expression.equals("false")) {
value = new FlutterWidgetPropertyValue(false, null, null, null, null, null);
}
}
break;
case FlutterWidgetPropertyEditorKind.STRING: {
// TODO(jacobr): there might be non-string literal cases that match this patterned.
if (expression.length() >= 2 && (
(expression.startsWith("'") && expression.endsWith("'")) ||
(expression.startsWith("\"") && expression.endsWith("\"")))) {
value = new FlutterWidgetPropertyValue(null, null, null, expression.substring(1, expression.length() - 1), null, null);
}
}
break;
case FlutterWidgetPropertyEditorKind.DOUBLE: {
try {
final double doubleValue = Double.parseDouble(expression);
if (((double)((int)doubleValue)) == doubleValue) {
// Express doubles that can be expressed as ints as ints.
value = new FlutterWidgetPropertyValue(null, null, (int)doubleValue, null, null, null);
}
else {
value = new FlutterWidgetPropertyValue(null, doubleValue, null, null, null, null);
}
}
catch (NumberFormatException e) {
// Don't convert value.
}
}
break;
case FlutterWidgetPropertyEditorKind.INT: {
try {
final int intValue = Integer.parseInt(expression);
value = new FlutterWidgetPropertyValue(null, null, intValue, null, null, null);
}
catch (NumberFormatException e) {
// Don't convert value.
}
}
break;
}
}
if (Objects.equals(property.getValue(), value)) {
// Short circuit as nothing changed.
return false;
}
final SourceChange change;
try {
change = flutterDartAnalysisService.setWidgetPropertyValue(property.getId(), value);
}
catch (Exception e) {
if (value != null && value.getExpression() != null) {
FlutterMessages.showInfo("Invalid property value", value.getExpression(), project);
}
else {
FlutterMessages.showError("Unable to set propery value", e.getMessage(), project);
}
return false;
}
if (change != null && change.getEdits() != null && !change.getEdits().isEmpty()) {
// TODO(jacobr): does running a write action make sense here? We are
// already on the UI thread.
ApplicationManager.getApplication().runWriteAction(() -> {
try {
AssistUtils.applySourceChange(project, change, false);
hotReload();
}
catch (DartSourceEditException exception) {
FlutterMessages.showInfo("Failed to apply code change", exception.getMessage(), project);
}
});
return true;
}
return false;
}
private void hotReload() {
// TODO(jacobr): handle multiple simultaneously running Flutter applications.
final FlutterApp app = inspectorStateServiceClient.getApp();
if (app != null) {
final ArrayList<FlutterApp> apps = new ArrayList<>();
apps.add(app);
if (pendingHotReload) {
// It is important we don't try to trigger multiple hot reloads
// as that will result in annoying user visible error messages.
needHotReload = true;
}
else {
pendingHotReload = true;
needHotReload = false;
FlutterReloadManager.getInstance(project).saveAllAndReloadAll(apps, "Property Editor");
}
}
}
public FlutterOutline getCurrentOutline() {
return outline;
}
}
class PropertyBalloonPositionTracker extends PositionTracker<Balloon> {
private final Editor myEditor;
private final TextRange myRange;
PropertyBalloonPositionTracker(Editor editor, TextRange range) {
super(editor.getContentComponent());
myEditor = editor;
myRange = range;
}
static boolean insideVisibleArea(Editor e, TextRange r) {
final int textLength = e.getDocument().getTextLength();
if (r.getStartOffset() > textLength) return false;
if (r.getEndOffset() > textLength) return false;
final Rectangle visibleArea = e.getScrollingModel().getVisibleArea();
final Point point = e.logicalPositionToXY(e.offsetToLogicalPosition(r.getStartOffset()));
return visibleArea.contains(point);
}
@Override
public RelativePoint recalculateLocation(final Balloon balloon) {
final int startOffset = myRange.getStartOffset();
final int endOffset = myRange.getEndOffset();
final Point startPoint = myEditor.visualPositionToXY(myEditor.offsetToVisualPosition(startOffset));
final Point endPoint = myEditor.visualPositionToXY(myEditor.offsetToVisualPosition(endOffset));
final Point point = new Point((startPoint.x + endPoint.x) / 2, startPoint.y + myEditor.getLineHeight());
return new RelativePoint(myEditor.getContentComponent(), point);
}
}
class PropertyBalloonPositionTrackerScreenshot extends PositionTracker<Balloon> {
private final Editor myEditor;
private final Point point;
PropertyBalloonPositionTrackerScreenshot(Editor editor, Point point) {
super(editor.getComponent());
myEditor = editor;
this.point = point;
}
@Override
public RelativePoint recalculateLocation(final Balloon balloon) {
return new RelativePoint(myEditor.getComponent(), point);
}
}
| flutter-intellij/flutter-idea/src/io/flutter/editor/PropertyEditorPanel.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/editor/PropertyEditorPanel.java",
"repo_id": "flutter-intellij",
"token_count": 10706
} | 600 |
/*
* Copyright 2017 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.inspector;
/**
* The various priority levels used to filter which diagnostics are shown and
* omitted.
* <p>
* Trees of Flutter diagnostics can be very large so filtering the diagnostics
* shown matters. Typically filtering to only show diagnostics with at least
* level debug is appropriate.
* <p>
* See https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/foundation/diagnostics.dart
* for the corresponding Dart enum.
*/
public enum DiagnosticLevel {
/**
* Diagnostics that should not be shown.
* <p>
* If a user chooses to display [hidden] diagnostics, they should not expect
* the diagnostics to be formatted consistently with other diagnostics and
* they should expect them to sometimes be be misleading. For example,
* [FlagProperty] and [ObjectFlagProperty] have uglier formatting when the
* property `value` does does not match a value with a custom flag
* description. An example of a misleading diagnostic is a diagnostic for
* a property that has no effect because some other property of the object is
* set in a way that causes the hidden property to have no effect.
*/
hidden,
/**
* Diagnostics that provide a hint about best practices.
* For example, a diagnostic providing a hint on on how to fix an overflow error.
*/
hint,
/**
* Diagnostics that summarize other diagnostics present.
* <p>
* For example, use this level for a short one or two line summary describing other diagnostics present.
*/
summary,
/**
* A diagnostic that is likely to be low value but where the diagnostic
* display is just as high quality as a diagnostic with a higher level.
* <p>
* Use this level for diagnostic properties that match their default value
* and other cases where showing a diagnostic would not add much value such
* as an [IterableProperty] where the value is empty.
*/
fine,
/**
* Diagnostics that should only be shown when performing fine grained
* debugging of an object.
* <p>
* Unlike a [fine] diagnostic, these diagnostics provide important
* information about the object that is likely to be needed to debug. Used by
* properties that are important but where the property value is too verbose
* (e.g. 300+ characters long) to show with a higher diagnostic level.
*/
debug,
/**
* Interesting diagnostics that should be typically shown.
*/
info,
/**
* Very important diagnostics that indicate problematic property values.
* <p>
* For example, use if you would write the property description
* message in ALL CAPS.
*/
warning,
/**
* Diagnostics that indicate errors or unexpected conditions.
* <p>
* For example, use for property values where computing the value throws an
* exception.
*/
error,
/**
* Special level indicating that no diagnostics should be shown.
* <p>
* Do not specify this level for diagnostics. This level is only used to
* filter which diagnostics are shown.
*/
off,
}
| flutter-intellij/flutter-idea/src/io/flutter/inspector/DiagnosticLevel.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/inspector/DiagnosticLevel.java",
"repo_id": "flutter-intellij",
"token_count": 875
} | 601 |
/*
* Copyright 2017 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.inspector;
import com.intellij.xdebugger.XSourcePosition;
import com.intellij.xdebugger.frame.XNavigatable;
import com.intellij.xdebugger.frame.XValue;
public class JumpToSourceAction extends JumpToSourceActionBase {
public JumpToSourceAction() {
super("jumpToSource");
}
@Override
protected XSourcePosition getSourcePosition(DiagnosticsNode node) {
if (!node.hasCreationLocation()) {
return null;
}
return node.getCreationLocation().getXSourcePosition();
}
@Override
protected void startComputingSourcePosition(XValue value, XNavigatable navigatable) {
// This case only typically works for Function objects where the source
// position is available.
value.computeSourcePosition(navigatable);
}
protected boolean isSupported(DiagnosticsNode diagnosticsNode) {
// TODO(jacobr): also return true if the value of the DiagnosticsNode is
// a Function object as we can get a source position through the
// Observatory protocol in that case.
return diagnosticsNode.hasCreationLocation();
}
}
| flutter-intellij/flutter-idea/src/io/flutter/inspector/JumpToSourceAction.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/inspector/JumpToSourceAction.java",
"repo_id": "flutter-intellij",
"token_count": 371
} | 602 |
/*
* Copyright 2019 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.logging;
import com.google.common.annotations.VisibleForTesting;
import com.intellij.openapi.util.text.StringUtil;
import io.flutter.inspector.DiagnosticLevel;
import io.flutter.inspector.DiagnosticsNode;
import java.util.regex.Pattern;
public class FlutterErrorHelper {
private static final Pattern numberPattern = Pattern.compile("[0-9]+(\\.[0-9]+)?");
public static String getAnalyticsId(DiagnosticsNode node) {
for (DiagnosticsNode property : node.getInlineProperties()) {
if (property.getLevel() == DiagnosticLevel.summary) {
final String description = property.getDescription();
return getAnalyticsId(description);
}
}
return null;
}
@VisibleForTesting
public static String getAnalyticsId(String errorSummary) {
// "A RenderFlex overflowed by 1183 pixels on the right."
// TODO(devoncarew): Re-evaluate this normalization after we've implemented a kernel transformer
// for Flutter error description objects.
// normalize to lower case
String normalized = errorSummary.toLowerCase().trim();
// Ensure that asserts are broken across lines.
normalized = normalized.replaceAll(": failed assertion:", ":\nfailed assertion:");
// If it's an assertion, remove the leading assertion path.
final String[] lines = normalized.split("\n");
if (lines.length >= 2 && lines[0].endsWith(".dart':") && lines[1].startsWith("failed assertion:")) {
normalized = StringUtil.join(lines, 1, lines.length, "\n");
normalized = normalized.trim();
}
// Take the first sentence.
if (normalized.contains(". ")) {
normalized = normalized.substring(0, normalized.indexOf(". "));
normalized = normalized.trim();
}
// Take the first line.
if (normalized.contains("\n")) {
normalized = normalized.substring(0, normalized.indexOf("\n"));
}
// Take text before the first colon.
if (normalized.contains(":")) {
normalized = normalized.substring(0, normalized.indexOf(":"));
}
// remove some suffixes
if (normalized.endsWith(".")) {
normalized = normalized.substring(0, normalized.length() - ".".length());
}
// remove content in parens
normalized = normalized.replaceAll("\\([^)]*\\)", "");
// replace numbers with a string constant
normalized = numberPattern.matcher(normalized).replaceAll("xxx");
// collapse multiple spaces
normalized = normalized.replaceAll("\\s+", " ");
normalized = normalized.trim();
// convert spaces to dashes
normalized = normalized.trim().replaceAll(" ", "-");
// "renderflex-overflowed-by-xxx-pixels-on-the-right"
// "no-material-widget-found"
// "scaffold.of-called-with-a-context-that-does-not-contain-a-scaffold"
return normalized;
}
}
| flutter-intellij/flutter-idea/src/io/flutter/logging/FlutterErrorHelper.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/logging/FlutterErrorHelper.java",
"repo_id": "flutter-intellij",
"token_count": 987
} | 603 |
/*
* Copyright 2018 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.perf;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.impl.http.HttpVirtualFile;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.testFramework.LightVirtualFile;
import com.intellij.xdebugger.XDebuggerUtil;
import com.intellij.xdebugger.XSourcePosition;
import com.jetbrains.lang.dart.psi.DartId;
import com.jetbrains.lang.dart.psi.DartReferenceExpression;
import io.flutter.inspector.InspectorService;
import org.jetbrains.annotations.Nullable;
public class DocumentFileLocationMapper implements FileLocationMapper {
@Nullable private final Document document;
private final PsiFile psiFile;
private final VirtualFile virtualFile;
private final XDebuggerUtil debuggerUtil;
public DocumentFileLocationMapper(String path, Project project) {
this(lookupDocument(path, project), project);
}
@Nullable
public static Document lookupDocument(String path, Project project) {
final String fileName = InspectorService.fromSourceLocationUri(path, project);
final VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(fileName);
if (virtualFile != null && virtualFile.exists() &&
!(virtualFile instanceof LightVirtualFile) && !(virtualFile instanceof HttpVirtualFile)) {
return FileDocumentManager.getInstance().getDocument(virtualFile);
}
return null;
}
DocumentFileLocationMapper(@Nullable Document document, Project project) {
this.document = document;
if (document != null) {
psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
virtualFile = psiFile != null ? psiFile.getVirtualFile() : null;
debuggerUtil = XDebuggerUtil.getInstance();
}
else {
psiFile = null;
virtualFile = null;
debuggerUtil = null;
}
}
@Nullable
@Override
public TextRange getIdentifierRange(int line, int column) {
if (psiFile == null) {
return null;
}
// Convert to zero based line and column indices.
line = line - 1;
column = column - 1;
if (document == null || line >= document.getLineCount() || document.isLineModified(line)) {
return null;
}
final XSourcePosition pos = debuggerUtil.createPosition(virtualFile, line, column);
if (pos == null) {
return null;
}
final int offset = pos.getOffset();
PsiElement element = psiFile.getOriginalFile().findElementAt(offset);
if (element == null) {
return null;
}
// Handle named constructors gracefully. For example, for the constructor
// Image.asset(...) we want to return "Image.asset" instead of "asset".
if (element.getParent() instanceof DartId) {
element = element.getParent();
}
while (element.getParent() instanceof DartReferenceExpression) {
element = element.getParent();
}
return element.getTextRange();
}
@Nullable
@Override
public String getText(@Nullable TextRange textRange) {
if (document == null || textRange == null) {
return null;
}
return document.getText(textRange);
}
@Override
public String getPath() {
return psiFile == null ? null : psiFile.getVirtualFile().getPath();
}
}
| flutter-intellij/flutter-idea/src/io/flutter/perf/DocumentFileLocationMapper.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/perf/DocumentFileLocationMapper.java",
"repo_id": "flutter-intellij",
"token_count": 1229
} | 604 |
/*
* Copyright 2018 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.perf;
import com.google.common.base.Objects;
import io.flutter.inspector.DiagnosticsNode;
import javax.swing.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* Rule describing when to generate a performance tip.
* <p>
* In the future it would make sense to read the rule definitions in from a
* JSON file instead of hard coding the rules in this file. The set of rules
* defined in this file is hardly exaustive and the thresholds for when the
* rules activate could easily be made looser.
*/
public class PerfTipRule {
final PerfReportKind kind;
final int priority;
final String hackFileName;
final String message;
/**
* A unique identifier used for analytics.
*/
final String id;
final String url;
WidgetPattern pattern;
final int minProblemLocationsInSubtree;
final int minSinceNavigate;
final int minPerSecond;
final Icon icon;
PerfTipRule(
PerfReportKind kind,
int priority,
String hackFileName,
String message,
String id,
String url,
WidgetPattern pattern,
int minProblemLocationsInSubtree,
int minSinceNavigate,
int minPerSecond,
Icon icon
) {
this.kind = kind;
this.priority = priority;
this.hackFileName = hackFileName;
this.message = message;
this.id = id;
this.url = url;
this.pattern = pattern;
this.minProblemLocationsInSubtree = minProblemLocationsInSubtree;
this.minSinceNavigate = minSinceNavigate;
this.minPerSecond = minPerSecond;
this.icon = icon;
}
static public WidgetPattern matchParent(String name) {
return new WidgetPattern(name, null);
}
static public WidgetPattern matchWidget(String name) {
return new WidgetPattern(null, name);
}
public String getId() {
return id;
}
public static boolean equalTipRule(PerfTip a, PerfTip b) {
if (a == null || b == null) {
return a == b;
}
return Objects.equal(a.getRule(), b.getRule());
}
public static boolean equivalentPerfTips(List<PerfTip> a, List<PerfTip> b) {
if (a == null || b == null) {
return a == b;
}
if (a.size() != b.size()) {
return false;
}
for (int i = 0; i < a.size(); ++i) {
if (!equalTipRule(a.get(i), b.get(i))) {
return false;
}
}
return true;
}
public String getMessage() {
return message;
}
public String getUrl() {
return url;
}
public Icon getIcon() {
return icon;
}
String getHtmlFragmentDescription() {
return "<p><a href='" + url + "'>" + message + "</a></p>";
}
boolean maybeMatches(SummaryStats summary) {
if (!matchesFrequency(summary)) {
return false;
}
return pattern.widget == null || pattern.widget.equals(summary.getDescription());
}
boolean matchesFrequency(SummaryStats summary) {
return (minSinceNavigate > 0 && summary.getValue(PerfMetric.totalSinceEnteringCurrentScreen) >= minSinceNavigate) ||
(minPerSecond > 0 && summary.getValue(PerfMetric.pastSecond) >= minPerSecond);
}
boolean matches(SummaryStats summary, Collection<DiagnosticsNode> candidates, Map<Integer, SummaryStats> statsInFile) {
if (!maybeMatches(summary)) {
return false;
}
if (pattern.parentWidget != null) {
final boolean patternIsStateful = Objects.equal(pattern.parentWidget, "StatefulWidget");
for (DiagnosticsNode candidate : candidates) {
if (ancestorMatches(statsInFile, patternIsStateful, candidate, candidate.getParent())) {
return true;
}
}
return false;
}
if (pattern.widget != null) {
for (DiagnosticsNode candidate : candidates) {
if (pattern.widget.equals(candidate.getWidgetRuntimeType())) {
return true;
}
}
}
return false;
}
private boolean ancestorMatches(Map<Integer, SummaryStats> statsInFile,
boolean patternIsStateful,
DiagnosticsNode candidate,
DiagnosticsNode parent) {
if (parent == null) {
return false;
}
if ((parent.isStateful() && patternIsStateful) || (pattern.parentWidget.equals(parent.getWidgetRuntimeType()))) {
return minProblemLocationsInSubtree <= 1 || minProblemLocationsInSubtree <= countSubtreeMatches(candidate, statsInFile);
}
parent = parent.getParent();
if (parent != null && Objects.equal(parent.getCreationLocation().getFile(), candidate.getCreationLocation().getFile())) {
// Keep walking up the tree until we hit a different file.
// TODO(jacobr): this is a bit of an ugly heuristic. Think of a cleaner
// way of expressing this concept. In reality we could probably force the
// ancestor to be in the same build method.
return ancestorMatches(statsInFile, patternIsStateful, candidate, parent);
}
return false;
}
// TODO(jacobr): this method might be slow in degenerate cases if an extreme
// number of locations in a source file match a rule. We could memoize match
// counts to avoid a possible O(n^2) algorithm worst case.
private int countSubtreeMatches(DiagnosticsNode candidate, Map<Integer, SummaryStats> statsInFile) {
final int id = candidate.getLocationId();
int matches = 0;
if (id >= 0) {
final SummaryStats stats = statsInFile.get(id);
if (stats != null && maybeMatches(stats)) {
matches += 1;
}
}
final ArrayList<DiagnosticsNode> children = candidate.getChildren().getNow(null);
if (children != null) {
for (DiagnosticsNode child : children) {
matches += countSubtreeMatches(child, statsInFile);
}
}
return matches;
}
/**
* Pattern describing expectations for the names of a widget and the name of
* its parent in the widget tree.
*/
static public class WidgetPattern {
final String parentWidget;
final String widget;
WidgetPattern(String parentWidget, String widget) {
this.parentWidget = parentWidget;
this.widget = widget;
}
}
}
| flutter-intellij/flutter-idea/src/io/flutter/perf/PerfTipRule.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/perf/PerfTipRule.java",
"repo_id": "flutter-intellij",
"token_count": 2234
} | 605 |
/*
* Copyright 2019 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.performance;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.util.Disposer;
import com.intellij.ui.ScrollPaneFactory;
import io.flutter.inspector.WidgetPerfTipsPanel;
import io.flutter.perf.FlutterWidgetPerf;
import io.flutter.perf.FlutterWidgetPerfManager;
import io.flutter.perf.PerfMetric;
import io.flutter.perf.PerfReportKind;
import io.flutter.run.daemon.FlutterApp;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
class WidgetPerfSummary extends JPanel implements Disposable {
private static final int REFRESH_TABLE_DELAY = 100;
private final FlutterWidgetPerfManager perfManager;
private final Timer refreshTableTimer;
private final WidgetPerfTable table;
private final PerfReportKind reportKind;
private final WidgetPerfTipsPanel myWidgetPerfTipsPanel;
private long lastUpdateTime;
WidgetPerfSummary(Disposable parentDisposable, FlutterApp app, PerfMetric metric, PerfReportKind reportKind) {
setLayout(new BorderLayout());
this.reportKind = reportKind;
perfManager = FlutterWidgetPerfManager.getInstance(app.getProject());
refreshTableTimer = new Timer(REFRESH_TABLE_DELAY, this::onUpdateTable);
refreshTableTimer.start();
table = new WidgetPerfTable(app, parentDisposable, metric);
Disposer.register(parentDisposable, this);
perfManager.addPerfListener(table);
add(ScrollPaneFactory.createScrollPane(table, true), BorderLayout.CENTER);
// Perf info and tips
myWidgetPerfTipsPanel = new WidgetPerfTipsPanel(parentDisposable, app);
}
public void dispose() {
perfManager.removePerfListener(table);
refreshTableTimer.stop();
}
public WidgetPerfTipsPanel getWidgetPerfTipsPanel() {
return myWidgetPerfTipsPanel;
}
private void onUpdateTable(ActionEvent event) {
final FlutterWidgetPerf stats = perfManager.getCurrentStats();
if (stats != null) {
final long latestPerfUpdate = stats.getLastLocalPerfEventTime();
// Only do work if new performance stats have been recorded.
if (latestPerfUpdate != lastUpdateTime) {
lastUpdateTime = latestPerfUpdate;
table.showStats(stats.getStatsForMetric(table.getMetrics(), reportKind));
}
}
}
public void clearPerformanceTips() {
myWidgetPerfTipsPanel.clearTips();
}
}
| flutter-intellij/flutter-idea/src/io/flutter/performance/WidgetPerfSummary.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/performance/WidgetPerfSummary.java",
"repo_id": "flutter-intellij",
"token_count": 826
} | 606 |
/*
* Copyright 2019 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.pub;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
/**
* Cache the information computed from pubspecs in the project.
*/
public class PubRootCache {
@NotNull
public static PubRootCache getInstance(@NotNull final Project project) {
return Objects.requireNonNull(project.getService(PubRootCache.class));
}
@NotNull final Project project;
private final Map<VirtualFile, PubRoot> cache = new HashMap<>();
private PubRootCache(@NotNull final Project project) {
this.project = project;
}
@Nullable
public PubRoot getRoot(@NotNull PsiFile psiFile) {
final VirtualFile file = psiFile.getVirtualFile();
if (file == null) {
return null;
}
return getRoot(file);
}
@Nullable
public PubRoot getRoot(VirtualFile file) {
file = findPubspecDir(file);
if (file == null) {
return null;
}
PubRoot root = cache.get(file);
if (root == null) {
cache.put(file, PubRoot.forDirectory(file));
root = cache.get(file);
}
return root;
}
@NotNull
public List<PubRoot> getRoots(Module module) {
final List<PubRoot> result = new ArrayList<>();
for (VirtualFile dir : ModuleRootManager.getInstance(module).getContentRoots()) {
PubRoot root = cache.get(dir);
if (root == null) {
cache.put(dir, PubRoot.forDirectory(dir));
root = cache.get(dir);
}
if (root != null) {
result.add(root);
}
}
return result;
}
@NotNull
public List<PubRoot> getRoots(@NotNull Project project) {
final List<PubRoot> result = new ArrayList<>();
for (Module module : ModuleManager.getInstance(project).getModules()) {
result.addAll(getRoots(module));
}
return result;
}
@Nullable
private VirtualFile findPubspecDir(VirtualFile file) {
if (file == null) {
return null;
}
if (file.isDirectory()) {
final VirtualFile pubspec = file.findChild("pubspec.yaml");
if (pubspec != null && pubspec.exists() && !pubspec.isDirectory()) {
return file;
}
}
return findPubspecDir(file.getParent());
}
}
| flutter-intellij/flutter-idea/src/io/flutter/pub/PubRootCache.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/pub/PubRootCache.java",
"repo_id": "flutter-intellij",
"token_count": 958
} | 607 |
/*
* Copyright 2018 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.run.bazelTest;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.Executor;
import com.intellij.execution.configurations.*;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.WriteExternalException;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
/**
* The Bazel version of the {@link io.flutter.run.test.TestConfig}.
*/
public class BazelTestConfig extends LocatableConfigurationBase<CommandLineState> {
@NotNull private BazelTestFields fields;
BazelTestConfig(@NotNull final Project project, @NotNull final ConfigurationFactory factory, @NotNull final String name) {
super(project, factory, name);
fields = new BazelTestFields(null, null, null, null);
}
@NotNull
BazelTestFields getFields() {
return fields;
}
void setFields(@NotNull BazelTestFields newFields) {
fields = newFields;
}
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
fields.checkRunnable(getProject());
}
@NotNull
@Override
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
return new FlutterBazelTestConfigurationEditorForm(getProject());
}
@NotNull
@Override
public CommandLineState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
return BazelTestLaunchState.create(env, this);
}
@NotNull
public BazelTestConfig clone() {
final BazelTestConfig clone = (BazelTestConfig)super.clone();
clone.fields = fields.copy();
return clone;
}
@NotNull
RunConfiguration copyTemplateToNonTemplate(String name) {
final BazelTestConfig copy = (BazelTestConfig)super.clone();
copy.setName(name);
copy.fields = fields.copyTemplateToNonTemplate(getProject());
return copy;
}
@Override
public void writeExternal(@NotNull final Element element) throws WriteExternalException {
super.writeExternal(element);
fields.writeTo(element);
}
@Override
public void readExternal(@NotNull final Element element) throws InvalidDataException {
super.readExternal(element);
fields = BazelTestFields.readFrom(element);
}
}
| flutter-intellij/flutter-idea/src/io/flutter/run/bazelTest/BazelTestConfig.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/run/bazelTest/BazelTestConfig.java",
"repo_id": "flutter-intellij",
"token_count": 770
} | 608 |
/*
* Copyright 2019 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.run.common;
import com.intellij.icons.AllIcons;
import com.intellij.psi.PsiElement;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
* Different scopes of test that can be run on a Flutter app.
*
* <p>
* Each scope corresponds to a 'test', 'group', or 'main' method declaration in a Dart test file.
*/
public enum TestType {
// Note that mapping elements to their most specific enclosing function call depends on the ordering from most to least specific.
SINGLE(AllIcons.RunConfigurations.TestState.Run),
GROUP(AllIcons.RunConfigurations.TestState.Run_run),
/**
* This {@link TestType} doesn't know how to detect main methods.
* The logic to detect main methods is in {@link CommonTestConfigUtils}.
*/
MAIN(AllIcons.RunConfigurations.TestState.Run_run) {
@NotNull
public String getTooltip(@NotNull PsiElement element) {
return "Run Tests";
}
};
@NotNull
private final Icon myIcon;
TestType(@NotNull Icon icon) {
myIcon = icon;
}
@NotNull
public Icon getIcon() {
return myIcon;
}
/**
* Describes the tooltip to show on a particular {@param element}.
*/
@NotNull
public String getTooltip(@NotNull PsiElement element, @NotNull CommonTestConfigUtils testConfigUtils) {
final String testName = testConfigUtils.findTestName(element);
if (StringUtils.isNotEmpty(testName)) {
return "Run '" + testName + "'";
}
return "Run Test";
}
}
| flutter-intellij/flutter-idea/src/io/flutter/run/common/TestType.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/run/common/TestType.java",
"repo_id": "flutter-intellij",
"token_count": 558
} | 609 |
/*
* Copyright 2016 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.run.daemon;
import com.google.common.base.Stopwatch;
import com.google.gson.JsonObject;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.ExecutionManager;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.process.ProcessAdapter;
import com.intellij.execution.process.ProcessEvent;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.execution.ui.ConsoleViewContentType;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.history.LocalHistory;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.EventDispatcher;
import com.intellij.util.concurrency.AppExecutorUtil;
import io.flutter.FlutterInitializer;
import io.flutter.FlutterMessages;
import io.flutter.FlutterUtils;
import io.flutter.ObservatoryConnector;
import io.flutter.bazel.Workspace;
import io.flutter.bazel.WorkspaceCache;
import io.flutter.logging.FlutterConsoleLogManager;
import io.flutter.pub.PubRoot;
import io.flutter.pub.PubRoots;
import io.flutter.run.FlutterDebugProcess;
import io.flutter.run.FlutterDevice;
import io.flutter.run.FlutterLaunchMode;
import io.flutter.run.common.RunMode;
import io.flutter.settings.FlutterSettings;
import io.flutter.utils.MostlySilentColoredProcessHandler;
import io.flutter.utils.ProgressHelper;
import io.flutter.utils.StreamSubscription;
import io.flutter.utils.UrlUtils;
import io.flutter.utils.VmServiceListenerAdapter;
import io.flutter.vmService.DisplayRefreshRateManager;
import io.flutter.vmService.ServiceExtensions;
import io.flutter.vmService.VMServiceManager;
import org.dartlang.vm.service.VmService;
import org.dartlang.vm.service.element.Event;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
// TODO(devoncarew): Move this class up to the io.flutter.run package.
/**
* A running Flutter app.
*/
public class FlutterApp implements Disposable {
private static final Logger LOG = Logger.getInstance(FlutterApp.class);
private static final Key<FlutterApp> FLUTTER_APP_KEY = new Key<>("FLUTTER_APP_KEY");
private final @NotNull Project myProject;
private final @Nullable Module myModule;
private final @NotNull RunMode myMode;
private final @NotNull FlutterDevice myDevice;
private final @NotNull ProcessHandler myProcessHandler;
private final @NotNull ExecutionEnvironment myExecutionEnvironment;
private final @NotNull DaemonApi myDaemonApi;
private final @NotNull GeneralCommandLine myCommand;
private @Nullable String myAppId;
private @Nullable String myWsUrl;
private @Nullable String myBaseUri;
private @Nullable ConsoleView myConsole;
private FlutterConsoleLogManager myFlutterConsoleLogManager;
/**
* The command with which the app was launched.
* <p>
* Should be "run" if the app was `flutter run` and "attach" if the app was `flutter attach`.
*/
private @Nullable String myLaunchMode;
private @Nullable List<PubRoot> myPubRoots;
private int reloadCount;
private int userReloadCount;
private int restartCount;
private long maxFileTimestamp;
/**
* Non-null when the debugger is paused.
*/
private @Nullable Runnable myResume;
private final AtomicReference<State> myState = new AtomicReference<>(State.STARTING);
private final EventDispatcher<FlutterAppListener> listenersDispatcher = EventDispatcher.create(FlutterAppListener.class);
private final ObservatoryConnector myConnector;
private @Nullable FlutterDebugProcess myFlutterDebugProcess;
private @Nullable VmService myVmService;
private @Nullable VMServiceManager myVMServiceManager;
private static final Key<FlutterApp> APP_KEY = Key.create("FlutterApp");
public static void addToEnvironment(@NotNull ExecutionEnvironment env, @NotNull FlutterApp app) {
env.putUserData(APP_KEY, app);
}
@Nullable
public static FlutterApp fromEnv(@NotNull ExecutionEnvironment env) {
return env.getUserData(APP_KEY);
}
FlutterApp(@NotNull Project project,
@Nullable Module module,
@NotNull RunMode mode,
@NotNull FlutterDevice device,
@NotNull ProcessHandler processHandler,
@NotNull ExecutionEnvironment executionEnvironment,
@NotNull DaemonApi daemonApi,
@NotNull GeneralCommandLine command) {
myProject = project;
myModule = module;
myMode = mode;
myDevice = device;
myProcessHandler = processHandler;
myProcessHandler.putUserData(FLUTTER_APP_KEY, this);
myExecutionEnvironment = executionEnvironment;
myDaemonApi = daemonApi;
myCommand = command;
maxFileTimestamp = System.currentTimeMillis();
myConnector = new ObservatoryConnector() {
@Override
public @Nullable
String getWebSocketUrl() {
// Don't try to use observatory until the flutter command is done starting up.
if (getState() != State.STARTED) return null;
return myWsUrl;
}
public @Nullable
String getBrowserUrl() {
String url = myWsUrl;
if (url == null) return null;
if (url.startsWith("ws:")) {
url = "http:" + url.substring(3);
}
if (url.endsWith("/ws")) {
url = url.substring(0, url.length() - 3);
}
return url;
}
@Override
public String getRemoteBaseUrl() {
return myBaseUri;
}
@Override
public void onDebuggerPaused(@NotNull Runnable resume) {
myResume = resume;
}
@Override
public void onDebuggerResumed() {
myResume = null;
}
};
}
@NotNull
public GeneralCommandLine getCommand() {
return myCommand;
}
@Nullable
public static FlutterApp fromProcess(@NotNull ProcessHandler process) {
return process.getUserData(FLUTTER_APP_KEY);
}
@Nullable
public static FlutterApp firstFromProjectProcess(@NotNull Project project) {
final List<RunContentDescriptor> runningProcesses =
ExecutionManager.getInstance(project).getContentManager().getAllDescriptors();
for (RunContentDescriptor descriptor : runningProcesses) {
final ProcessHandler process = descriptor.getProcessHandler();
if (process != null) {
final FlutterApp app = FlutterApp.fromProcess(process);
if (app != null) {
return app;
}
}
}
return null;
}
@NotNull
public static List<FlutterApp> allFromProjectProcess(@NotNull Project project) {
final List<FlutterApp> allRunningApps = new ArrayList<>();
final List<RunContentDescriptor> runningProcesses =
ExecutionManager.getInstance(project).getContentManager().getAllDescriptors();
for (RunContentDescriptor descriptor : runningProcesses) {
final ProcessHandler process = descriptor.getProcessHandler();
if (process != null) {
final FlutterApp app = FlutterApp.fromProcess(process);
if (app != null) {
allRunningApps.add(app);
}
}
}
return allRunningApps;
}
/**
* Creates a process that will launch the flutter app.
* <p>
* (Assumes we are launching it in --machine mode.)
*/
@NotNull
public static FlutterApp start(@NotNull ExecutionEnvironment env,
@NotNull Project project,
@Nullable Module module,
@NotNull RunMode mode,
@NotNull FlutterDevice device,
@NotNull GeneralCommandLine command,
@Nullable String analyticsStart,
@Nullable String analyticsStop)
throws ExecutionException {
LOG.info(analyticsStart + " " + project.getName() + " (" + mode.mode() + ")");
LOG.info(command.toString());
Consumer<String> onTextAvailable = null;
if (WorkspaceCache.getInstance(project).isBazel()) {
Workspace workspace = WorkspaceCache.getInstance(project).get();
assert (workspace != null);
String configWarningPrefix = workspace.getConfigWarningPrefix();
if (configWarningPrefix != null) {
onTextAvailable = text -> {
if (text.startsWith(configWarningPrefix)) {
FlutterMessages.showWarning(
"Configuration warning",
UrlUtils.generateHtmlFragmentWithHrefTags(text.substring(configWarningPrefix.length())),
null
);
}
};
}
}
final ProcessHandler process = new MostlySilentColoredProcessHandler(command, onTextAvailable);
Disposer.register(project, process::destroyProcess);
// Send analytics for the start and stop events.
if (analyticsStart != null) {
FlutterInitializer.sendAnalyticsAction(analyticsStart);
}
final DaemonApi api = new DaemonApi(process);
final FlutterApp app = new FlutterApp(project, module, mode, device, process, env, api, command);
process.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(@NotNull ProcessEvent event) {
LOG.info(analyticsStop + " " + project.getName() + " (" + mode.mode() + ")");
if (analyticsStop != null) {
FlutterInitializer.sendAnalyticsAction(analyticsStop);
}
// Send analytics about whether this session used the reload workflow, the restart workflow, or neither.
final String workflowType = app.reloadCount > 0 ? "reload" : (app.restartCount > 0 ? "restart" : "none");
FlutterInitializer.getAnalytics().sendEvent("workflow", workflowType);
// Send the ratio of reloads to restarts.
int reloadfraction = 0;
if ((app.reloadCount + app.restartCount) > 0) {
final double fraction = (app.reloadCount * 100.0) / (app.reloadCount + app.restartCount);
reloadfraction = (int)Math.round(fraction);
}
FlutterInitializer.getAnalytics().sendEventMetric("workflow", "reloadFraction", reloadfraction);
Disposer.dispose(app);
}
});
api.listen(process, new FlutterAppDaemonEventListener(app, project));
return app;
}
@NotNull
public RunMode getMode() {
return myMode;
}
/**
* Returns the process running the daemon.
*/
@NotNull
public ProcessHandler getProcessHandler() {
return myProcessHandler;
}
@NotNull
public ObservatoryConnector getConnector() {
return myConnector;
}
public boolean appSupportsHotReload() {
// Introspect based on registered services.
if (myVMServiceManager != null && myVMServiceManager.hasAnyRegisteredServices()) {
return myVMServiceManager.hasRegisteredService("reloadSources");
}
return true;
}
public State getState() {
return myState.get();
}
public boolean isStarted() {
final State state = myState.get();
return state != State.STARTING && state != State.TERMINATED;
}
public boolean isReloading() {
return myState.get() == State.RELOADING || myState.get() == State.RESTARTING;
}
public boolean isConnected() {
return myState.get() != State.TERMINATING && myState.get() != State.TERMINATED;
}
void setAppId(@NotNull String id) {
myAppId = id;
}
void setWsUrl(@NotNull String url) {
myWsUrl = url;
}
void setBaseUri(@NotNull String uri) {
myBaseUri = uri;
}
void setLaunchMode(@Nullable String launchMode) {
myLaunchMode = launchMode;
}
/**
* Perform a hot restart of the the app.
*/
public CompletableFuture<DaemonApi.RestartResult> performRestartApp(@NotNull String reason) {
if (myAppId == null) {
FlutterUtils.warn(LOG, "cannot restart Flutter app because app id is not set");
final CompletableFuture<DaemonApi.RestartResult> result = new CompletableFuture<>();
result.completeExceptionally(new IllegalStateException("cannot restart Flutter app because app id is not set"));
return result;
}
restartCount++;
userReloadCount = 0;
LocalHistory.getInstance().putSystemLabel(getProject(), "Flutter hot restart");
maxFileTimestamp = System.currentTimeMillis();
changeState(State.RESTARTING);
final CompletableFuture<DaemonApi.RestartResult> future =
myDaemonApi.restartApp(myAppId, true, false, reason);
future.thenAccept(result -> changeState(State.STARTED));
future.thenRun(this::notifyAppRestarted);
return future;
}
private void notifyAppReloaded() {
listenersDispatcher.getMulticaster().notifyAppReloaded();
}
private void notifyAppRestarted() {
listenersDispatcher.getMulticaster().notifyAppRestarted();
}
public boolean isSameModule(@Nullable final Module other) {
return Objects.equals(myModule, other);
}
/**
* @return whether the latest of the version of the file is running.
*/
public boolean isLatestVersionRunning(VirtualFile file) {
return file != null && file.getTimeStamp() <= maxFileTimestamp;
}
/**
* Indicate that we are about the start hot reload for this app.
* <p>
* This state change is useful as we can delay the actual hot reload slightly, but still change the
* app state in order to prevent starting two simultaneous hot reloads.
* <p>
* Return the previous app state.
*/
public State transitionStartingHotReload() {
final State newState = State.RELOADING;
final State oldState = myState.getAndSet(newState);
if (oldState != newState) {
listenersDispatcher.getMulticaster().stateChanged(newState);
}
return oldState;
}
/**
* Cancel a hot reload state and restore the app's previous state (generally, `State.STARTED`).
*/
public void cancelHotReloadState(@Nullable State previousState) {
if (previousState != null) {
changeState(previousState);
}
}
/**
* Perform a hot reload of the app.
*/
public CompletableFuture<DaemonApi.RestartResult> performHotReload(boolean pauseAfterRestart, @NotNull String reason) {
if (myAppId == null) {
FlutterUtils.warn(LOG, "cannot reload Flutter app because app id is not set");
if (getState() == State.RELOADING) {
changeState(State.STARTED);
}
final CompletableFuture<DaemonApi.RestartResult> result = new CompletableFuture<>();
result.completeExceptionally(new IllegalStateException("cannot reload Flutter app because app id is not set"));
return result;
}
reloadCount++;
userReloadCount++;
LocalHistory.getInstance().putSystemLabel(getProject(), "hot reload #" + userReloadCount);
maxFileTimestamp = System.currentTimeMillis();
changeState(State.RELOADING);
final CompletableFuture<DaemonApi.RestartResult> future =
myDaemonApi.restartApp(myAppId, false, pauseAfterRestart, reason);
future.thenAccept(result -> changeState(State.STARTED));
future.thenRun(this::notifyAppReloaded);
return future;
}
public CompletableFuture<DaemonApi.DevToolsAddress> serveDevTools() {
return myDaemonApi.devToolsServe();
}
public CompletableFuture<String> togglePlatform() {
if (myAppId == null) {
FlutterUtils.warn(LOG, "cannot invoke togglePlatform on Flutter app because app id is not set");
return CompletableFuture.completedFuture(null);
}
final CompletableFuture<JsonObject> result = callServiceExtension(ServiceExtensions.togglePlatformMode.getExtension());
return result.thenApply(obj -> {
//noinspection CodeBlock2Expr
return obj.get("value").getAsString();
});
}
public CompletableFuture<String> togglePlatform(String platform) {
if (myAppId == null) {
FlutterUtils.warn(LOG, "cannot invoke togglePlatform on Flutter app because app id is not set");
return CompletableFuture.completedFuture(null);
}
final Map<String, Object> params = new HashMap<>();
params.put("value", platform);
return callServiceExtension(ServiceExtensions.togglePlatformMode.getExtension(), params).thenApply(obj -> {
//noinspection CodeBlock2Expr
return obj != null ? obj.get("value").getAsString() : null;
});
}
public CompletableFuture<JsonObject> callServiceExtension(String methodName) {
return callServiceExtension(methodName, new HashMap<>());
}
public CompletableFuture<JsonObject> callServiceExtension(String methodName, Map<String, Object> params) {
if (myAppId == null) {
FlutterUtils.warn(LOG, "cannot invoke " + methodName + " on Flutter app because app id is not set");
return CompletableFuture.completedFuture(null);
}
if (isFlutterIsolateSuspended()) {
return whenFlutterIsolateResumed().thenComposeAsync(
(ignored) -> myDaemonApi.callAppServiceExtension(myAppId, methodName, params)
);
}
else {
// TODO(devoncarew): Convert this to using the service protocol (instead of the daemon protocol).
return myDaemonApi.callAppServiceExtension(myAppId, methodName, params);
}
}
@SuppressWarnings("UnusedReturnValue")
public CompletableFuture<Boolean> callBooleanExtension(String methodName, boolean enabled) {
final Map<String, Object> params = new HashMap<>();
params.put("enabled", enabled);
return callServiceExtension(methodName, params).thenApply(obj -> {
//noinspection CodeBlock2Expr
return obj == null ? null : obj.get("enabled").getAsBoolean();
});
}
/**
* Call a boolean service extension only if it is already present, skipping otherwise.
* <p>
* Only use this method if you are confident there will not be a race condition where
* the service extension is registered shortly after this method is called.
*/
@SuppressWarnings("UnusedReturnValue")
public CompletableFuture<Boolean> maybeCallBooleanExtension(String methodName, boolean enabled) {
if (getVMServiceManager() != null && getVMServiceManager().hasServiceExtensionNow(methodName)) {
return callBooleanExtension(methodName, enabled);
}
return CompletableFuture.completedFuture(false);
}
@Nullable
public StreamSubscription<Boolean> hasServiceExtension(String name, Consumer<Boolean> onData) {
if (getVMServiceManager() == null) {
return null;
}
return getVMServiceManager().hasServiceExtension(name, onData);
}
public void hasServiceExtension(String name, Consumer<Boolean> onData, Disposable parentDisposable) {
if (getVMServiceManager() != null) {
getVMServiceManager().hasServiceExtension(name, onData, parentDisposable);
}
}
public void setConsole(@Nullable ConsoleView console) {
myConsole = console;
}
@Nullable
public ConsoleView getConsole() {
return myConsole;
}
/**
* Transitions to a new state and fires events.
* <p>
* If no change is needed, returns false and does not fire events.
*/
boolean changeState(@NotNull State newState) {
final State oldState = myState.getAndSet(newState);
if (oldState == newState) {
return false; // debounce
}
listenersDispatcher.getMulticaster().stateChanged(newState);
return true;
}
/**
* Starts shutting down the process.
* <p>
* If possible, we want to shut down gracefully by sending a stop command to the application.
*/
public Future shutdownAsync() {
final FutureTask done = new FutureTask<>(() -> null);
if (!changeState(State.TERMINATING)) {
done.run();
return done; // Debounce; already shutting down.
}
if (myResume != null) {
myResume.run();
}
final String appId = myAppId;
if (appId == null) {
// If it it didn't finish starting up, shut down abruptly.
myProcessHandler.destroyProcess();
done.run();
return done;
}
// Do the rest in the background to avoid freezing the Swing dispatch thread.
AppExecutorUtil.getAppExecutorService().submit(() -> {
// Try to shut down gracefully (need to wait for a response).
final Future stopDone;
if (DaemonEvent.AppStarting.LAUNCH_MODE_ATTACH.equals(myLaunchMode)) {
stopDone = myDaemonApi.detachApp(appId);
}
else {
stopDone = myDaemonApi.stopApp(appId);
}
final Stopwatch watch = Stopwatch.createStarted();
while (watch.elapsed(TimeUnit.SECONDS) < 10 && getState() == State.TERMINATING) {
try {
stopDone.get(100, TimeUnit.MILLISECONDS);
break;
}
catch (TimeoutException e) {
// continue
}
catch (Exception e) {
// Ignore errors from app.stop.
break;
}
}
// If it didn't work, shut down abruptly.
myProcessHandler.destroyProcess();
myDaemonApi.cancelPending();
done.run();
});
return done;
}
public void addStateListener(@NotNull FlutterAppListener listener) {
listenersDispatcher.addListener(listener);
listener.stateChanged(myState.get());
}
public void removeStateListener(@NotNull FlutterAppListener listener) {
listenersDispatcher.removeListener(listener);
}
public FlutterLaunchMode getLaunchMode() {
return FlutterLaunchMode.fromEnv(myExecutionEnvironment);
}
public boolean isSessionActive() {
final FlutterDebugProcess debugProcess = getFlutterDebugProcess();
return isStarted() && debugProcess != null && debugProcess.getVmConnected() &&
!debugProcess.getSession().isStopped();
}
@NotNull
public FlutterDevice device() {
return myDevice;
}
@Nullable
public String deviceId() {
return myDevice.deviceId();
}
public void setFlutterDebugProcess(FlutterDebugProcess flutterDebugProcess) {
myFlutterDebugProcess = flutterDebugProcess;
}
public FlutterDebugProcess getFlutterDebugProcess() {
return myFlutterDebugProcess;
}
public void setVmServices(@NotNull VmService vmService, VMServiceManager vmServiceManager) {
myVmService = vmService;
myVMServiceManager = vmServiceManager;
myVmService.addVmServiceListener(new VmServiceListenerAdapter() {
@Override
public void received(String streamId, Event event) {
if (StringUtil.equals(streamId, VmService.EXTENSION_STREAM_ID)) {
if (StringUtil.equals("Flutter.Frame", event.getExtensionKind())) {
listenersDispatcher.getMulticaster().notifyFrameRendered();
}
}
}
});
listenersDispatcher.getMulticaster().notifyVmServiceAvailable(vmService);
// Init the app's FlutterConsoleLogManager.
getFlutterConsoleLogManager();
}
@Nullable
public VmService getVmService() {
return myVmService;
}
@Nullable
public VMServiceManager getVMServiceManager() {
return myVMServiceManager;
}
@Nullable
public DisplayRefreshRateManager getDisplayRefreshRateManager() {
return myVMServiceManager != null ? myVMServiceManager.displayRefreshRateManager : null;
}
@NotNull
public Project getProject() {
return myProject;
}
@NotNull
public List<PubRoot> getPubRoots() {
if (myPubRoots == null) {
myPubRoots = PubRoots.forProject(myProject);
}
return myPubRoots;
}
@Nullable
public Module getModule() {
return myModule;
}
public FlutterConsoleLogManager getFlutterConsoleLogManager() {
if (myFlutterConsoleLogManager == null) {
assert (getConsole() != null);
myFlutterConsoleLogManager = new FlutterConsoleLogManager(getConsole(), this);
if (FlutterSettings.getInstance().isShowStructuredErrors()) {
// Calling this will override the default Flutter stdout error display.
hasServiceExtension(ServiceExtensions.toggleShowStructuredErrors.getExtension(), (present) -> {
if (present) {
callBooleanExtension(ServiceExtensions.toggleShowStructuredErrors.getExtension(), true);
}
});
}
}
return myFlutterConsoleLogManager;
}
@Override
public String toString() {
return myExecutionEnvironment + ":" + deviceId();
}
public boolean isFlutterIsolateSuspended() {
if (!isSessionActive() || myVMServiceManager.getCurrentFlutterIsolateRaw() == null) {
// The isolate cannot be suspended if it isn't running yet.
return false;
}
return getFlutterDebugProcess().isIsolateSuspended(myVMServiceManager.getCurrentFlutterIsolateRaw().getId());
}
private CompletableFuture<?> whenFlutterIsolateResumed() {
if (!isFlutterIsolateSuspended()) {
return CompletableFuture.completedFuture(null);
}
return getFlutterDebugProcess().whenIsolateResumed(myVMServiceManager.getCurrentFlutterIsolateRaw().getId());
}
public interface FlutterAppListener extends EventListener {
default void stateChanged(State newState) {
}
default void notifyAppReloaded() {
}
default void notifyAppRestarted() {
}
default void notifyFrameRendered() {
}
default void notifyVmServiceAvailable(VmService vmService) {
}
}
public enum State {STARTING, STARTED, RELOADING, RESTARTING, TERMINATING, TERMINATED}
@Override
public void dispose() {
}
}
/**
* Listens for events while running or debugging an app.
*/
class FlutterAppDaemonEventListener implements DaemonEvent.Listener {
private static final Logger LOG = Logger.getInstance(FlutterAppDaemonEventListener.class);
private final @NotNull FlutterApp app;
private final @NotNull ProgressHelper progress;
private final AtomicReference<Stopwatch> stopwatch = new AtomicReference<>();
FlutterAppDaemonEventListener(@NotNull FlutterApp app, @NotNull Project project) {
this.app = app;
this.progress = new ProgressHelper(project);
}
// process lifecycle
@Override
public void processWillTerminate() {
progress.cancel();
// Shutdown must be sync so that we prevent the processTerminated() event from being delivered
// until a graceful shutdown has been tried.
try {
app.shutdownAsync().get(100, TimeUnit.MILLISECONDS);
}
catch (TimeoutException e) {
LOG.info("app shutdown took longer than 100ms");
}
catch (Exception e) {
FlutterUtils.warn(LOG, "exception while shutting down Flutter App", e);
}
}
@Override
public void processTerminated(int exitCode) {
progress.cancel();
app.changeState(FlutterApp.State.TERMINATED);
}
// daemon domain
@Override
public void onDaemonLog(@NotNull DaemonEvent.DaemonLog message) {
final ConsoleView console = app.getConsole();
if (console == null) return;
if (message.log != null) {
console.print(message.log + "\n", message.error ? ConsoleViewContentType.ERROR_OUTPUT : ConsoleViewContentType.NORMAL_OUTPUT);
}
}
@Override
public void onDaemonLogMessage(@NotNull DaemonEvent.DaemonLogMessage message) {
LOG.info("flutter app: " + message.message);
}
// app domain
@Override
public void onAppStarting(DaemonEvent.AppStarting event) {
app.setAppId(event.appId);
app.setLaunchMode(event.launchMode);
}
@Override
public void onAppDebugPort(@NotNull DaemonEvent.AppDebugPort debugInfo) {
app.setWsUrl(debugInfo.wsUri);
// Print the conneciton info to the console.
final ConsoleView console = app.getConsole();
if (console != null) {
console.print("Debug service listening on " + debugInfo.wsUri + "\n", ConsoleViewContentType.NORMAL_OUTPUT);
}
String uri = debugInfo.baseUri;
if (uri != null) {
if (uri.startsWith("file:")) {
// Convert the file: url to a path.
try {
uri = new URL(uri).getPath();
if (uri.endsWith(File.separator)) {
uri = uri.substring(0, uri.length() - 1);
}
}
catch (MalformedURLException e) {
// ignore
}
}
app.setBaseUri(uri);
}
}
@Override
public void onAppStarted(DaemonEvent.AppStarted started) {
app.changeState(FlutterApp.State.STARTED);
}
@Override
public void onAppLog(@NotNull DaemonEvent.AppLog message) {
final ConsoleView console = app.getConsole();
if (console == null) return;
console.print(message.log + "\n", message.error ? ConsoleViewContentType.ERROR_OUTPUT : ConsoleViewContentType.NORMAL_OUTPUT);
}
@Override
public void onAppProgressStarting(@NotNull DaemonEvent.AppProgress event) {
progress.start(event.message);
if (event.getType().startsWith("hot.")) {
// We clear the console view in order to help indicate that a reload is happening.
if (app.getConsole() != null) {
if (!FlutterSettings.getInstance().isVerboseLogging() && !FlutterSettings.getInstance().isPerserveLogsDuringHotReloadAndRestart()) {
app.getConsole().clear();
}
}
stopwatch.set(Stopwatch.createStarted());
}
if (app.getConsole() != null) {
app.getConsole().print(event.message + "\n", ConsoleViewContentType.NORMAL_OUTPUT);
}
}
@Override
public void onAppProgressFinished(@NotNull DaemonEvent.AppProgress event) {
progress.done();
final Stopwatch watch = stopwatch.getAndSet(null);
if (watch != null) {
watch.stop();
switch (event.getType()) {
case "hot.reload":
reportElapsed(watch, "Reloaded", "reload");
break;
case "hot.restart":
reportElapsed(watch, "Restarted", "restart");
break;
}
}
}
private void reportElapsed(@NotNull Stopwatch watch, String verb, String analyticsName) {
final long elapsedMs = watch.elapsed(TimeUnit.MILLISECONDS);
FlutterInitializer.getAnalytics().sendTiming("run", analyticsName, elapsedMs);
}
@Override
public void onAppStopped(@NotNull DaemonEvent.AppStopped stopped) {
if (stopped.error != null && app.getConsole() != null) {
app.getConsole().print("Finished with error: " + stopped.error + "\n", ConsoleViewContentType.ERROR_OUTPUT);
}
progress.cancel();
app.getProcessHandler().destroyProcess();
}
}
| flutter-intellij/flutter-idea/src/io/flutter/run/daemon/FlutterApp.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/run/daemon/FlutterApp.java",
"repo_id": "flutter-intellij",
"token_count": 10900
} | 610 |
/*
* Copyright 2019 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.samples;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.jetbrains.lang.dart.psi.DartComponent;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class DartDocumentUtils {
private DartDocumentUtils() {
}
/**
* Given a document and a Dart PSI element, return the dartdoc text, if any, associated with the Dart
* symbol definition.
* <p>
* If no dartdoc is found, an empty list is returned.
*/
@NotNull
public static List<String> getDartdocFor(@NotNull Document document, @NotNull DartComponent component) {
final List<String> lines = new ArrayList<>();
final int startLine = document.getLineNumber(component.getTextOffset());
int line = startLine - 1;
// Look for any lines between the dartdoc comment and the class declaration.
while (line >= 0) {
final String text = StringUtil.trimLeading(getLine(document, line));
// blank lines and annotations are ok
if (text.isEmpty() || text.startsWith("@")) {
line--;
continue;
}
// dartdoc comments move us to the next state
if (text.startsWith("///")) {
lines.add(text);
line--;
break;
}
// anything else means we didn't find a dartdoc comment
return lines;
}
// Collect all of the dartdoc line comments.
while (line >= 0) {
final String text = StringUtil.trimLeading(getLine(document, line));
if (text.startsWith("///")) {
lines.add(0, text);
line--;
continue;
}
// anything else means we end the dartdoc comment
break;
}
return lines;
}
private static String getLine(Document document, int line) {
return document.getText(new TextRange(document.getLineStartOffset(line - 1), document.getLineEndOffset(line - 1)));
}
}
| flutter-intellij/flutter-idea/src/io/flutter/samples/DartDocumentUtils.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/samples/DartDocumentUtils.java",
"repo_id": "flutter-intellij",
"token_count": 762
} | 611 |
/*
* Copyright 2016 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.sdk;
import com.google.common.annotations.VisibleForTesting;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.intellij.execution.ExecutionException;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Url;
import com.intellij.util.Urls;
import com.jetbrains.lang.dart.sdk.DartSdkUpdateOption;
import io.flutter.FlutterBundle;
import io.flutter.dart.DartPlugin;
import io.flutter.pub.PubRoot;
import io.flutter.pub.PubRoots;
import io.flutter.utils.FlutterModuleUtils;
import io.flutter.utils.JsonUtils;
import io.flutter.utils.SystemUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
public class FlutterSdkUtil {
/**
* The environment variable to use to tell the flutter tool which app is driving it.
*/
public static final String FLUTTER_HOST_ENV = "FLUTTER_HOST";
private static final String FLUTTER_SDK_KNOWN_PATHS = "FLUTTER_SDK_KNOWN_PATHS";
private static final Logger LOG = Logger.getInstance(FlutterSdkUtil.class);
private static final String FLUTTER_SNAP_SDK_PATH = "/snap/flutter/common/flutter";
public FlutterSdkUtil() {
}
/**
* Return the environment variable value to use when shelling out to the Flutter command-line tool.
*/
public String getFlutterHostEnvValue() {
final String clientId = ApplicationNamesInfo.getInstance().getFullProductName().replaceAll(" ", "-");
final String existingVar = java.lang.System.getenv(FLUTTER_HOST_ENV);
return existingVar == null ? clientId : (existingVar + ":" + clientId);
}
public static void updateKnownSdkPaths(@NotNull final String newSdkPath) {
updateKnownPaths(FLUTTER_SDK_KNOWN_PATHS, newSdkPath);
}
private static void updateKnownPaths(@SuppressWarnings("SameParameterValue") @NotNull final String propertyKey,
@NotNull final String newPath) {
final Set<String> allPaths = new LinkedHashSet<>();
// Add the new value first; this ensures that it's the 'default' flutter sdk.
allPaths.add(newPath);
final PropertiesComponent props = PropertiesComponent.getInstance();
// Add the existing known paths.
final String[] oldPaths = props.getValues(propertyKey);
if (oldPaths != null) {
allPaths.addAll(Arrays.asList(oldPaths));
}
// Store the values back.
if (allPaths.isEmpty()) {
props.unsetValue(propertyKey);
}
else {
props.setValues(propertyKey, ArrayUtil.toStringArray(allPaths));
}
}
/**
* Adds the current path and other known paths to the combo, most recently used first.
*/
public static void addKnownSDKPathsToCombo(@NotNull JComboBox combo) {
final Set<String> pathsToShow = new LinkedHashSet<>();
final String currentPath = combo.getEditor().getItem().toString().trim();
if (!currentPath.isEmpty()) {
pathsToShow.add(currentPath);
}
final String[] knownPaths = getKnownFlutterSdkPaths();
for (String path : knownPaths) {
if (FlutterSdk.forPath(path) != null) {
pathsToShow.add(FileUtil.toSystemDependentName(path));
}
}
//noinspection unchecked
combo.setModel(new DefaultComboBoxModel(ArrayUtil.toStringArray(pathsToShow)));
if (combo.getSelectedIndex() == -1 && combo.getItemCount() > 0) {
combo.setSelectedIndex(0);
}
}
@NotNull
public static String[] getKnownFlutterSdkPaths() {
final Set<String> paths = new HashSet<>();
// scan current projects for existing flutter sdk settings
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
final FlutterSdk flutterSdk = FlutterSdk.getFlutterSdk(project);
if (flutterSdk != null) {
paths.add(flutterSdk.getHomePath());
}
}
// use the list of paths they've entered in the past
final String[] knownPaths = PropertiesComponent.getInstance().getValues(FLUTTER_SDK_KNOWN_PATHS);
if (knownPaths != null) {
paths.addAll(Arrays.asList(knownPaths));
}
// search the user's path
final String fromUserPath = locateSdkFromPath();
if (fromUserPath != null) {
paths.add(fromUserPath);
}
// Add the snap SDK path if it exists; note that this path is standard on all Linux platforms.
final File snapSdkPath = new File(System.getenv("HOME") + FLUTTER_SNAP_SDK_PATH);
if (snapSdkPath.exists()) {
paths.add(snapSdkPath.getAbsolutePath());
}
return paths.toArray(new String[0]);
}
@NotNull
public static String pathToFlutterTool(@NotNull String sdkPath) throws ExecutionException {
final String path = findDescendant(sdkPath, "/bin/" + flutterScriptName());
if (path == null) {
throw new ExecutionException("Flutter SDK is not configured");
}
return path;
}
@NotNull
public static String flutterScriptName() {
return SystemInfo.isWindows ? "flutter.bat" : "flutter";
}
/**
* Returns the path to the Dart SDK within a Flutter SDK, or null if it doesn't exist.
*/
@Nullable
public static String pathToDartSdk(@NotNull String flutterSdkPath) {
return findDescendant(flutterSdkPath, "/bin/cache/dart-sdk");
}
@Nullable
private static String findDescendant(@NotNull String flutterSdkPath, @NotNull String path) {
final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByPath(flutterSdkPath + path);
if (file == null || !file.exists()) {
return null;
}
return file.getPath();
}
public static boolean isFlutterSdkHome(@NotNull final String path) {
final File flutterPubspecFile = new File(path + "/packages/flutter/pubspec.yaml");
final File flutterToolFile = new File(path + "/bin/flutter");
final File dartLibFolder = new File(path + "/bin/cache/dart-sdk/lib");
return flutterPubspecFile.isFile() && flutterToolFile.isFile() && dartLibFolder.isDirectory();
}
private static boolean isFlutterSdkHomeWithoutDartSdk(@NotNull final String path) {
final File flutterPubspecFile = new File(path + "/packages/flutter/pubspec.yaml");
final File flutterToolFile = new File(path + "/bin/flutter");
final File dartLibFolder = new File(path + "/bin/cache/dart-sdk/lib");
return flutterPubspecFile.isFile() && flutterToolFile.isFile() && !dartLibFolder.isDirectory();
}
/**
* Checks the workspace for any open Flutter projects.
*
* @return true if an open Flutter project is found
*/
public static boolean hasFlutterModules() {
return Arrays.stream(ProjectManager.getInstance().getOpenProjects()).anyMatch(FlutterModuleUtils::hasFlutterModule);
}
public static boolean hasFlutterModules(@NotNull Project project) {
return FlutterModuleUtils.hasFlutterModule(project);
}
@Nullable
public static String getErrorMessageIfWrongSdkRootPath(final @NotNull String sdkRootPath) {
if (sdkRootPath.isEmpty()) {
return null;
}
final File sdkRoot = new File(sdkRootPath);
if (!sdkRoot.isDirectory()) return FlutterBundle.message("error.folder.specified.as.sdk.not.exists");
if (isFlutterSdkHomeWithoutDartSdk(sdkRootPath)) return FlutterBundle.message("error.flutter.sdk.without.dart.sdk");
if (!isFlutterSdkHome(sdkRootPath)) return FlutterBundle.message("error.sdk.not.found.in.specified.location");
return null;
}
public static void setFlutterSdkPath(@NotNull final Project project, @NotNull final String flutterSdkPath) {
// In reality this method sets Dart SDK (that is inside the Flutter SDK).
final String dartSdk = flutterSdkPath + "/bin/cache/dart-sdk";
ApplicationManager.getApplication().runWriteAction(() -> DartPlugin.ensureDartSdkConfigured(project, dartSdk));
// Checking for updates doesn't make sense since the channels don't correspond to Flutter...
DartSdkUpdateOption.setDartSdkUpdateOption(DartSdkUpdateOption.DoNotCheck);
// Update the list of known sdk paths.
FlutterSdkUtil.updateKnownSdkPaths(flutterSdkPath);
// Fire events for a Flutter SDK change, which updates the UI.
FlutterSdkManager.getInstance(project).checkForFlutterSdkChange();
}
// TODO(devoncarew): The Dart plugin supports specifying individual modules in the settings page.
/**
* Enable Dart support for the given project.
*/
public static void enableDartSdk(@NotNull final Project project) {
//noinspection ConstantConditions
for (Module module : ModuleManager.getInstance(project).getModules()) {
if (module != null && !PubRoots.forModule(module).isEmpty()) {
DartPlugin.enableDartSdk(module);
}
}
}
/**
* Parse packages meta-data file and infer the location of the Flutter SDK from that.
*/
@Nullable
public static String guessFlutterSdkFromPackagesFile(@NotNull Module module) {
// First, look for .dart_tool/package_config.json
final JsonArray packages = getPackagesFromPackageConfig(PubRoots.forModule(module));
for (int i = 0; i < packages.size(); i++) {
final JsonObject pack = packages.get(i).getAsJsonObject();
if ("flutter".equals(JsonUtils.getStringMember(pack, "name"))) {
final String uri = JsonUtils.getStringMember(pack, "rootUri");
if (uri == null) {
continue;
}
final String path = extractSdkPathFromUri(uri, false);
if (path == null) {
continue;
}
return path;
}
}
// Next, try the obsolete .packages
for (PubRoot pubRoot : PubRoots.forModule(module)) {
final VirtualFile packagesFile = pubRoot.getPackagesFile();
if (packagesFile == null) {
continue;
}
// parse it
try {
final String contents = new String(packagesFile.contentsToByteArray(true /* cache contents */));
return parseFlutterSdkPath(contents);
}
catch (IOException ignored) {
}
}
return null;
}
@Nullable
public static String getPathToCupertinoIconsPackage(@NotNull Project project) {
//noinspection ConstantConditions
if (ApplicationManager.getApplication().isUnitTestMode()) {
// TODO(messick): Configure the test framework to have proper pub data so we don't need this.
return "testData/sdk";
}
final JsonArray packages = getPackagesFromPackageConfig(PubRoots.forProject(project));
for (int i = 0; i < packages.size(); i++) {
final JsonObject pack = packages.get(i).getAsJsonObject();
if ("cupertino_icons".equals(JsonUtils.getStringMember(pack, "name"))) {
final String uri = JsonUtils.getStringMember(pack, "rootUri");
if (uri == null) {
continue;
}
try {
return new URI(uri).getPath();
}
catch (URISyntaxException ignored) {
}
}
}
return null;
}
private static JsonArray getPackagesFromPackageConfig(@NotNull List<PubRoot> pubRoots) {
final JsonArray entries = new JsonArray();
for (PubRoot pubRoot : pubRoots) {
final VirtualFile configFile = pubRoot.getPackageConfigFile();
if (configFile == null) {
continue;
}
// parse it
try {
final String contents = new String(configFile.contentsToByteArray(true /* cache contents */));
final JsonElement element = new JsonParser().parse(contents);
if (element == null) {
continue;
}
final JsonObject json = element.getAsJsonObject();
if (JsonUtils.getIntMember(json, "configVersion") < 2) continue;
final JsonArray packages = json.getAsJsonArray("packages");
if (packages == null || packages.isEmpty()) {
continue;
}
entries.addAll(packages);
}
catch (IOException ignored) {
}
}
return entries;
}
@VisibleForTesting
public static String parseFlutterSdkPath(String packagesFileContent) {
for (String line : packagesFileContent.split("\n")) {
// flutter:file:///Users/.../flutter/packages/flutter/lib/
line = line.trim();
if (line.isEmpty() || line.startsWith("#")) {
continue;
}
final String flutterPrefix = "flutter:";
if (line.startsWith(flutterPrefix)) {
final String urlString = line.substring(flutterPrefix.length());
final String path = extractSdkPathFromUri(urlString, true);
if (path == null) {
continue;
}
return path;
}
}
return null;
}
private static String extractSdkPathFromUri(String urlString, boolean isLibIncluded) {
if (urlString.startsWith("file:")) {
final Url url = Urls.parseEncoded(urlString);
if (url == null) {
return null;
}
final String path = url.getPath();
// go up three levels for .packages or two for .dart_tool/package_config.json
File file = new File(url.getPath());
file = file.getParentFile().getParentFile();
if (isLibIncluded) {
file = file.getParentFile();
}
return file.getPath();
}
return null;
}
/**
* Locate the Flutter SDK using the user's PATH.
*/
@Nullable
public static String locateSdkFromPath() {
final String flutterBinPath = SystemUtils.which("flutter");
if (flutterBinPath == null) {
return null;
}
final File flutterBinFile = new File(flutterBinPath);
return flutterBinFile.getParentFile().getParentFile().getPath();
}
}
| flutter-intellij/flutter-idea/src/io/flutter/sdk/FlutterSdkUtil.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/sdk/FlutterSdkUtil.java",
"repo_id": "flutter-intellij",
"token_count": 5222
} | 612 |
/*
* Copyright 2018 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.utils;
import com.intellij.icons.AllIcons;
import icons.FlutterIcons;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
/**
* @author Sergey.Malenkov
*/
public class AnimatedIcon implements Icon {
public interface Frame {
@NotNull
Icon getIcon();
int getDelay();
}
public static final class Default extends AnimatedIcon {
public Default() {
super(100,
AllIcons.Process.Step_1,
AllIcons.Process.Step_2,
AllIcons.Process.Step_3,
AllIcons.Process.Step_4,
AllIcons.Process.Step_5,
AllIcons.Process.Step_6,
AllIcons.Process.Step_7,
AllIcons.Process.Step_8);
}
}
public static final class Big extends AnimatedIcon {
public Big() {
super(100,
AllIcons.Process.Big.Step_1,
AllIcons.Process.Big.Step_2,
AllIcons.Process.Big.Step_3,
AllIcons.Process.Big.Step_4,
AllIcons.Process.Big.Step_5,
AllIcons.Process.Big.Step_6,
AllIcons.Process.Big.Step_7,
AllIcons.Process.Big.Step_8);
}
}
public static final class Grey extends AnimatedIcon {
public Grey() {
super(150,
FlutterIcons.State.GreyProgr_1,
FlutterIcons.State.GreyProgr_2,
FlutterIcons.State.GreyProgr_3,
FlutterIcons.State.GreyProgr_4,
FlutterIcons.State.GreyProgr_5,
FlutterIcons.State.GreyProgr_6,
FlutterIcons.State.GreyProgr_7,
FlutterIcons.State.GreyProgr_8);
}
}
public static final class FS extends AnimatedIcon {
public FS() {
super(50,
AllIcons.Process.FS.Step_1,
AllIcons.Process.FS.Step_2,
AllIcons.Process.FS.Step_3,
AllIcons.Process.FS.Step_4,
AllIcons.Process.FS.Step_5,
AllIcons.Process.FS.Step_6,
AllIcons.Process.FS.Step_7,
AllIcons.Process.FS.Step_8,
AllIcons.Process.FS.Step_9,
AllIcons.Process.FS.Step_10,
AllIcons.Process.FS.Step_11,
AllIcons.Process.FS.Step_12,
AllIcons.Process.FS.Step_13,
AllIcons.Process.FS.Step_14,
AllIcons.Process.FS.Step_15,
AllIcons.Process.FS.Step_16,
AllIcons.Process.FS.Step_17,
AllIcons.Process.FS.Step_18);
}
}
private final Frame[] frames;
private boolean requested;
private long time;
private int index;
private Frame frame;
public AnimatedIcon(int delay, @NotNull Icon... icons) {
this(getFrames(delay, icons));
}
public AnimatedIcon(@NotNull Frame... frames) {
this.frames = frames;
assert frames.length > 0 : "empty array";
for (Frame frame : frames) assert frame != null : "null animation frame";
updateFrameAt(java.lang.System.currentTimeMillis());
}
private static Frame[] getFrames(int delay, @NotNull Icon... icons) {
final int length = icons.length;
assert length > 0 : "empty array";
final Frame[] frames = new Frame[length];
for (int i = 0; i < length; i++) {
final Icon icon = icons[i];
assert icon != null : "null icon";
frames[i] = new Frame() {
@NotNull
@Override
public Icon getIcon() {
return icon;
}
@Override
public int getDelay() {
return delay;
}
};
}
return frames;
}
private void updateFrameAt(long current) {
if (frames.length <= index) index = 0;
frame = frames[index++];
time = current;
}
private Icon getUpdatedIcon() {
final long current = java.lang.System.currentTimeMillis();
if (frame.getDelay() <= (current - time)) updateFrameAt(current);
return frame.getIcon();
}
@Override
public final void paintIcon(Component c, Graphics g, int x, int y) {
final Icon icon = getUpdatedIcon();
if (!requested && canRefresh(c)) {
final int delay = frame.getDelay();
if (delay > 0) {
requested = true;
final Timer timer = new Timer(delay, event -> {
requested = false;
if (canRefresh(c)) {
doRefresh(c);
}
});
timer.setRepeats(false);
timer.start();
}
else {
doRefresh(c);
}
}
icon.paintIcon(c, g, x, y);
}
@Override
public final int getIconWidth() {
return getUpdatedIcon().getIconWidth();
}
@Override
public final int getIconHeight() {
return getUpdatedIcon().getIconHeight();
}
protected boolean canRefresh(Component component) {
return component != null && component.isShowing();
}
protected void doRefresh(Component component) {
if (component != null) component.repaint();
}
}
| flutter-intellij/flutter-idea/src/io/flutter/utils/AnimatedIcon.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/utils/AnimatedIcon.java",
"repo_id": "flutter-intellij",
"token_count": 2222
} | 613 |
/*
* Copyright 2019 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.utils;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.process.BaseOSProcessHandler;
import com.intellij.execution.process.ColoredProcessHandler;
import com.intellij.execution.process.UnixProcessManager;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.util.io.BaseOutputReader;
import io.flutter.FlutterInitializer;
import org.jetbrains.annotations.NotNull;
import java.util.function.Consumer;
/**
* An {@link ColoredProcessHandler} that uses {@code BaseOutputReader.Options.forMostlySilentProcess}
* in order to reduce cpu usage of the process it runs.
*
* <p>
* This works by defaulting to a non-blocking process polling mode instead of a blocking mode.
* The default can be overriden by setting the following registry flags:
* <ul>
* <li> "output.reader.blocking.mode.for.mostly.silent.processes" = false
* <li> "output.reader.blocking.mode" = true
* </ul>
*
* <p>
* Note that long-running processes that don't use these options may log a warning in message
* in the IntelliJ log. See {@link BaseOSProcessHandler}'s {@code SimpleOutputReader.beforeSleeping}
* for more information.
*/
public class MostlySilentColoredProcessHandler extends ColoredProcessHandler {
private GeneralCommandLine commandLine;
private Consumer<String> onTextAvailable;
public MostlySilentColoredProcessHandler(@NotNull GeneralCommandLine commandLine)
throws ExecutionException {
this(commandLine, null);
}
public MostlySilentColoredProcessHandler(@NotNull GeneralCommandLine commandLine, Consumer<String> onTextAvailable)
throws ExecutionException {
super(commandLine);
this.commandLine = commandLine;
this.onTextAvailable = onTextAvailable;
}
@NotNull
@Override
protected BaseOutputReader.Options readerOptions() {
return BaseOutputReader.Options.forMostlySilentProcess();
}
@Override
protected void doDestroyProcess() {
final Process process = getProcess();
if (SystemInfo.isUnix && shouldDestroyProcessRecursively() && processCanBeKilledByOS(process)) {
final boolean result = UnixProcessManager.sendSigIntToProcessTree(process);
if (!result) {
FlutterInitializer.getAnalytics().sendEvent("process", "process kill failed");
super.doDestroyProcess();
}
}
else {
super.doDestroyProcess();
}
}
@Override
public void coloredTextAvailable(@NotNull String text, @NotNull Key outputType) {
super.coloredTextAvailable(text, outputType);
if (onTextAvailable != null) {
onTextAvailable.accept(text);
}
}
}
| flutter-intellij/flutter-idea/src/io/flutter/utils/MostlySilentColoredProcessHandler.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/utils/MostlySilentColoredProcessHandler.java",
"repo_id": "flutter-intellij",
"token_count": 886
} | 614 |
/*
* Copyright 2018 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.utils.animation;
/**
* A curve that is 0.0 until it hits the threshold, then it jumps to 1.0.
* <p>
* https://flutter.github.io/assets-for-api-docs/animation/curve_threshold.png
*/
public class Threshold extends Curve {
/// Creates a threshold curve.
public Threshold(double threshold) {
this.threshold = threshold;
}
/// The value before which the curve is 0.0 and after which the curve is 1.0.
///
/// When t is exactly [threshold], the curve has the value 1.0.
final double threshold;
@Override
public double transform(double t) {
assert (t >= 0.0 && t <= 1.0);
assert (threshold >= 0.0);
assert (threshold <= 1.0);
if (t == 0.0 || t == 1.0) {
return t;
}
return t < threshold ? 0.0 : 1.0;
}
}
| flutter-intellij/flutter-idea/src/io/flutter/utils/animation/Threshold.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/utils/animation/Threshold.java",
"repo_id": "flutter-intellij",
"token_count": 325
} | 615 |
/*
* Copyright 2017 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.view;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.openapi.wm.ToolWindowManager;
import io.flutter.utils.ViewListener;
import org.jetbrains.annotations.NotNull;
public class FlutterViewFactory implements ToolWindowFactory, DumbAware {
private static final String TOOL_WINDOW_VISIBLE_PROPERTY = "flutter.view.tool.window.visible";
public static void init(@NotNull Project project) {
project.getMessageBus().connect().subscribe(
FlutterViewMessages.FLUTTER_DEBUG_TOPIC, (event) -> initFlutterView(project, event)
);
final ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(FlutterView.TOOL_WINDOW_ID);
if (window != null) {
window.setAvailable(true);
if (PropertiesComponent.getInstance(project).getBoolean(TOOL_WINDOW_VISIBLE_PROPERTY, false)) {
window.activate(null, false);
}
}
}
@Override
public boolean shouldBeAvailable(@NotNull Project project) {
return false;
}
private static void initFlutterView(@NotNull Project project, FlutterViewMessages.FlutterDebugEvent event) {
ApplicationManager.getApplication().invokeLater(() -> {
final FlutterView flutterView = project.getService(FlutterView.class);
flutterView.debugActive(event);
});
}
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
//noinspection CodeBlock2Expr
DumbService.getInstance(project).runWhenSmart(() -> {
project.getService(FlutterView.class).initToolWindow(toolWindow);
});
}
public static class FlutterViewListener extends ViewListener {
public FlutterViewListener(@NotNull Project project) {
super(project, FlutterView.TOOL_WINDOW_ID, TOOL_WINDOW_VISIBLE_PROPERTY);
}
}
}
| flutter-intellij/flutter-idea/src/io/flutter/view/FlutterViewFactory.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/view/FlutterViewFactory.java",
"repo_id": "flutter-intellij",
"token_count": 744
} | 616 |
/*
* Copyright 2018 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.view;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.Toggleable;
import com.intellij.openapi.diagnostic.Logger;
import io.flutter.run.daemon.FlutterApp;
import io.flutter.utils.StreamSubscription;
import io.flutter.vmService.ServiceExtensionDescription;
import io.flutter.vmService.ServiceExtensionState;
import io.flutter.vmService.ServiceExtensions;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
class TogglePlatformAction extends ToolbarComboBoxAction {
private static final Logger LOG = Logger.getInstance(TogglePlatformAction.class);
private static final ServiceExtensionDescription<String> extensionDescription = ServiceExtensions.togglePlatformMode;
private final @NotNull FlutterApp app;
private final @NotNull AppState appState;
private final DefaultActionGroup myActionGroup;
private final FlutterViewAction fuchsiaAction;
private PlatformTarget selectedPlatform;
public TogglePlatformAction(@NotNull FlutterApp app, @NotNull AppState appState) {
super();
this.app = app;
this.appState = appState;
setSmallVariant(false);
myActionGroup = createPopupActionGroup(app, appState);
fuchsiaAction = new PlatformTargetAction(app, PlatformTarget.fuchsia);
}
@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
return myActionGroup;
}
@Override
public final void update(@NotNull AnActionEvent e) {
if (app.getVMServiceManager() != null) {
app.getVMServiceManager().getServiceExtensionState(extensionDescription.getExtension()).listen((state) -> {
selectedPlatform = PlatformTarget.parseValue((String)state.getValue());
}, true);
}
String selectorText = "Platform:";
if (selectedPlatform != null && selectedPlatform != PlatformTarget.unknown) {
if (selectedPlatform == PlatformTarget.fuchsia && !appState.flutterViewActions.contains(fuchsiaAction)) {
myActionGroup.add(appState.registerAction(fuchsiaAction));
}
final int platformIndex = extensionDescription.getValues().indexOf(selectedPlatform.name());
if (platformIndex == -1) {
selectorText = "Platform: Unknown";
LOG.info("Unknown platform: " + selectedPlatform.name());
}
else {
selectorText = extensionDescription.getTooltips().get(platformIndex);
}
}
e.getPresentation().setText(selectorText);
e.getPresentation().setDescription(extensionDescription.getDescription());
e.getPresentation().setEnabled(app.isSessionActive());
}
private static DefaultActionGroup createPopupActionGroup(FlutterApp app, AppState appState) {
final DefaultActionGroup group = new DefaultActionGroup();
group.add(appState.registerAction(new PlatformTargetAction(app, PlatformTarget.android)));
group.add(appState.registerAction(new PlatformTargetAction(app, PlatformTarget.iOS)));
return group;
}
}
class PlatformTargetAction extends FlutterViewAction implements Toggleable, Disposable {
private static final ServiceExtensionDescription<String> extensionDescription = ServiceExtensions.togglePlatformMode;
private final PlatformTarget platformTarget;
private StreamSubscription<ServiceExtensionState> currentValueSubscription;
private boolean selected = false;
PlatformTargetAction(@NotNull FlutterApp app, PlatformTarget platformTarget) {
super(app,
platformTarget.toString(),
extensionDescription.getDescription(),
null);
this.platformTarget = platformTarget;
}
@Override
@SuppressWarnings("Duplicates")
public void update(@NotNull AnActionEvent e) {
if (!app.isSessionActive()) {
e.getPresentation().setEnabled(false);
return;
}
app.hasServiceExtension(extensionDescription.getExtension(), (enabled) -> {
e.getPresentation().setEnabled(app.isSessionActive() && enabled);
});
e.getPresentation().putClientProperty(SELECTED_PROPERTY, selected);
if (currentValueSubscription == null) {
currentValueSubscription =
app.getVMServiceManager().getServiceExtensionState(extensionDescription.getExtension()).listen((state) -> {
this.setSelected(e, state);
}, true);
}
}
@Override
public void dispose() {
if (currentValueSubscription != null) {
currentValueSubscription.dispose();
currentValueSubscription = null;
}
}
@Override
public void perform(AnActionEvent event) {
if (app.isSessionActive()) {
app.togglePlatform(platformTarget.name());
if (app.getVMServiceManager() != null) {
app.getVMServiceManager().setServiceExtensionState(
extensionDescription.getExtension(),
true,
platformTarget.name());
}
}
}
public void setSelected(@NotNull AnActionEvent event, ServiceExtensionState state) {
@Nullable final Object value = state.getValue();
final boolean selected = value != null && value.equals(platformTarget.name());
this.selected = selected;
event.getPresentation().putClientProperty(SELECTED_PROPERTY, selected);
}
}
enum PlatformTarget {
iOS,
android {
public String toString() {
return "Android";
}
},
fuchsia {
public String toString() {
return "Fuchsia";
}
},
unknown;
public static PlatformTarget parseValue(@Nullable String value) {
if (value == null) {
return unknown;
}
try {
return valueOf(value);
}
catch (NullPointerException | IllegalArgumentException e) {
// Default to {@link unknown} in the event that {@link value} is null or if
// there is not a {@link PlatformTarget} value with the name {@link value}.
return unknown;
}
}
}
| flutter-intellij/flutter-idea/src/io/flutter/view/TogglePlatformAction.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/view/TogglePlatformAction.java",
"repo_id": "flutter-intellij",
"token_count": 1980
} | 617 |
package io.flutter.vmService;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.net.PercentEscaper;
import com.google.gson.JsonObject;
import com.intellij.execution.ui.ConsoleViewContentType;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.Version;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Alarm;
import com.intellij.util.concurrency.Semaphore;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.XSourcePosition;
import com.intellij.xdebugger.breakpoints.XBreakpointProperties;
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
import com.intellij.xdebugger.frame.XExecutionStack;
import com.intellij.xdebugger.frame.XStackFrame;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
import com.jetbrains.lang.dart.DartFileType;
import io.flutter.FlutterInitializer;
import io.flutter.analytics.Analytics;
import io.flutter.bazel.WorkspaceCache;
import io.flutter.run.daemon.FlutterApp;
import io.flutter.sdk.FlutterSdk;
import io.flutter.vmService.frame.DartAsyncMarkerFrame;
import io.flutter.vmService.frame.DartVmServiceEvaluator;
import io.flutter.vmService.frame.DartVmServiceStackFrame;
import io.flutter.vmService.frame.DartVmServiceValue;
import org.dartlang.vm.service.VmService;
import org.dartlang.vm.service.consumer.*;
import org.dartlang.vm.service.element.Stack;
import org.dartlang.vm.service.element.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class VmServiceWrapper implements Disposable {
@NotNull private static final Logger LOG = Logger.getInstance(VmServiceWrapper.class.getName());
private static final long RESPONSE_WAIT_TIMEOUT = 3000; // millis
@NotNull private final DartVmServiceDebugProcess myDebugProcess;
@NotNull private final VmService myVmService;
@NotNull private final DartVmServiceListener myVmServiceListener;
@NotNull private final IsolatesInfo myIsolatesInfo;
@NotNull private final DartVmServiceBreakpointHandler myBreakpointHandler;
@NotNull private final Alarm myRequestsScheduler;
@NotNull private final Map<Integer, CanonicalBreakpoint> breakpointNumbersToCanonicalMap;
@NotNull private final Set<CanonicalBreakpoint> canonicalBreakpoints;
private long myVmServiceReceiverThreadId;
@Nullable private StepOption myLatestStep;
public VmServiceWrapper(@NotNull DartVmServiceDebugProcess debugProcess,
@NotNull VmService vmService,
@NotNull DartVmServiceListener vmServiceListener,
@NotNull IsolatesInfo isolatesInfo,
@NotNull DartVmServiceBreakpointHandler breakpointHandler) {
myDebugProcess = debugProcess;
myVmService = vmService;
myVmServiceListener = vmServiceListener;
myIsolatesInfo = isolatesInfo;
myBreakpointHandler = breakpointHandler;
myRequestsScheduler = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, this);
breakpointNumbersToCanonicalMap = new HashMap<>();
canonicalBreakpoints = new HashSet<>();
}
@NotNull
public VmService getVmService() {
return myVmService;
}
@Override
public void dispose() {
}
private void addRequest(@NotNull Runnable runnable) {
if (!myRequestsScheduler.isDisposed()) {
myRequestsScheduler.addRequest(runnable, 0);
}
}
@NotNull
public List<IsolateRef> getExistingIsolates() {
List<IsolateRef> isolateRefs = new ArrayList<>();
for (IsolatesInfo.IsolateInfo isolateInfo : myIsolatesInfo.getIsolateInfos()) {
isolateRefs.add(isolateInfo.getIsolateRef());
}
return isolateRefs;
}
@Nullable
public StepOption getLatestStep() {
return myLatestStep;
}
private void assertSyncRequestAllowed() {
if (ApplicationManager.getApplication().isDispatchThread()) {
LOG.error("EDT should not be blocked by waiting for for the answer from the Dart debugger");
}
if (ApplicationManager.getApplication().isReadAccessAllowed()) {
LOG.error("Waiting for the answer from the Dart debugger under read action may lead to EDT freeze");
}
if (myVmServiceReceiverThreadId == Thread.currentThread().getId()) {
LOG.error("Synchronous requests must not be made in Web Socket listening thread: answer will never be received");
}
}
public void handleDebuggerConnected() {
streamListen(VmService.DEBUG_STREAM_ID, new VmServiceConsumers.SuccessConsumerWrapper() {
@Override
public void received(final Success success) {
myVmServiceReceiverThreadId = Thread.currentThread().getId();
streamListen(VmService.ISOLATE_STREAM_ID, new VmServiceConsumers.SuccessConsumerWrapper() {
@Override
public void received(final Success success) {
getVm(new VmServiceConsumers.VmConsumerWrapper() {
@Override
public void received(final VM vm) {
for (final IsolateRef isolateRef : vm.getIsolates()) {
getIsolate(isolateRef.getId(), new VmServiceConsumers.GetIsolateConsumerWrapper() {
@Override
public void received(final Isolate isolate) {
final Event event = isolate.getPauseEvent();
final EventKind eventKind = event.getKind();
// Ignore isolates that are very early in their lifecycle. You can't set breakpoints on them
// yet, and we'll get lifecycle events for them later.
if (eventKind == EventKind.None) {
return;
}
// This is the entry point for attaching a debugger to a running app.
if (eventKind == EventKind.Resume) {
attachIsolate(isolateRef, isolate);
return;
}
// if event is not PauseStart it means that PauseStart event will follow later and will be handled by listener
handleIsolate(isolateRef, eventKind == EventKind.PauseStart);
// Handle the case of isolates paused when we connect (this can come up in remote debugging).
if (eventKind == EventKind.PauseBreakpoint ||
eventKind == EventKind.PauseException ||
eventKind == EventKind.PauseInterrupted) {
myDebugProcess.isolateSuspended(isolateRef);
ApplicationManager.getApplication().executeOnPooledThread(() -> {
final ElementList<Breakpoint> breakpoints =
eventKind == EventKind.PauseBreakpoint ? event.getPauseBreakpoints() : null;
final InstanceRef exception = eventKind == EventKind.PauseException ? event.getException() : null;
myVmServiceListener
.onIsolatePaused(isolateRef, breakpoints, exception, event.getTopFrame(), event.getAtAsyncSuspension());
});
}
}
});
}
}
});
}
});
}
});
streamListen("ToolEvent", new SuccessConsumer() {
@Override
public void received(Success response) {
}
@Override
public void onError(RPCError error) {
LOG.error("Error listening to ToolEvent stream: " + error);
}
});
}
private void streamListen(@NotNull String streamId, @NotNull SuccessConsumer consumer) {
addRequest(() -> myVmService.streamListen(streamId, consumer));
}
private void getVm(@NotNull VMConsumer consumer) {
addRequest(() -> myVmService.getVM(consumer));
}
@NotNull
public CompletableFuture<Isolate> getCachedIsolate(@NotNull String isolateId) {
return Objects.requireNonNull(myIsolatesInfo.getCachedIsolate(isolateId, () -> {
CompletableFuture<Isolate> isolateFuture = new CompletableFuture<>();
getIsolate(isolateId, new GetIsolateConsumer() {
@Override
public void onError(RPCError error) {
isolateFuture.completeExceptionally(new RuntimeException(error.getMessage()));
}
@Override
public void received(Isolate response) {
isolateFuture.complete(response);
}
@Override
public void received(Sentinel response) {
// Unable to get the isolate.
isolateFuture.complete(null);
}
});
return isolateFuture;
}));
}
private void getIsolate(@NotNull String isolateId, @NotNull GetIsolateConsumer consumer) {
addRequest(() -> myVmService.getIsolate(isolateId, consumer));
}
public void handleIsolate(@NotNull IsolateRef isolateRef, boolean isolatePausedStart) {
// We should auto-resume on a StartPaused event, if we're not remote debugging, and after breakpoints have been set.
final boolean newIsolate = myIsolatesInfo.addIsolate(isolateRef);
if (isolatePausedStart) {
myIsolatesInfo.setShouldInitialResume(isolateRef);
}
// Just to make sure that the main isolate is not handled twice, both from handleDebuggerConnected() and DartVmServiceListener.received(PauseStart)
if (newIsolate) {
setIsolatePauseMode(isolateRef.getId(), myDebugProcess.getBreakOnExceptionMode(), isolateRef);
}
else {
checkInitialResume(isolateRef);
}
}
private void setIsolatePauseMode(@NotNull String isolateId, @NotNull ExceptionPauseMode mode, @NotNull IsolateRef isolateRef) {
if (supportsSetIsolatePauseMode()) {
SetIsolatePauseModeConsumer sipmc = new SetIsolatePauseModeConsumer() {
@Override
public void onError(RPCError error) {
}
@Override
public void received(Sentinel response) {
}
@Override
public void received(Success response) {
setInitialBreakpointsAndResume(isolateRef);
}
};
addRequest(() -> myVmService.setIsolatePauseMode(isolateId, mode, false, sipmc));
}
else {
SetExceptionPauseModeConsumer wrapper = new SetExceptionPauseModeConsumer() {
@Override
public void onError(RPCError error) {
}
@Override
public void received(Sentinel response) {
}
@Override
public void received(Success response) {
setInitialBreakpointsAndResume(isolateRef);
}
};
//noinspection deprecation
addRequest(() -> myVmService.setExceptionPauseMode(isolateId, mode, wrapper));
}
}
public void attachIsolate(@NotNull IsolateRef isolateRef, @NotNull Isolate isolate) {
boolean newIsolate = myIsolatesInfo.addIsolate(isolateRef);
// Just to make sure that the main isolate is not handled twice, both from handleDebuggerConnected() and DartVmServiceListener.received(PauseStart)
if (newIsolate) {
XDebugSessionImpl session = (XDebugSessionImpl)myDebugProcess.getSession();
ApplicationManager.getApplication().runReadAction(() -> {
session.reset();
session.initBreakpoints();
});
setIsolatePauseMode(isolateRef.getId(), myDebugProcess.getBreakOnExceptionMode(), isolateRef);
}
else {
checkInitialResume(isolateRef);
}
}
private void checkInitialResume(IsolateRef isolateRef) {
if (myIsolatesInfo.getShouldInitialResume(isolateRef)) {
resumeIsolate(isolateRef.getId(), null);
}
}
private void setInitialBreakpointsAndResume(@NotNull IsolateRef isolateRef) {
if (myDebugProcess.myRemoteProjectRootUri == null) {
// need to detect remote project root path before setting breakpoints
getIsolate(isolateRef.getId(), new VmServiceConsumers.GetIsolateConsumerWrapper() {
@Override
public void received(final Isolate isolate) {
myDebugProcess.guessRemoteProjectRoot(isolate.getLibraries());
doSetInitialBreakpointsAndResume(isolateRef);
}
});
}
else {
doSetInitialBreakpointsAndResume(isolateRef);
}
}
private void setInitialBreakpointsAndCheckExtensions(@NotNull IsolateRef isolateRef, @NotNull Isolate isolate) {
doSetBreakpointsForIsolate(myBreakpointHandler.getXBreakpoints(), isolateRef.getId(), () -> {
myIsolatesInfo.setBreakpointsSet(isolateRef);
});
FlutterApp app = FlutterApp.fromEnv(myDebugProcess.getExecutionEnvironment());
// TODO(messick) Consider replacing this test with an assert; could interfere with setExceptionPauseMode().
if (app != null) {
VMServiceManager service = app.getVMServiceManager();
if (service != null) {
service.addRegisteredExtensionRPCs(isolate, true);
}
}
}
private void doSetInitialBreakpointsAndResume(@NotNull IsolateRef isolateRef) {
doSetBreakpointsForIsolate(myBreakpointHandler.getXBreakpoints(), isolateRef.getId(), () -> {
myIsolatesInfo.setBreakpointsSet(isolateRef);
checkInitialResume(isolateRef);
});
}
private void doSetBreakpointsForIsolate(@NotNull Set<XLineBreakpoint<XBreakpointProperties>> xBreakpoints,
@NotNull String isolateId,
@Nullable Runnable onFinished) {
if (xBreakpoints.isEmpty()) {
if (onFinished != null) {
onFinished.run();
}
return;
}
final AtomicInteger counter = new AtomicInteger(xBreakpoints.size());
for (final XLineBreakpoint<XBreakpointProperties> xBreakpoint : xBreakpoints) {
addBreakpoint(isolateId, xBreakpoint.getSourcePosition(), new VmServiceConsumers.BreakpointsConsumer() {
@Override
void sourcePositionNotApplicable() {
myBreakpointHandler.breakpointFailed(xBreakpoint);
checkDone();
}
@Override
void received(List<Breakpoint> breakpointResponses, List<RPCError> errorResponses) {
if (!breakpointResponses.isEmpty()) {
for (Breakpoint breakpoint : breakpointResponses) {
myBreakpointHandler.vmBreakpointAdded(xBreakpoint, isolateId, breakpoint);
}
}
else if (!errorResponses.isEmpty()) {
myBreakpointHandler.breakpointFailed(xBreakpoint);
}
checkDone();
}
private void checkDone() {
if (counter.decrementAndGet() == 0 && onFinished != null) {
onFinished.run();
myVmService.getIsolate(isolateId, new GetIsolateConsumer() {
@Override
public void received(Isolate response) {
Set<String> libraryUris = new HashSet<>();
Set<String> fileNames = new HashSet<>();
for (LibraryRef library : response.getLibraries()) {
String uri = library.getUri();
libraryUris.add(uri);
String[] split = uri.split("/");
fileNames.add(split[split.length - 1]);
}
ElementList<Breakpoint> breakpoints = response.getBreakpoints();
if (breakpoints.isEmpty() && canonicalBreakpoints.isEmpty()) {
return;
}
Set<CanonicalBreakpoint> mappedCanonicalBreakpoints = new HashSet<>();
assert breakpoints != null;
for (Breakpoint breakpoint : breakpoints) {
Object location = breakpoint.getLocation();
// In JIT mode, locations will be unresolved at this time since files aren't compiled until they are used.
if (location instanceof UnresolvedSourceLocation) {
ScriptRef script = ((UnresolvedSourceLocation)location).getScript();
if (script != null && libraryUris.contains(script.getUri())) {
mappedCanonicalBreakpoints.add(breakpointNumbersToCanonicalMap.get(breakpoint.getBreakpointNumber()));
}
}
}
Analytics analytics = FlutterInitializer.getAnalytics();
String category = "breakpoint";
Sets.SetView<CanonicalBreakpoint> initialDifference =
Sets.difference(canonicalBreakpoints, mappedCanonicalBreakpoints);
Set<CanonicalBreakpoint> finalDifference = new HashSet<>();
for (CanonicalBreakpoint missingBreakpoint : initialDifference) {
// If the file name doesn't exist in loaded library files, then most likely it's not part of the dependencies of what was
// built. So it's okay to ignore these breakpoints in our count.
if (fileNames.contains(missingBreakpoint.fileName)) {
finalDifference.add(missingBreakpoint);
}
}
analytics.sendEventMetric(category, "unmapped-count", finalDifference.size());
// TODO(helin24): Get rid of this and instead track unmapped files in addBreakpoint?
// For internal bazel projects, report files where mapping failed.
if (WorkspaceCache.getInstance(myDebugProcess.getSession().getProject()).isBazel()) {
for (CanonicalBreakpoint canonicalBreakpoint : finalDifference) {
if (canonicalBreakpoint.path.contains("google3")) {
analytics.sendEvent(category,
String.format("unmapped-file|%s|%s", response.getRootLib().getUri(), canonicalBreakpoint.path));
}
}
}
}
@Override
public void received(Sentinel response) {
}
@Override
public void onError(RPCError error) {
}
});
}
}
});
}
}
public void addBreakpoint(@NotNull String isolateId,
@Nullable XSourcePosition position,
@NotNull VmServiceConsumers.BreakpointsConsumer consumer) {
myVmService.getVersion(new VersionConsumer() {
@Override
public void received(org.dartlang.vm.service.element.Version response) {
if (isVmServiceMappingSupported(response)) {
addBreakpointWithVmService(isolateId, position, consumer);
}
else {
addBreakpointWithMapper(isolateId, position, consumer);
}
}
@Override
public void onError(RPCError error) {
addBreakpointWithMapper(isolateId, position, consumer);
}
});
}
private boolean isVmServiceMappingSupported(org.dartlang.vm.service.element.Version version) {
assert version != null;
if (WorkspaceCache.getInstance(myDebugProcess.getSession().getProject()).isBazel()) {
return true;
}
FlutterSdk sdk = FlutterSdk.getFlutterSdk(myDebugProcess.getSession().getProject());
return VmServiceVersion.hasMapping(version) && sdk.getVersion().isUriMappingSupportedForWeb();
}
// This is the old way of mapping breakpoints, which uses analyzer.
public void addBreakpointWithMapper(@NotNull String isolateId,
@Nullable XSourcePosition position,
@NotNull VmServiceConsumers.BreakpointsConsumer consumer) {
if (position == null || position.getFile().getFileType() != DartFileType.INSTANCE) {
consumer.sourcePositionNotApplicable();
return;
}
addRequest(() -> {
int line = position.getLine() + 1;
Collection<String> scriptUris = myDebugProcess.getUrisForFile(position.getFile());
CanonicalBreakpoint canonicalBreakpoint =
new CanonicalBreakpoint(position.getFile().getName(), position.getFile().getCanonicalPath(), line);
canonicalBreakpoints.add(canonicalBreakpoint);
List<Breakpoint> breakpointResponses = new ArrayList<>();
List<RPCError> errorResponses = new ArrayList<>();
for (String uri : scriptUris) {
myVmService.addBreakpointWithScriptUri(isolateId, uri, line, new AddBreakpointWithScriptUriConsumer() {
@Override
public void received(Breakpoint response) {
breakpointResponses.add(response);
breakpointNumbersToCanonicalMap.put(response.getBreakpointNumber(), canonicalBreakpoint);
checkDone();
}
@Override
public void received(Sentinel response) {
checkDone();
}
@Override
public void onError(RPCError error) {
errorResponses.add(error);
checkDone();
}
private void checkDone() {
if (scriptUris.size() == breakpointResponses.size() + errorResponses.size()) {
consumer.received(breakpointResponses, errorResponses);
}
}
});
}
});
}
public void addBreakpointWithVmService(@NotNull String isolateId,
@Nullable XSourcePosition position,
@NotNull VmServiceConsumers.BreakpointsConsumer consumer) {
if (position == null || position.getFile().getFileType() != DartFileType.INSTANCE) {
consumer.sourcePositionNotApplicable();
return;
}
addRequest(() -> {
int line = position.getLine() + 1;
String resolvedUri = getResolvedUri(position);
LOG.info("Computed resolvedUri: " + resolvedUri);
List<String> resolvedUriList = List.of(percentEscapeUri(resolvedUri));
CanonicalBreakpoint canonicalBreakpoint =
new CanonicalBreakpoint(position.getFile().getName(), position.getFile().getCanonicalPath(), line);
canonicalBreakpoints.add(canonicalBreakpoint);
List<Breakpoint> breakpointResponses = new ArrayList<>();
List<RPCError> errorResponses = new ArrayList<>();
myVmService.lookupPackageUris(isolateId, resolvedUriList, new UriListConsumer() {
@Override
public void received(UriList response) {
LOG.info("in received of lookupPackageUris");
if (myDebugProcess.getSession().getProject().isDisposed()) {
return;
}
List<String> uris = response.getUris();
if (uris == null || uris.get(0) == null) {
LOG.info("Uri was not found");
JsonObject error = new JsonObject();
error.addProperty("error", "Breakpoint could not be mapped to package URI");
errorResponses.add(new RPCError(error));
Analytics analytics = FlutterInitializer.getAnalytics();
String category = "breakpoint";
// For internal bazel projects, report files where mapping failed.
if (WorkspaceCache.getInstance(myDebugProcess.getSession().getProject()).isBazel()) {
if (resolvedUri.contains("google3")) {
analytics.sendEvent(category, String.format("no-package-uri|%s", resolvedUri));
}
}
consumer.received(breakpointResponses, errorResponses);
return;
}
String scriptUri = uris.get(0);
LOG.info("in received of lookupPackageUris. scriptUri: " + scriptUri);
myVmService.addBreakpointWithScriptUri(isolateId, scriptUri, line, new AddBreakpointWithScriptUriConsumer() {
@Override
public void received(Breakpoint response) {
breakpointResponses.add(response);
breakpointNumbersToCanonicalMap.put(response.getBreakpointNumber(), canonicalBreakpoint);
checkDone();
}
@Override
public void received(Sentinel response) {
checkDone();
}
@Override
public void onError(RPCError error) {
errorResponses.add(error);
checkDone();
}
private void checkDone() {
consumer.received(breakpointResponses, errorResponses);
}
});
}
@Override
public void onError(RPCError error) {
LOG.error(error);
LOG.error(error.getMessage());
LOG.error(error.getRequest());
LOG.error(error.getDetails());
errorResponses.add(error);
consumer.received(breakpointResponses, errorResponses);
}
});
});
}
private String getResolvedUri(@NotNull XSourcePosition position) {
XDebugSession session = myDebugProcess.getSession();
assert session != null;
VirtualFile file =
WorkspaceCache.getInstance(session.getProject()).isBazel() ? position.getFile() : position.getFile().getCanonicalFile();
assert file != null;
String url = file.getUrl();
LOG.info("in getResolvedUri. url: " + url);
if (WorkspaceCache.getInstance(myDebugProcess.getSession().getProject()).isBazel()) {
String root = WorkspaceCache.getInstance(myDebugProcess.getSession().getProject()).get().getRoot().getPath();
String resolvedUriRoot = "google3:///";
// Look for a generated file path.
String genFilePattern = root + "/blaze-.*?/(.*)";
Pattern pattern = Pattern.compile(genFilePattern);
Matcher matcher = pattern.matcher(url);
if (matcher.find()) {
String path = matcher.group(1);
return resolvedUriRoot + path;
}
// Look for root.
int rootIdx = url.indexOf(root);
if (rootIdx >= 0) {
return resolvedUriRoot + url.substring(rootIdx + root.length() + 1);
}
}
if (SystemInfo.isWindows) {
// Dart and the VM service use three /'s in file URIs: https://api.dart.dev/stable/2.16.1/dart-core/Uri-class.html.
return url.replace("file://", "file:///");
}
return url;
}
private String percentEscapeUri(String uri) {
PercentEscaper escaper = new PercentEscaper("!#$&'()*+,-./:;=?@_~", false);
return escaper.escape(uri);
}
public void addBreakpointForIsolates(@NotNull XLineBreakpoint<XBreakpointProperties> xBreakpoint,
@NotNull Collection<IsolatesInfo.IsolateInfo> isolateInfos) {
for (final IsolatesInfo.IsolateInfo isolateInfo : isolateInfos) {
addBreakpoint(isolateInfo.getIsolateId(), xBreakpoint.getSourcePosition(), new VmServiceConsumers.BreakpointsConsumer() {
@Override
void sourcePositionNotApplicable() {
myBreakpointHandler.breakpointFailed(xBreakpoint);
}
@Override
void received(List<Breakpoint> breakpointResponses, List<RPCError> errorResponses) {
for (Breakpoint breakpoint : breakpointResponses) {
myBreakpointHandler.vmBreakpointAdded(xBreakpoint, isolateInfo.getIsolateId(), breakpoint);
}
}
});
}
}
/**
* Reloaded scripts need to have their breakpoints re-applied; re-set all existing breakpoints.
*/
public void restoreBreakpointsForIsolate(@NotNull String isolateId, @Nullable Runnable onFinished) {
// Cached information about the isolate may now be stale.
myIsolatesInfo.invalidateCache(isolateId);
// Remove all existing VM breakpoints for this isolate.
myBreakpointHandler.removeAllVmBreakpoints(isolateId);
// Re-set existing breakpoints.
doSetBreakpointsForIsolate(myBreakpointHandler.getXBreakpoints(), isolateId, onFinished);
}
public void addTemporaryBreakpoint(@NotNull XSourcePosition position, @NotNull String isolateId) {
addBreakpoint(isolateId, position, new VmServiceConsumers.BreakpointsConsumer() {
@Override
void sourcePositionNotApplicable() {
}
@Override
void received(List<Breakpoint> breakpointResponses, List<RPCError> errorResponses) {
for (Breakpoint breakpoint : breakpointResponses) {
myBreakpointHandler.temporaryBreakpointAdded(isolateId, breakpoint);
}
}
});
}
public void removeBreakpoint(@NotNull String isolateId, @NotNull String vmBreakpointId) {
addRequest(() -> myVmService.removeBreakpoint(isolateId, vmBreakpointId, new RemoveBreakpointConsumer() {
@Override
public void onError(RPCError error) {
}
@Override
public void received(Sentinel response) {
}
@Override
public void received(Success response) {
}
}));
}
public void resumeIsolate(@NotNull String isolateId, @Nullable StepOption stepOption) {
addRequest(() -> {
myLatestStep = stepOption;
myVmService.resume(isolateId, stepOption, null, new VmServiceConsumers.EmptyResumeConsumer() {
});
});
}
public void setExceptionPauseMode(@NotNull ExceptionPauseMode mode) {
for (IsolatesInfo.IsolateInfo isolateInfo : myIsolatesInfo.getIsolateInfos()) {
if (supportsSetIsolatePauseMode()) {
addRequest(() -> myVmService.setIsolatePauseMode(isolateInfo.getIsolateId(), mode, false, new SetIsolatePauseModeConsumer() {
@Override
public void onError(RPCError error) {
}
@Override
public void received(Sentinel response) {
}
@Override
public void received(Success response) {
}
}));
}
else {
//noinspection deprecation
addRequest(() -> myVmService.setExceptionPauseMode(isolateInfo.getIsolateId(), mode, new SetExceptionPauseModeConsumer() {
@Override
public void onError(RPCError error) {
}
@Override
public void received(Sentinel response) {
}
@Override
public void received(Success response) {
}
}));
}
}
}
/**
* Drop to the indicated frame.
* <p>
* frameIndex specifies the stack frame to rewind to. Stack frame 0 is the currently executing
* function, so frameIndex must be at least 1.
*/
public void dropFrame(@NotNull String isolateId, int frameIndex) {
addRequest(() -> {
myLatestStep = StepOption.Rewind;
myVmService.resume(isolateId, StepOption.Rewind, frameIndex, new VmServiceConsumers.EmptyResumeConsumer() {
@Override
public void onError(RPCError error) {
myDebugProcess.getSession().getConsoleView()
.print("Error from drop frame: " + error.getMessage() + "\n", ConsoleViewContentType.ERROR_OUTPUT);
}
});
});
}
public void pauseIsolate(@NotNull String isolateId) {
addRequest(() -> myVmService.pause(isolateId, new PauseConsumer() {
@Override
public void onError(RPCError error) {
}
@Override
public void received(Sentinel response) {
}
@Override
public void received(Success response) {
}
}));
}
public void computeStackFrames(@NotNull String isolateId,
int firstFrameIndex,
@NotNull XExecutionStack.XStackFrameContainer container,
@Nullable InstanceRef exception) {
addRequest(() -> myVmService.getStack(isolateId, new GetStackConsumer() {
@Override
public void received(Stack vmStack) {
ApplicationManager.getApplication().executeOnPooledThread(() -> {
InstanceRef exceptionToAddToFrame = exception;
// Check for async causal frames; fall back to using regular sync frames.
ElementList<Frame> elementList = vmStack.getAsyncCausalFrames();
if (elementList == null) {
elementList = vmStack.getFrames();
}
final List<Frame> vmFrames = Lists.newArrayList(elementList);
final List<XStackFrame> xStackFrames = new ArrayList<>(vmFrames.size());
for (final Frame vmFrame : vmFrames) {
if (vmFrame.getKind() == FrameKind.AsyncSuspensionMarker) {
// Render an asynchronous gap.
final XStackFrame markerFrame = new DartAsyncMarkerFrame();
xStackFrames.add(markerFrame);
}
else {
final DartVmServiceStackFrame stackFrame =
new DartVmServiceStackFrame(myDebugProcess, isolateId, vmFrame, vmFrames, exceptionToAddToFrame);
stackFrame.setIsDroppableFrame(vmFrame.getKind() == FrameKind.Regular);
xStackFrames.add(stackFrame);
if (!stackFrame.isInDartSdkPatchFile()) {
// The exception (if any) is added to the frame where debugger stops and to the upper frames.
exceptionToAddToFrame = null;
}
}
}
container.addStackFrames(firstFrameIndex == 0 ? xStackFrames : xStackFrames.subList(firstFrameIndex, xStackFrames.size()), true);
});
}
@Override
public void onError(RPCError error) {
container.errorOccurred(error.getMessage());
}
@Override
public void received(Sentinel response) {
container.errorOccurred(response.getValueAsString());
}
}));
}
@Nullable
public Script getScriptSync(@NotNull String isolateId, @NotNull String scriptId) {
assertSyncRequestAllowed();
final Semaphore semaphore = new Semaphore();
semaphore.down();
final Ref<Script> resultRef = Ref.create();
addRequest(() -> myVmService.getObject(isolateId, scriptId, new GetObjectConsumer() {
@Override
public void received(Obj script) {
resultRef.set((Script)script);
semaphore.up();
}
@Override
public void received(Sentinel response) {
semaphore.up();
}
@Override
public void onError(RPCError error) {
semaphore.up();
}
}));
semaphore.waitFor(RESPONSE_WAIT_TIMEOUT);
return resultRef.get();
}
public void getObject(@NotNull String isolateId, @NotNull String objectId, @NotNull GetObjectConsumer consumer) {
addRequest(() -> myVmService.getObject(isolateId, objectId, consumer));
}
public void getCollectionObject(@NotNull String isolateId,
@NotNull String objectId,
int offset,
int count,
@NotNull GetObjectConsumer consumer) {
addRequest(() -> myVmService.getObject(isolateId, objectId, offset, count, consumer));
}
public void evaluateInFrame(@NotNull String isolateId,
@NotNull Frame vmFrame,
@NotNull String expression,
@NotNull XDebuggerEvaluator.XEvaluationCallback callback) {
addRequest(() -> myVmService.evaluateInFrame(isolateId, vmFrame.getIndex(), expression, new EvaluateInFrameConsumer() {
@Override
public void received(InstanceRef instanceRef) {
callback.evaluated(new DartVmServiceValue(myDebugProcess, isolateId, "result", instanceRef, null, null, false));
}
@Override
public void received(Sentinel sentinel) {
callback.errorOccurred(sentinel.getValueAsString());
}
@Override
public void received(ErrorRef errorRef) {
callback.errorOccurred(DartVmServiceEvaluator.getPresentableError(errorRef.getMessage()));
}
@Override
public void onError(RPCError error) {
callback.errorOccurred(error.getMessage());
}
}));
}
@SuppressWarnings("SameParameterValue")
public void evaluateInTargetContext(@NotNull String isolateId,
@NotNull String targetId,
@NotNull String expression,
@NotNull EvaluateConsumer consumer) {
addRequest(() -> myVmService.evaluate(isolateId, targetId, expression, consumer));
}
public void evaluateInTargetContext(@NotNull String isolateId,
@NotNull String targetId,
@NotNull String expression,
@NotNull XDebuggerEvaluator.XEvaluationCallback callback) {
evaluateInTargetContext(isolateId, targetId, expression, new EvaluateConsumer() {
@Override
public void received(InstanceRef instanceRef) {
callback.evaluated(new DartVmServiceValue(myDebugProcess, isolateId, "result", instanceRef, null, null, false));
}
@Override
public void received(Sentinel sentinel) {
callback.errorOccurred(sentinel.getValueAsString());
}
@Override
public void received(ErrorRef errorRef) {
callback.errorOccurred(DartVmServiceEvaluator.getPresentableError(errorRef.getMessage()));
}
@Override
public void onError(RPCError error) {
callback.errorOccurred(error.getMessage());
}
});
}
public void callToString(@NotNull String isolateId, @NotNull String targetId, @NotNull InvokeConsumer callback) {
callMethodOnTarget(isolateId, targetId, "toString", callback);
}
public void callToList(@NotNull String isolateId, @NotNull String targetId, @NotNull InvokeConsumer callback) {
callMethodOnTarget(isolateId, targetId, "toList", callback);
}
public void callMethodOnTarget(@NotNull String isolateId,
@NotNull String targetId,
@NotNull String methodName,
@NotNull InvokeConsumer callback) {
addRequest(() -> myVmService.invoke(isolateId, targetId, methodName, Collections.emptyList(), true, callback));
}
public CompletableFuture<String> findResolvedFile(@NotNull String isolateId, @NotNull String scriptUri) {
CompletableFuture<String> uriFuture = new CompletableFuture<>();
myVmService.lookupResolvedPackageUris(isolateId, List.of(scriptUri), true, new UriListConsumer() {
@Override
public void received(UriList response) {
if (response == null) {
LOG.info("lookupResolvedPackageUris returned null response");
uriFuture.complete(null);
return;
}
List<String> uris = response.getUris();
if (uris == null) {
LOG.info("lookupResolvedPackageUris returned null uris");
uriFuture.complete(null);
return;
}
uriFuture.complete(uris.get(0));
}
@Override
public void onError(RPCError error) {
assert error != null;
LOG.info("lookupResolvedPackageUris error: " + error.getMessage());
uriFuture.complete(null);
}
});
return uriFuture;
}
private boolean supportsSetIsolatePauseMode() {
org.dartlang.vm.service.element.Version version = myVmService.getRuntimeVersion();
return version.getMajor() > 3 || version.getMajor() == 3 && version.getMinor() >= 53;
}
}
class CanonicalBreakpoint {
@NotNull final String fileName;
@Nullable final String path;
final int line;
CanonicalBreakpoint(@NotNull String name, @Nullable String path, int line) {
this.fileName = name;
this.path = path;
this.line = line;
}
}
class VmServiceVersion {
// VM service protocol versions: https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#revision-history.
@NotNull private static Version URI_MAPPING_VERSION = new Version(VmService.versionMajor, VmService.versionMinor, 0);
public static boolean hasMapping(org.dartlang.vm.service.element.Version version) {
assert version != null;
return (new Version(version.getMajor(), version.getMinor(), 0)).isOrGreaterThan(URI_MAPPING_VERSION.major, URI_MAPPING_VERSION.minor);
}
}
| flutter-intellij/flutter-idea/src/io/flutter/vmService/VmServiceWrapper.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/io/flutter/vmService/VmServiceWrapper.java",
"repo_id": "flutter-intellij",
"token_count": 16454
} | 618 |
/*
* Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
* for details. All rights reserved. Use of this source code is governed by a
* BSD-style license that can be found in the LICENSE file.
*
* This file has been automatically generated. Please do not edit it manually.
* To regenerate the file, use the script "pkg/analysis_server/tool/spec/generate_files".
*/
package org.dartlang.analysis.server.protocol;
import com.google.common.collect.Lists;
import com.google.dart.server.utilities.general.ObjectUtilities;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import static org.apache.commons.lang3.StringUtils.join;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* An editor for a property of a Flutter widget.
*
* @coverage dart.server.generated.types
*/
@SuppressWarnings("unused")
public class FlutterWidgetPropertyEditor {
public static final FlutterWidgetPropertyEditor[] EMPTY_ARRAY = new FlutterWidgetPropertyEditor[0];
public static final List<FlutterWidgetPropertyEditor> EMPTY_LIST = Lists.newArrayList();
private final String kind;
private final List<FlutterWidgetPropertyValueEnumItem> enumItems;
/**
* Constructor for {@link FlutterWidgetPropertyEditor}.
*/
public FlutterWidgetPropertyEditor(String kind, List<FlutterWidgetPropertyValueEnumItem> enumItems) {
this.kind = kind;
this.enumItems = enumItems;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof FlutterWidgetPropertyEditor) {
FlutterWidgetPropertyEditor other = (FlutterWidgetPropertyEditor)obj;
return
ObjectUtilities.equals(other.kind, kind) &&
ObjectUtilities.equals(other.enumItems, enumItems);
}
return false;
}
public static FlutterWidgetPropertyEditor fromJson(JsonObject jsonObject) {
String kind = jsonObject.get("kind").getAsString();
List<FlutterWidgetPropertyValueEnumItem> enumItems = jsonObject.get("enumItems") == null
? null
: FlutterWidgetPropertyValueEnumItem
.fromJsonArray(jsonObject.get("enumItems").getAsJsonArray());
return new FlutterWidgetPropertyEditor(kind, enumItems);
}
public static List<FlutterWidgetPropertyEditor> fromJsonArray(JsonArray jsonArray) {
if (jsonArray == null) {
return EMPTY_LIST;
}
ArrayList<FlutterWidgetPropertyEditor> list = new ArrayList<FlutterWidgetPropertyEditor>(jsonArray.size());
Iterator<JsonElement> iterator = jsonArray.iterator();
while (iterator.hasNext()) {
list.add(fromJson(iterator.next().getAsJsonObject()));
}
return list;
}
public List<FlutterWidgetPropertyValueEnumItem> getEnumItems() {
return enumItems;
}
public String getKind() {
return kind;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
builder.append(kind);
builder.append(enumItems);
return builder.toHashCode();
}
public JsonObject toJson() {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("kind", kind);
if (enumItems != null) {
JsonArray jsonArrayEnumItems = new JsonArray();
for (FlutterWidgetPropertyValueEnumItem elt : enumItems) {
jsonArrayEnumItems.add(elt.toJson());
}
jsonObject.add("enumItems", jsonArrayEnumItems);
}
return jsonObject;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("[");
builder.append("kind=");
builder.append(kind).append(", ");
builder.append("enumItems=");
builder.append(join(enumItems, ", "));
builder.append("]");
return builder.toString();
}
}
| flutter-intellij/flutter-idea/src/org/dartlang/analysis/server/protocol/FlutterWidgetPropertyEditor.java/0 | {
"file_path": "flutter-intellij/flutter-idea/src/org/dartlang/analysis/server/protocol/FlutterWidgetPropertyEditor.java",
"repo_id": "flutter-intellij",
"token_count": 1400
} | 619 |
/*
* Copyright 2019 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
import'package:test/test.dart';
/// Test data for test line marker tests.
/// The outline for this file is pretty-printed in simple_outline.txt.
///
/// To update the outline, open this file in a debugging IntelliJ instance, then
/// set a breakpoint in the ActiveEditorsOutlineService's OutlineListener call
/// to `notifyOutlineUpdated`, then look at the Flutter Outline for this file.
/// This will break at the outline and allow you to copy its json value.
///
/// You can pretty-print the json using the pretty_print.dart script at
/// testData/sample_tests/bin/pretty_print.dart.
// TODO: use an API on the Dart Analyzer to update this outline more easily.
void main() {
test('test 1', () {});
}
| flutter-intellij/flutter-idea/testData/sample_tests/test/simple_test.dart/0 | {
"file_path": "flutter-intellij/flutter-idea/testData/sample_tests/test/simple_test.dart",
"repo_id": "flutter-intellij",
"token_count": 243
} | 620 |
/*
* Copyright 2017 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.bazel;
import com.intellij.openapi.vfs.VirtualFile;
import io.flutter.testing.ProjectFixture;
import io.flutter.testing.TestDir;
import io.flutter.testing.Testing;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import static org.junit.Assert.assertNull;
public class PluginConfigTest {
@Rule
public ProjectFixture fixture = Testing.makeEmptyProject();
@Rule
public TestDir dir = new TestDir();
@Test @Ignore
public void shouldReturnNullForSyntaxError() throws Exception {
final VirtualFile config = dir.writeFile("config.json", "asdf");
final PluginConfig result = PluginConfig.load(config);
assertNull(result);
}
}
| flutter-intellij/flutter-idea/testSrc/unit/io/flutter/bazel/PluginConfigTest.java/0 | {
"file_path": "flutter-intellij/flutter-idea/testSrc/unit/io/flutter/bazel/PluginConfigTest.java",
"repo_id": "flutter-intellij",
"token_count": 267
} | 621 |
/*
* Copyright 2019 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.logging;
import com.intellij.execution.filters.Filter;
import com.intellij.execution.filters.HyperlinkInfo;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.execution.ui.ConsoleViewContentType;
import com.intellij.openapi.actionSystem.AnAction;
import io.flutter.FlutterInitializer;
import io.flutter.analytics.Analytics;
import io.flutter.analytics.MockAnalyticsTransport;
import io.flutter.run.FlutterDebugProcess;
import io.flutter.run.daemon.FlutterApp;
import io.flutter.settings.FlutterSettings;
import io.flutter.utils.JsonUtils;
import io.flutter.vmService.VMServiceManager;
import org.dartlang.vm.service.VmService;
import org.dartlang.vm.service.element.Event;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import javax.swing.*;
import java.io.InputStreamReader;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertEquals;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class FlutterConsoleLogManagerTest {
private Analytics analytics;
private MockAnalyticsTransport transport;
@Before
public void setUp() {
transport = new MockAnalyticsTransport();
analytics = new Analytics("123e4567-e89b-12d3-a456-426655440000", "1.0", "IntelliJ CE", "2016.3.2");
analytics.setTransport(transport);
analytics.setCanSend(false);
FlutterInitializer.setAnalytics(analytics);
}
@After
public void tearDown() {
FlutterSettings.setInstance(null);
}
@Test
public void testBasicLogging() {
final ConsoleViewMock console = new ConsoleViewMock();
final FlutterConsoleLogManager logManager = new FlutterConsoleLogManager(console, createFlutterApp());
final Event event = new Event(JsonUtils.parseReader(
new InputStreamReader(FlutterConsoleLogManagerTest.class.getResourceAsStream("console_log_1.json"))).getAsJsonObject());
logManager.processLoggingEvent(event);
assertEquals("[my.log] hello world\n", console.getText());
}
@Test
public void testNoLoggerName() {
final ConsoleViewMock console = new ConsoleViewMock();
final FlutterConsoleLogManager logManager = new FlutterConsoleLogManager(console, createFlutterApp());
final Event event = new Event(JsonUtils.parseReader(
new InputStreamReader(FlutterConsoleLogManagerTest.class.getResourceAsStream("console_log_2.json"))).getAsJsonObject());
logManager.processLoggingEvent(event);
assertEquals("[log] hello world\n", console.getText());
}
@Test
public void testWithError() {
final ConsoleViewMock console = new ConsoleViewMock();
final FlutterConsoleLogManager logManager = new FlutterConsoleLogManager(console, createFlutterApp());
final Event event = new Event(JsonUtils.parseReader(
new InputStreamReader(FlutterConsoleLogManagerTest.class.getResourceAsStream("console_log_3.json"))).getAsJsonObject());
logManager.processLoggingEvent(event);
assertEquals("[log] hello world\n my sample error\n", console.getText());
}
@Test
public void testFlutterError() {
final ConsoleViewMock console = new ConsoleViewMock();
final FlutterConsoleLogManager logManager = new FlutterConsoleLogManager(console, createFlutterApp());
final Event event = new Event(JsonUtils.parseReader(
new InputStreamReader(FlutterConsoleLogManagerTest.class.getResourceAsStream("flutter_error.json"))).getAsJsonObject());
final FlutterSettings settings = mock(FlutterSettings.class);
when(settings.isShowStructuredErrors()).thenReturn(true);
FlutterSettings.setInstance(settings);
logManager.handleFlutterErrorEvent(event);
logManager.flushFlutterErrorQueue();
assertThat(console.getText(), containsString("== Exception caught by widgets library =="));
}
@Test
public void testMultipleFlutterErrors() {
final ConsoleViewMock console = new ConsoleViewMock();
final FlutterConsoleLogManager logManager = new FlutterConsoleLogManager(console, createFlutterApp());
final Event event = new Event(JsonUtils.parseReader(
new InputStreamReader(FlutterConsoleLogManagerTest.class.getResourceAsStream("flutter_error.json"))).getAsJsonObject());
final FlutterSettings settings = mock(FlutterSettings.class);
when(settings.isShowStructuredErrors()).thenReturn(true);
FlutterSettings.setInstance(settings);
logManager.handleFlutterErrorEvent(event);
logManager.flushFlutterErrorQueue();
// Assert that the first error has the full text.
assertThat(console.getText(), containsString("== Exception caught by widgets library =="));
assertThat(console.getText(), containsString("PlanetWidget.build (package:planets/main.dart:229:5)"));
console.clear();
logManager.handleFlutterErrorEvent(event);
logManager.flushFlutterErrorQueue();
// Assert that the second error has abridged text.
assertThat(console.getText(), containsString("== Exception caught by widgets library =="));
assertThat(console.getText(),
not(containsString("PlanetWidget.build (package:planets/main.dart:229:5)")));
}
@Test
public void testWithStacktrace() {
final ConsoleViewMock console = new ConsoleViewMock();
final FlutterConsoleLogManager logManager = new FlutterConsoleLogManager(console, createFlutterApp());
final Event event = new Event(JsonUtils.parseReader(
new InputStreamReader(FlutterConsoleLogManagerTest.class.getResourceAsStream("console_log_4.json"))).getAsJsonObject());
logManager.processLoggingEvent(event);
assertEquals("[log] hello world\n" +
" #0 MyApp.build.<anonymous closure> (package:xfactor_wod/main.dart:64:65)\n" +
" #1 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:635:14)\n" +
" #2 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:711:32)\n" +
" #3 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)\n" +
" #4 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:365:11)\n" +
" #5 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:275:7)\n" +
" #6 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:455:9)\n" +
" #7 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:75:13)\n" +
" #8 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:102:11)\n" +
" #9 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)\n" +
" #10 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)\n" +
" #11 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)\n" +
" #12 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)\n" +
" #13 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)\n" +
" #14 _rootRunUnary (dart:async/zone.dart:1136:13)\n" +
" #15 _CustomZone.runUnary (dart:async/zone.dart:1029:19)\n" +
" #16 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)\n" +
" #17 _invoke1 (dart:ui/hooks.dart:250:10)\n" +
" #18 _dispatchPointerDataPacket (dart:ui/hooks.dart:159:5)\n", console.getText());
}
private FlutterApp createFlutterApp() {
final FlutterApp app = mock(FlutterApp.class);
when(app.getVmService()).thenAnswer(mock -> mock(VmService.class));
when(app.getFlutterDebugProcess()).thenAnswer(mock -> mock(FlutterDebugProcess.class));
when(app.getVMServiceManager()).thenAnswer(mock -> mock(VMServiceManager.class));
return app;
}
}
class ConsoleViewMock implements ConsoleView {
StringBuilder builder = new StringBuilder();
String getText() {
return builder.toString();
}
@Override
public void print(@NotNull String string, @NotNull ConsoleViewContentType type) {
builder.append(string);
}
@Override
public void clear() {
builder = new StringBuilder();
}
@Override
public void scrollTo(int i) {
}
@Override
public void attachToProcess(@NotNull ProcessHandler handler) {
}
@Override
public void setOutputPaused(boolean b) {
}
@Override
public boolean isOutputPaused() {
return false;
}
@Override
public boolean hasDeferredOutput() {
return false;
}
@Override
public void performWhenNoDeferredOutput(@NotNull Runnable runnable) {
}
@Override
public void setHelpId(@NotNull String s) {
}
@Override
public void addMessageFilter(@NotNull Filter filter) {
}
@Override
public void printHyperlink(@NotNull String s, @Nullable HyperlinkInfo info) {
}
@Override
public int getContentSize() {
return 0;
}
@Override
public boolean canPause() {
return false;
}
@NotNull
@Override
public AnAction @NotNull [] createConsoleActions() {
return new AnAction[0];
}
@Override
public void allowHeavyFilters() {
}
@NotNull
@Override
public JComponent getComponent() {
throw new Error("not supported");
}
@Override
public JComponent getPreferredFocusableComponent() {
return null;
}
@Override
public void dispose() {
}
} | flutter-intellij/flutter-idea/testSrc/unit/io/flutter/logging/FlutterConsoleLogManagerTest.java/0 | {
"file_path": "flutter-intellij/flutter-idea/testSrc/unit/io/flutter/logging/FlutterConsoleLogManagerTest.java",
"repo_id": "flutter-intellij",
"token_count": 3755
} | 622 |
/*
* Copyright 2019 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.run.bazelTest;
import com.intellij.execution.actions.ConfigurationContext;
import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.mock.MockVirtualFileSystem;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.source.tree.LeafPsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.lang.dart.psi.DartFile;
import com.jetbrains.lang.dart.psi.DartFunctionDeclarationWithBodyOrNative;
import com.jetbrains.lang.dart.psi.DartStringLiteralExpression;
import io.flutter.AbstractDartElementTest;
import io.flutter.bazel.PluginConfig;
import io.flutter.bazel.Workspace;
import io.flutter.editor.ActiveEditorsOutlineService;
import io.flutter.testing.FakeActiveEditorsOutlineService;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.core.IsNot.not;
import static org.hamcrest.MatcherAssert.assertThat;
public class BazelTestConfigProducerTest extends AbstractDartElementTest {
private static final String TEST_FILE_PATH = "workspace/foo/bar.dart";
private String fileContents;
private final BazelTestConfigUtils bazelTestConfigUtils = new BazelTestConfigUtils() {
@Override
protected ActiveEditorsOutlineService getActiveEditorsOutlineService(@NotNull Project project) {
return new FakeActiveEditorsOutlineService(project, "/" + TEST_FILE_PATH, FakeActiveEditorsOutlineService.SIMPLE_OUTLINE_PATH);
}
};
@Before
public void setUp() throws IOException {
fileContents = new String(Files.readAllBytes(Paths.get(FakeActiveEditorsOutlineService.SIMPLE_TEST_PATH)));
}
@Test
@Ignore("https://github.com/flutter/flutter-intellij/issues/3583")
public void producesFileConfigurationInsideABazelWorkspace() throws Exception {
run(() -> {
// Set up the configuration producer.
final ConfigurationContext context = getMainContext();
final BazelTestConfig config = getEmptyBazelTestConfig();
final BazelTestConfigProducer testConfigProducer = new TestBazelConfigProducer(true, true, bazelTestConfigUtils);
// Produce and check a run configuration.
final boolean result = testConfigProducer.setupConfigurationFromContext(config, context, new Ref<>());
assertThat(result, equalTo(true));
assertThat(config.getFields().getTestName(), equalTo(null));
assertThat(config.getFields().getEntryFile(), equalTo("/workspace/foo/bar.dart"));
assertThat(config.getFields().getBazelTarget(), equalTo(null));
});
}
@Test
@Ignore("https://github.com/flutter/flutter-intellij/issues/3583")
public void producesTestNameConfigurationInsideABazelWorkspace() throws Exception {
run(() -> {
// Set up the configuration producer.
final ConfigurationContext context = getTest1Context();
final BazelTestConfig config = getEmptyBazelTestConfig();
final BazelTestConfigProducer testConfigProducer = new TestBazelConfigProducer(true, true, bazelTestConfigUtils);
// Produce and check a run configuration.
final boolean result = testConfigProducer.setupConfigurationFromContext(config, context, new Ref<>());
assertThat(result, equalTo(true));
assertThat(config.getFields().getTestName(), equalTo("test 1"));
assertThat(config.getFields().getEntryFile(), equalTo("/workspace/foo/bar.dart"));
assertThat(config.getFields().getBazelTarget(), equalTo(null));
});
}
@Test
@Ignore("https://github.com/flutter/flutter-intellij/issues/3583")
public void producesNoConfigurationOutsideABazelWorkspace() throws Exception {
run(() -> {
// Set up the configuration producer.
final ConfigurationContext context = getTest1Context();
final BazelTestConfig config = getEmptyBazelTestConfig();
final BazelTestConfigProducer testConfigProducer = new TestBazelConfigProducer(false, true, bazelTestConfigUtils);
// Produce and check a run configuration.
final boolean result = testConfigProducer.setupConfigurationFromContext(config, context, new Ref<>());
assertThat(result, equalTo(false));
assertThat(config.getFields().getTestName(), equalTo(null));
assertThat(config.getFields().getEntryFile(), equalTo(null));
assertThat(config.getFields().getBazelTarget(), equalTo(null));
});
}
@Test
@Ignore("https://github.com/flutter/flutter-intellij/issues/3583")
public void producesNoConfigurationWithAnInvalidTestFile() throws Exception {
run(() -> {
// Set up the configuration producer.
final ConfigurationContext context = getTest1Context();
final BazelTestConfig config = getEmptyBazelTestConfig();
final BazelTestConfigProducer testConfigProducer = new TestBazelConfigProducer(true, false, bazelTestConfigUtils);
// Produce and check a run configuration.
final boolean result = testConfigProducer.setupConfigurationFromContext(config, context, new Ref<>());
assertThat(result, equalTo(false));
assertThat(config.getFields().getTestName(), equalTo(null));
assertThat(config.getFields().getEntryFile(), equalTo(null));
assertThat(config.getFields().getBazelTarget(), equalTo(null));
});
}
private ConfigurationContext getMainContext() {
// Set up fake source code.
final PsiElement mainIdentifier = setUpDartElement(
"workspace/foo/bar.dart", fileContents, "main", LeafPsiElement.class);
final PsiElement main = PsiTreeUtil.findFirstParent(
mainIdentifier, element -> element instanceof DartFunctionDeclarationWithBodyOrNative);
assertThat(main, not(equalTo(null)));
return new ConfigurationContext(main);
}
private ConfigurationContext getTest1Context() {
// Set up fake source code.
final PsiElement testIdentifier = setUpDartElement(
TEST_FILE_PATH, fileContents, "test 1", LeafPsiElement.class);
final PsiElement test =
PsiTreeUtil.findFirstParent(testIdentifier, element -> element instanceof DartStringLiteralExpression);
assertThat(test, not(equalTo(null)));
return new ConfigurationContext(test);
}
private BazelTestConfig getEmptyBazelTestConfig() {
return new BazelTestConfig(fixture.getProject(), new TestConfigurationFactory(), "Test config");
}
private static class TestBazelConfigProducer extends BazelTestConfigProducer {
final MockVirtualFileSystem fs;
final Workspace fakeWorkspace;
final boolean hasWorkspace;
final boolean hasValidTestFile;
TestBazelConfigProducer(boolean hasWorkspace,
boolean hasValidTestFile,
BazelTestConfigUtils bazelTestConfigUtils) {
super(bazelTestConfigUtils);
fs = new MockVirtualFileSystem();
fs.file("/workspace/WORKSPACE", "");
fakeWorkspace = Workspace.forTest(
fs.findFileByPath("/workspace/"),
PluginConfig.forTest("", "", "", "", "", "", "", "", "", "", "", "")
);
this.hasWorkspace = hasWorkspace;
this.hasValidTestFile = hasValidTestFile;
}
@Nullable
@Override
protected Workspace getWorkspace(@NotNull Project project) {
return hasWorkspace ? fakeWorkspace : null;
}
@Nullable
@Override
VirtualFile verifyFlutterTestFile(@NotNull BazelTestConfig config, @NotNull ConfigurationContext context, @NotNull DartFile file) {
return hasValidTestFile ? file.getVirtualFile() : null;
}
}
private static class TestConfigurationFactory extends ConfigurationFactory {
RunConfiguration runConfiguration;
protected TestConfigurationFactory() {
super(FlutterBazelTestConfigurationType.getInstance());
}
@NotNull
@Override
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
return runConfiguration;
}
}
}
| flutter-intellij/flutter-idea/testSrc/unit/io/flutter/run/bazelTest/BazelTestConfigProducerTest.java/0 | {
"file_path": "flutter-intellij/flutter-idea/testSrc/unit/io/flutter/run/bazelTest/BazelTestConfigProducerTest.java",
"repo_id": "flutter-intellij",
"token_count": 2769
} | 623 |
/*
* Copyright 2017 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.testing;
/**
* Static methods useful in tests that work with JSON.
*/
public class JsonTesting {
private JsonTesting() {}
/**
* Generates a JSON object expression.
*
* <p>Each pair should be in the form "key:value". Automatically quotes each key.
* No escaping is done on the values.
*/
public static String curly(String... pairs) {
final StringBuilder out = new StringBuilder();
out.append('{');
boolean first = true;
for (String pair : pairs) {
final int colon = pair.indexOf(":");
if (!first) out.append(",");
out.append('"').append(pair.substring(0, colon)).append("\":").append(pair.substring(colon + 1));
first = false;
}
out.append('}');
return out.toString();
}
}
| flutter-intellij/flutter-idea/testSrc/unit/io/flutter/testing/JsonTesting.java/0 | {
"file_path": "flutter-intellij/flutter-idea/testSrc/unit/io/flutter/testing/JsonTesting.java",
"repo_id": "flutter-intellij",
"token_count": 314
} | 624 |
package com.jetbrains.lang.dart.util;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.impl.libraries.ApplicationLibraryTable;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess;
import com.intellij.testFramework.ThreadTracker;
import com.intellij.util.PathUtil;
import com.jetbrains.lang.dart.sdk.DartSdk;
import io.flutter.dart.DartPlugin;
import org.jetbrains.annotations.NotNull;
import org.junit.Assert;
import java.io.File;
import java.util.Collections;
// TODO(devoncarew): We should pare this class down, and move some of its functionality into FlutterTestUtils.
// From //intellij-plugins/Dart/testSrc/com/jetbrains/lang/dart/util/DartTestUtils.java
public class DartTestUtils {
public static final String BASE_TEST_DATA_PATH = findTestDataPath();
public static final String SDK_HOME_PATH = BASE_TEST_DATA_PATH + "/sdk";
@SuppressWarnings("Duplicates")
private static String findTestDataPath() {
if (new File(PathManager.getHomePath() + "/contrib").isDirectory()) {
// started from IntelliJ IDEA Ultimate project
return FileUtil.toSystemIndependentName(PathManager.getHomePath() + "/contrib/Dart/testData");
}
final File f = new File("testData");
if (f.isDirectory()) {
// started from 'Dart-plugin' project
return FileUtil.toSystemIndependentName(f.getAbsolutePath());
}
final String parentPath = PathUtil.getParentPath(PathManager.getHomePath());
if (new File(parentPath + "/intellij-plugins").isDirectory()) {
// started from IntelliJ IDEA Community Edition + Dart Plugin project
return FileUtil.toSystemIndependentName(parentPath + "/intellij-plugins/Dart/testData");
}
if (new File(parentPath + "/contrib").isDirectory()) {
// started from IntelliJ IDEA Community + Dart Plugin project
return FileUtil.toSystemIndependentName(parentPath + "/contrib/Dart/testData");
}
return "";
}
@SuppressWarnings("Duplicates")
public static void configureDartSdk(@NotNull final Module module, @NotNull final Disposable disposable, final boolean realSdk) {
final String sdkHome;
if (realSdk) {
sdkHome = System.getProperty("dart.sdk");
if (sdkHome == null) {
Assert.fail("To run tests that use Dart Analysis Server you need to add '-Ddart.sdk=[real SDK home]' to the VM Options field of " +
"the corresponding JUnit run configuration (Run | Edit Configurations)");
}
if (!DartPlugin.isDartSdkHome(sdkHome)) {
Assert.fail("Incorrect path to the Dart SDK (" + sdkHome + ") is set as '-Ddart.sdk' VM option of " +
"the corresponding JUnit run configuration (Run | Edit Configurations)");
}
VfsRootAccess.allowRootAccess(disposable, sdkHome);
// Dart Analysis Server threads
ThreadTracker.longRunningThreadCreated(ApplicationManager.getApplication(),
"ByteRequestSink.LinesWriterThread",
"ByteResponseStream.LinesReaderThread",
"RemoteAnalysisServerImpl watcher",
"ServerErrorReaderThread",
"ServerResponseReaderThread");
}
else {
sdkHome = SDK_HOME_PATH;
}
ApplicationManager.getApplication().runWriteAction(() -> {
DartPlugin.ensureDartSdkConfigured(module.getProject(), sdkHome);
DartPlugin.enableDartSdk(module);
});
Disposer.register(disposable, () -> ApplicationManager.getApplication().runWriteAction(() -> {
if (!module.isDisposed()) {
DartPlugin.disableDartSdk(Collections.singletonList(module));
}
final ApplicationLibraryTable libraryTable = ApplicationLibraryTable.getApplicationTable();
final Library library = libraryTable.getLibraryByName(DartSdk.DART_SDK_LIB_NAME);
if (library != null) {
libraryTable.removeLibrary(library);
}
}));
}
}
| flutter-intellij/flutter-idea/third_party/intellij-plugins-dart/testSrc/com/jetbrains/lang/dart/util/DartTestUtils.java/0 | {
"file_path": "flutter-intellij/flutter-idea/third_party/intellij-plugins-dart/testSrc/com/jetbrains/lang/dart/util/DartTestUtils.java",
"repo_id": "flutter-intellij",
"token_count": 1667
} | 625 |
/*
* Copyright (c) 2015, the Dart project authors.
*
* Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.dartlang.vm.service.consumer;
// This file is generated by the script: pkg/vm_service/tool/generate.dart in dart-lang/sdk.
import org.dartlang.vm.service.element.CpuSamples;
@SuppressWarnings({"WeakerAccess", "unused"})
public interface CpuSamplesConsumer extends Consumer {
void received(CpuSamples response);
}
| flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/consumer/CpuSamplesConsumer.java/0 | {
"file_path": "flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/consumer/CpuSamplesConsumer.java",
"repo_id": "flutter-intellij",
"token_count": 261
} | 626 |
/*
* Copyright (c) 2015, the Dart project authors.
*
* Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.dartlang.vm.service.element;
// This file is generated by the script: pkg/vm_service/tool/generate.dart in dart-lang/sdk.
import com.google.gson.JsonObject;
/**
* Represents the value of a single isolate flag. See Isolate.
*/
@SuppressWarnings({"WeakerAccess", "unused"})
public class IsolateFlag extends Element {
public IsolateFlag(JsonObject json) {
super(json);
}
/**
* The name of the flag.
*/
public String getName() {
return getAsString("name");
}
/**
* The value of this flag as a string.
*/
public String getValueAsString() {
return getAsString("valueAsString");
}
}
| flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/IsolateFlag.java/0 | {
"file_path": "flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/IsolateFlag.java",
"repo_id": "flutter-intellij",
"token_count": 371
} | 627 |
/*
* Copyright (c) 2015, the Dart project authors.
*
* Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.dartlang.vm.service.element;
// This file is generated by the script: pkg/vm_service/tool/generate.dart in dart-lang/sdk.
import com.google.gson.JsonObject;
/**
* A {@link Parameter} is a representation of a function parameter.
*/
@SuppressWarnings({"WeakerAccess", "unused"})
public class Parameter extends Element {
public Parameter(JsonObject json) {
super(json);
}
/**
* Represents whether or not this parameter is fixed or optional.
*/
public boolean getFixed() {
return getAsBoolean("fixed");
}
/**
* The name of a named optional parameter.
*
* Can return <code>null</code>.
*/
public String getName() {
return getAsString("name");
}
/**
* The type of the parameter.
*/
public InstanceRef getParameterType() {
return new InstanceRef((JsonObject) json.get("parameterType"));
}
/**
* Whether or not this named optional parameter is marked as required.
*
* Can return <code>null</code>.
*/
public boolean getRequired() {
return getAsBoolean("required");
}
}
| flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/Parameter.java/0 | {
"file_path": "flutter-intellij/flutter-idea/third_party/vmServiceDrivers/org/dartlang/vm/service/element/Parameter.java",
"repo_id": "flutter-intellij",
"token_count": 506
} | 628 |
<?xml version="1.0" encoding="UTF-8"?>
<module type="PLUGIN_MODULE" version="4">
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/resources/META-INF/plugin.xml" />
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/testSrc/unit" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/testSrc/integration" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/third_party/intellij-plugins-dart/testSrc" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/third_party/vmServiceDrivers" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/testData" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/flutter-idea/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/flutter-idea/testSrc/unit" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/flutter-idea/third_party/vmServiceDrivers" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/flutter-studio/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/artifacts" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/testData/sample_tests/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/testData/sample_tests/.pub" />
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/testData/sample_tests/build" />
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/testData/sample_tests/test" />
<excludeFolder url="file://$MODULE_DIR$/out/production/flutter-intellij/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/out/production/flutter-intellij/.pub" />
<excludeFolder url="file://$MODULE_DIR$/out/production/flutter-intellij/build" />
<excludeFolder url="file://$MODULE_DIR$/out/test/flutter-intellij/sample_tests/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/out/test/flutter-intellij/sample_tests/.pub" />
<excludeFolder url="file://$MODULE_DIR$/out/test/flutter-intellij/sample_tests/build" />
<excludeFolder url="file://$MODULE_DIR$/src/main" />
<excludeFolder url="file://$MODULE_DIR$/testData" />
<excludeFolder url="file://$MODULE_DIR$/testData/sample_tests/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/testData/sample_tests/.pub" />
<excludeFolder url="file://$MODULE_DIR$/testData/sample_tests/build" />
<excludeFolder url="file://$MODULE_DIR$/tool/icon_generator/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/tool/icon_generator/.pub" />
<excludeFolder url="file://$MODULE_DIR$/tool/icon_generator/build" />
<excludeFolder url="file://$MODULE_DIR$/tool/plugin/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/tool/plugin/.pub" />
<excludeFolder url="file://$MODULE_DIR$/tool/plugin/build" />
<excludeFolder url="file://$MODULE_DIR$/flutter-gui-tests" />
<excludeFolder url="file://$MODULE_DIR$/releases" />
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/artifacts" />
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/build" />
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/resources" />
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/testData" />
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/third_party/intellij-plugins-dart" />
<excludeFolder url="file://$MODULE_DIR$/flutter-studio/build" />
<excludeFolder url="file://$MODULE_DIR$/flutter-studio/resources" />
<excludeFolder url="file://$MODULE_DIR$/flutter-studio/testData" />
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/testSrc/integration" />
<excludeFolder url="file://$MODULE_DIR$/flutter-studio/testSrc" />
<excludeFolder url="file://$MODULE_DIR$/flutter-studio/src/io/flutter/module" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="org.apache.commons:commons-lang3:3.9" type="repository">
<properties maven-id="org.apache.commons:commons-lang3:3.9" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9-sources.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module" module-name="intellij.android.core" />
<orderEntry type="library" name="studio-analytics-proto" level="project" />
<orderEntry type="module" module-name="intellij.android.gradle.dsl" />
<orderEntry type="module" module-name="intellij.android.projectSystem" />
<orderEntry type="module" module-name="intellij.android.observable" />
<orderEntry type="module" module-name="intellij.android.observable" />
<orderEntry type="library" name="studio-plugin-git4idea" level="project" />
<orderEntry type="library" name="studio-plugin-yaml" level="project" />
<orderEntry type="library" name="studio-plugin-gradle" level="project" />
<orderEntry type="library" name="studio-sdk" level="project" />
<orderEntry type="module" module-name="intellij.android.common" />
<orderEntry type="library" name="mockito" level="project" />
<orderEntry type="module" module-name="assistant" />
<orderEntry type="module" module-name="intellij.android.newProjectWizard" />
<orderEntry type="module" module-name="intellij.android.wizard" />
<orderEntry type="module" module-name="intellij.android.wizard.model" />
<orderEntry type="module" module-name="intellij.platform.ide" />
<orderEntry type="module" module-name="intellij.platform.lang" />
<orderEntry type="module" module-name="intellij.platform.lang.impl" />
<orderEntry type="module" module-name="intellij.platform.debugger" />
<orderEntry type="module" module-name="intellij.platform.debugger.impl" />
<orderEntry type="module" module-name="intellij.platform.externalSystem.impl" />
<orderEntry type="module" module-name="intellij.platform.externalSystem.rt" />
<orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
<orderEntry type="library" name="Velocity" level="project" />
<orderEntry type="module" module-name="intellij.platform.smRunner" />
<orderEntry type="module" module-name="intellij.xml.impl" />
<orderEntry type="module" module-name="intellij.java.ui" />
<orderEntry type="module" module-name="intellij.java.psi.impl" />
<orderEntry type="module-library">
<library name="org.apache.commons:commons-lang3:3.9" type="repository">
<properties maven-id="org.apache.commons:commons-lang3:3.9" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9-sources.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module" module-name="intellij.android.core" />
<orderEntry type="module" module-name="intellij.platform.externalSystem" />
<orderEntry type="module" module-name="intellij.gradle.common" />
<orderEntry type="module" module-name="intellij.java.compiler.impl" />
<orderEntry type="module" module-name="intellij.platform.serviceContainer" />
<orderEntry type="module" module-name="intellij.android.gradle.dsl" />
<orderEntry type="module" module-name="intellij.android.projectSystem" />
<orderEntry type="module" module-name="intellij.vcs.git.rt" />
<orderEntry type="module" module-name="intellij.platform.vcs" />
<orderEntry type="module" module-name="intellij.vcs.git" />
<orderEntry type="module" module-name="intellij.platform.ide.util.io" />
<orderEntry type="module" module-name="intellij.platform.core.ui" />
<orderEntry type="module" module-name="intellij.platform.util.classLoader" />
<orderEntry type="module" module-name="intellij.platform.coverage" />
<orderEntry type="module" module-name="intellij.android.common" />
<orderEntry type="library" name="snakeyaml-1.29" level="project" />
<orderEntry type="library" name="miglayout-swing" level="project" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/third_party/lib/dart-plugin/deps/json.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/third_party/lib/dart-plugin/deps/weberknecht-0.1.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/third_party/lib/java-string-similarity-2.0.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/third_party/lib/jxbrowser/jxbrowser-7.22.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/third_party/lib/jxbrowser/jxbrowser-swing-7.22.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/third_party/lib/dart-plugin/221/Dart.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module" module-name="intellij.android.projectSystem.gradle" />
<orderEntry type="module" module-name="intellij.android.adt.ui" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/artifacts/Dart-221.4501.155.zip!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module> | flutter-intellij/flutter-intellij-community.iml/0 | {
"file_path": "flutter-intellij/flutter-intellij-community.iml",
"repo_id": "flutter-intellij",
"token_count": 4517
} | 629 |
/*
* Copyright 2017 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package com.android.tools.idea.tests.gui.framework.fixture;
import static com.android.tools.idea.gradle.util.BuildMode.ASSEMBLE;
import static com.android.tools.idea.gradle.util.BuildMode.SOURCE_GEN;
import static com.android.tools.idea.gradle.util.GradleUtil.getGradleBuildFile;
import static com.android.tools.idea.tests.gui.framework.GuiTests.waitForBackgroundTasks;
import static com.android.tools.idea.tests.gui.framework.GuiTests.waitUntilShowingAndEnabled;
import static com.android.tools.idea.tests.gui.framework.UiTestUtilsKt.waitForIdle;
import static com.android.tools.idea.ui.GuiTestingService.EXECUTE_BEFORE_PROJECT_BUILD_IN_GUI_TEST_KEY;
import static com.google.common.base.Preconditions.checkArgument;
import static java.awt.event.InputEvent.CTRL_MASK;
import static java.awt.event.InputEvent.META_MASK;
import static org.fest.swing.edt.GuiActionRunner.execute;
import static org.jetbrains.plugins.gradle.settings.DistributionType.LOCAL;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import com.android.tools.idea.gradle.dsl.api.GradleBuildModel;
import com.android.tools.idea.gradle.project.build.BuildStatus;
import com.android.tools.idea.gradle.project.build.GradleBuildContext;
import com.android.tools.idea.gradle.project.build.GradleBuildState;
import com.android.tools.idea.gradle.project.build.PostProjectBuildTasksExecutor;
import com.android.tools.idea.gradle.project.build.compiler.AndroidGradleBuildConfiguration;
import com.android.tools.idea.gradle.project.build.invoker.GradleInvocationResult;
import com.android.tools.idea.gradle.project.model.AndroidModuleModel;
import com.android.tools.idea.gradle.project.sync.GradleSyncState;
import com.android.tools.idea.gradle.util.BuildMode;
import com.android.tools.idea.gradle.util.GradleProjectSettingsFinder;
import com.android.tools.idea.model.AndroidModel;
import com.android.tools.idea.project.AndroidProjectBuildNotifications;
import com.android.tools.idea.run.ui.ApplyChangesAction;
import com.android.tools.idea.run.ui.CodeSwapAction;
import com.android.tools.idea.testing.TestModuleUtil;
import com.android.tools.idea.tests.gui.framework.GuiTests;
import com.android.tools.idea.tests.gui.framework.fixture.avdmanager.AvdManagerDialogFixture;
import com.android.tools.idea.tests.gui.framework.fixture.gradle.GradleBuildModelFixture;
import com.android.tools.idea.tests.gui.framework.fixture.gradle.GradleProjectEventListener;
import com.android.tools.idea.tests.gui.framework.fixture.gradle.GradleToolWindowFixture;
import com.android.tools.idea.tests.gui.framework.fixture.run.deployment.DeviceSelectorFixture;
import com.android.tools.idea.tests.gui.framework.matcher.Matchers;
import com.google.common.collect.Lists;
import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.actions.RunConfigurationsComboBoxAction;
import com.intellij.ide.actions.ShowSettingsUtilImpl;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.actionSystem.impl.ActionButton;
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.externalSystem.model.ExternalSystemException;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ThreeComponentsSplitter;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.impl.IdeFrameImpl;
import com.intellij.openapi.wm.impl.StripeButton;
import com.intellij.openapi.wm.impl.ToolWindowsPane;
import com.intellij.util.ThreeState;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.KeyboardFocusManager;
import java.awt.Point;
import java.awt.event.KeyEvent;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import javax.swing.JDialog;
import javax.swing.JLabel;
import org.fest.swing.core.GenericTypeMatcher;
import org.fest.swing.core.Robot;
import org.fest.swing.core.WindowAncestorFinder;
import org.fest.swing.edt.GuiQuery;
import org.fest.swing.edt.GuiTask;
import org.fest.swing.fixture.DialogFixture;
import org.fest.swing.fixture.JToggleButtonFixture;
import org.fest.swing.timing.Wait;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings;
// Changes from original IdeFrameFixture
// Added field: myIdeFrameFixture
// @NotNull private IdeFrameFixture myIdeFrameFixture;
// myIdeFrameFixture = IdeFrameFixture.find(robot); // in constructor
// Change method return type: IdeFrame -> IdeaFrame
// Change argument value: this -> myIdeFrameFixture
// Change constructor visibility: protected
// Change type: WelcomeFrameFixture -> FlutterWelcomeFrameFixture
// Change generic: IdeFrameFixture -> IdeaFrameFixture
@SuppressWarnings({"UnusedReturnValue", "unused", "SameParameterValue"})
public class IdeaFrameFixture extends ComponentFixture<IdeaFrameFixture, IdeFrameImpl> {
private EditorFixture myEditor;
private boolean myIsClosed;
@NotNull private IdeFrameFixture myIdeFrameFixture;
@NotNull
public static IdeaFrameFixture find(@NotNull final Robot robot) {
return new IdeaFrameFixture(robot, GuiTests.waitUntilShowing(robot, Matchers.byType(IdeFrameImpl.class)));
}
protected IdeaFrameFixture(@NotNull Robot robot, @NotNull IdeFrameImpl target) {
super(IdeaFrameFixture.class, robot, target);
myIdeFrameFixture = IdeFrameFixture.find(robot);
}
@NotNull
public File getProjectPath() {
return new File(target().getProject().getBasePath());
}
@NotNull
public List<String> getModuleNames() {
List<String> names = Lists.newArrayList();
for (Module module : getModuleManager().getModules()) {
names.add(module.getName());
}
return names;
}
@NotNull
public AndroidModuleModel getAndroidProjectForModule(@NotNull String name) {
Module module = getModule(name);
AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null && AndroidModel.isRequired(facet)) {
// TODO: Resolve direct AndroidGradleModel dep (b/22596984)
AndroidModuleModel androidModel = AndroidModuleModel.get(facet);
if (androidModel != null) {
return androidModel;
}
}
throw new AssertionError("Unable to find AndroidGradleModel for module '" + name + "'");
}
@NotNull
public Module getModule(@NotNull String name) {
return TestModuleUtil.findModule(getProject(), name);
}
public boolean hasModule(@NotNull String name) {
return TestModuleUtil.hasModule(getProject(), name);
}
@NotNull
private ModuleManager getModuleManager() {
return ModuleManager.getInstance(getProject());
}
@NotNull
public EditorFixture getEditor() {
if (myEditor == null) {
myEditor = new EditorFixture(robot(), myIdeFrameFixture);
}
return myEditor;
}
@NotNull
public BuildStatus invokeProjectMake() {
return invokeProjectMake(null);
}
@NotNull
public BuildStatus invokeProjectMake(@Nullable Wait wait) {
return actAndWaitForBuildToFinish(wait, it -> it.waitAndInvokeMenuPath("Build", "Make Project"));
}
@NotNull
public IdeaFrameFixture invokeProjectMakeAndSimulateFailure(@NotNull String failure) {
Runnable failTask = () -> {
throw new ExternalSystemException(failure);
};
ApplicationManager.getApplication().putUserData(EXECUTE_BEFORE_PROJECT_BUILD_IN_GUI_TEST_KEY, failTask);
waitAndInvokeMenuPath("Build", "Make Project");
return this;
}
@NotNull
public ThreeComponentsSplitterFixture findToolWindowSplitter() {
ToolWindowsPane toolWindowsPane = GuiTests.waitUntilFound(robot(), target(), Matchers.byType(ToolWindowsPane.class));
ThreeComponentsSplitter splitter = (ThreeComponentsSplitter)toolWindowsPane.getLayeredPane().getComponent(0);
return new ThreeComponentsSplitterFixture(robot(), splitter);
}
/**
* Finds the Run button in the IDE interface.
*
* @return ActionButtonFixture for the run button.
*/
@NotNull
public ActionButtonFixture findDebugApplicationButton() {
return findActionButtonWithRefresh("Debug");
}
@NotNull
public ActionButtonFixture findRunApplicationButton() {
return findActionButtonWithRefresh("Run");
}
@NotNull
public ActionButtonFixture findStopButton() {
return findActionButtonWithRefresh(ExecutionBundle.message("run.configuration.stop.action.name"));
}
@NotNull
public ActionButtonFixture findApplyChangesButton(boolean enabled) {
return findActionButtonWithRefresh(ApplyChangesAction.ID, enabled);
}
@NotNull
public ActionButtonFixture findApplyCodeChangesButton(boolean enabled) {
return findActionButtonWithRefresh(CodeSwapAction.ID, enabled);
}
@NotNull
public ActionButtonFixture findAttachDebuggerToAndroidProcessButton() {
GenericTypeMatcher<ActionButton> matcher = Matchers.byText(ActionButton.class, "Attach Debugger to Android Process").andIsShowing();
return ActionButtonFixture.findByMatcher(matcher, robot(), target());
}
@NotNull
public IdeaFrameFixture selectDevice(@NotNull String device) {
new DeviceSelectorFixture(robot(), myIdeFrameFixture).selectItem(device);
return this;
}
public void troubleshootDeviceConnections(@NotNull String appName) {
new DeviceSelectorFixture(robot(), myIdeFrameFixture).troubleshootDeviceConnections(appName);
}
@NotNull
public IdeaFrameFixture recordEspressoTest(@NotNull String device) {
new DeviceSelectorFixture(robot(), myIdeFrameFixture).recordEspressoTest(device);
return this;
}
public void debugApp(@NotNull String appName, @NotNull String deviceName) {
debugApp(appName, deviceName, null);
}
public void debugApp(@NotNull String appName, @NotNull String deviceName, @Nullable Wait wait) {
new DeviceSelectorFixture(robot(), myIdeFrameFixture).debugApp(appName, deviceName);
waitForIdle();
waitForBackgroundTasks(robot(), wait);
waitForIdle();
}
public void runApp(@NotNull String appName, @NotNull String deviceName) {
runApp(appName, deviceName, null);
}
public void runApp(@NotNull String appName, @NotNull String deviceName, @Nullable Wait wait) {
new DeviceSelectorFixture(robot(), myIdeFrameFixture).runApp(appName, deviceName);
waitForIdle();
waitForBackgroundTasks(robot(), wait);
waitForIdle();
}
@NotNull
public IdeaFrameFixture stopApp() {
return invokeMenuPath("Run", "Stop \'app\'");
}
@NotNull
public IdeaFrameFixture stopAll() {
invokeMenuPath("Run", "Stop...");
robot().pressAndReleaseKey(KeyEvent.VK_F2, CTRL_MASK); // Stop All (Ctrl + F2)
return this;
}
@NotNull
public IdeaFrameFixture stepOver() {
return invokeMenuPath("Run", "Step Over");
}
@NotNull
public IdeaFrameFixture smartStepInto() {
return invokeMenuPath("Run", "Smart Step Into");
}
@NotNull
public IdeaFrameFixture resumeProgram() {
return invokeMenuPath("Run", "Resume Program");
}
@NotNull
public RunToolWindowFixture getRunToolWindow() {
return new RunToolWindowFixture(myIdeFrameFixture);
}
@NotNull
public DebugToolWindowFixture getDebugToolWindow() {
return new DebugToolWindowFixture(myIdeFrameFixture);
}
/**
* Selects the item at {@code menuPath} and returns the result of {@code fixtureFunction} applied to this {@link IdeFrameFixture}.
*/
public <T> T openFromMenu(Function<IdeaFrameFixture, T> fixtureFunction, @NotNull String... menuPath) {
getMenuFixture().invokeMenuPath(10, menuPath);
return fixtureFunction.apply(this);
}
/**
* Selects the item at {@code menuPath} in a contextual menu
* and returns the result of {@code fixtureFunction} applied to this {@link IdeFrameFixture}.
*/
public <T> T openFromContextualMenu(Function<IdeFrameFixture, T> fixtureFunction, @NotNull String... menuPath) {
getMenuFixture().invokeContextualMenuPath(menuPath);
return fixtureFunction.apply(myIdeFrameFixture);
}
/**
* Invokes an action by menu path
*
* @param path the series of menu names, e.g. {@link invokeActionByMenuPath("Build", "Make Project")}
*/
public IdeaFrameFixture invokeMenuPath(@NotNull String... path) {
getMenuFixture().invokeMenuPath(10, path);
return this;
}
/**
* Wait till an path is enabled then invokes the action. Used for menu options that might be disabled or not available at first
*
* @param path the series of menu names, e.g. {@link invokeActionByMenuPath("Build", "Make Project")}
*/
public IdeaFrameFixture waitAndInvokeMenuPath(@NotNull String... path) {
waitAndInvokeMenuPath(10, path);
return this;
}
private IdeaFrameFixture waitAndInvokeMenuPath(int timeToWait, @NotNull String... path) {
getMenuFixture().invokeMenuPath(timeToWait, path);
return this;
}
@NotNull
private MenuFixture getMenuFixture() {
return new MenuFixture(robot(), target());
}
@NotNull
public IdeaFrameFixture invokeAndWaitForBuildAction(@NotNull String... menuPath) {
return invokeAndWaitForBuildAction(null, menuPath);
}
@NotNull
public IdeaFrameFixture invokeAndWaitForBuildAction(@Nullable Wait wait, @NotNull String... menuPath) {
assertTrue("Build failed", actAndWaitForBuildToFinish(wait, it -> it.waitAndInvokeMenuPath(menuPath)).isBuildSuccessful());
return this;
}
public BuildStatus actAndWaitForBuildToFinish(@NotNull Consumer<IdeFrameFixture> actions) {
return actAndWaitForBuildToFinish(null, actions);
}
public BuildStatus actAndWaitForBuildToFinish(@Nullable Wait wait, @NotNull Consumer<IdeFrameFixture> actions) {
GradleProjectEventListener gradleProjectEventListener = new GradleProjectEventListener();
Disposable disposable = Disposer.newDisposable();
try {
GradleBuildState.subscribe(getProject(), gradleProjectEventListener, disposable);
long beforeStartedTimeStamp = System.currentTimeMillis();
Project project = getProject();
actions.accept(myIdeFrameFixture);
(wait != null ? wait : Wait.seconds(60))
.expecting("build '" + project.getName() + "' to finish")
.until(() -> gradleProjectEventListener.getLastBuildTimestamp() > beforeStartedTimeStamp);
GuiTests.waitForProjectIndexingToFinish(getProject());
GuiTests.waitForBackgroundTasks(robot());
waitForIdle();
return gradleProjectEventListener.getBuildStatus();
}
finally {
Disposer.dispose(disposable);
}
}
/**
* Returns the virtual file corresponding to the given path. The path must be relative to the project root directory
* (the top-level directory containing all source files associated with the project).
*
* @param relativePath a file path relative to the project root directory
* @return the virtual file corresponding to {@code relativePath}, or {@code null} if no such file exists
*/
@Nullable
public VirtualFile findFileByRelativePath(@NotNull String relativePath) {
checkArgument(!relativePath.contains("\\"), "Should use '/' in test relative paths, not File.separator");
VirtualFile projectRootDir = getProject().getBaseDir();
projectRootDir.refresh(false, true);
return projectRootDir.findFileByRelativePath(relativePath);
}
public void requestProjectSync() {
GuiTests.waitForBackgroundTasks(robot(), null);
waitAndInvokeMenuPath(20, "File", "Sync Project with Gradle Files");
}
@NotNull
public IdeaFrameFixture requestProjectSyncAndWaitForSyncToFinish() {
return actAndWaitForGradleProjectSyncToFinish(it -> it.requestProjectSync());
}
@NotNull
public IdeaFrameFixture requestProjectSyncAndWaitForSyncToFinish(@NotNull Wait waitSync) {
return actAndWaitForGradleProjectSyncToFinish(waitSync, it -> it.requestProjectSync());
}
public boolean isGradleSyncNotNeeded() {
return GradleSyncState.getInstance(getProject()).isSyncNeeded() == ThreeState.NO;
}
@NotNull
public IdeaFrameFixture actAndWaitForGradleProjectSyncToFinish(@NotNull Consumer<IdeaFrameFixture> actions) {
return actAndWaitForGradleProjectSyncToFinish(null, actions);
}
@NotNull
public IdeaFrameFixture actAndWaitForGradleProjectSyncToFinish(@Nullable Wait waitForSync,
@NotNull Consumer<IdeaFrameFixture> actions) {
return actAndWaitForGradleProjectSyncToFinish(
waitForSync,
() -> {
actions.accept(this);
return this;
}
);
}
@NotNull
public static IdeaFrameFixture actAndWaitForGradleProjectSyncToFinish(@NotNull Supplier<? extends IdeaFrameFixture> actions) {
return actAndWaitForGradleProjectSyncToFinish(null, actions);
}
public static IdeaFrameFixture actAndWaitForGradleProjectSyncToFinish(@Nullable Wait waitForSync,
@NotNull Supplier<? extends IdeaFrameFixture> ideFrame) {
long beforeStartedTimeStamp = System.currentTimeMillis();
IdeaFrameFixture ideFixture = ideFrame.get();
Project project = ideFixture.getProject();
// Wait for indexing to complete to add additional waiting time if indexing (up to 120 seconds). Otherwise, sync timeout may expire
// too soon.
GuiTests.waitForProjectIndexingToFinish(ideFixture.getProject());
(waitForSync != null ? waitForSync : Wait.seconds(60))
.expecting("syncing project '" + project.getName() + "' to finish")
.until(() -> GradleSyncState.getInstance(project).getLastSyncFinishedTimeStamp() > beforeStartedTimeStamp);
if (GradleSyncState.getInstance(project).lastSyncFailed()) {
fail("Sync failed. See logs.");
}
GuiTests.waitForProjectIndexingToFinish(ideFixture.getProject());
waitForIdle();
// Wait for other tasks like native sync that might have been triggered.
GuiTests.waitForBackgroundTasks(ideFixture.robot());
waitForIdle();
return ideFixture;
}
@NotNull
private ActionButtonFixture locateActionButtonByActionId(@NotNull String actionId) {
return ActionButtonFixture.locateByActionId(actionId, robot(), target(), 30);
}
/**
* IJ doesn't always refresh the state of the toolbar buttons. This forces it to refresh.
*/
@NotNull
public IdeaFrameFixture updateToolbars() {
execute(new GuiTask() {
@Override
protected void executeInEDT() {
ActionToolbarImpl.updateAllToolbarsImmediately();
}
});
return this;
}
/**
* ActionButtons while being recreated by IJ and queried through the Action system
* may not have a proper parent. Therefore, we can not rely on FEST's system of
* checking the component tree, as that will cause the test to immediately fail.
*/
private static boolean hasValidWindowAncestor(@NotNull Component target) {
return execute(new GuiQuery<Boolean>() {
@Nullable
@Override
protected Boolean executeInEDT() {
return WindowAncestorFinder.windowAncestorOf(target) != null;
}
});
}
/**
* Finds the button while refreshing over the toolbar.
* <p>
* Due to IJ refresh policy (will only refresh if it detects mouse movement over its window),
* the toolbar needs to be intermittently updated before the ActionButton moves to the target
* location and update to its final state.
*/
@NotNull
private ActionButtonFixture findActionButtonWithRefresh(@NotNull String actionId, boolean enabled) {
Ref<ActionButtonFixture> fixtureRef = new Ref<>();
Wait.seconds(30)
.expecting("button to enable")
.until(() -> {
updateToolbars();
// Actions can somehow get replaced, so we need to re-get the action when we attempt to check its state.
ActionButtonFixture fixture = locateActionButtonByActionId(actionId);
fixtureRef.set(fixture);
if (hasValidWindowAncestor(fixture.target())) {
return execute(new GuiQuery<Boolean>() {
@Nullable
@Override
protected Boolean executeInEDT() {
if (WindowAncestorFinder.windowAncestorOf(fixture.target()) != null) {
ActionButton button = fixture.target();
AnAction action = button.getAction();
Presentation presentation = action.getTemplatePresentation();
return presentation.isEnabledAndVisible() &&
button.isEnabled() == enabled &&
button.isShowing() &&
button.isVisible();
}
return false;
}
});
}
return false;
});
return fixtureRef.get();
}
@NotNull
private ActionButtonFixture findActionButtonWithRefresh(@NotNull String actionId) {
return findActionButtonWithRefresh(actionId, true);
}
@NotNull
private ActionButtonFixture findActionButtonByActionId(String actionId, long secondsToWait) {
return ActionButtonFixture.findByActionId(actionId, robot(), target(), secondsToWait);
}
@NotNull
public AndroidLogcatToolWindowFixture getAndroidLogcatToolWindow() {
return new AndroidLogcatToolWindowFixture(getProject(), robot());
}
@NotNull
public BuildVariantsToolWindowFixture getBuildVariantsWindow() {
return new BuildVariantsToolWindowFixture(myIdeFrameFixture);
}
@NotNull
public BuildToolWindowFixture getBuildToolWindow() {
return new BuildToolWindowFixture(getProject(), robot());
}
@NotNull
public GradleToolWindowFixture getGradleToolWindow() {
return new GradleToolWindowFixture(getProject(), robot());
}
@NotNull
public IdeSettingsDialogFixture openIdeSettings() {
// Using invokeLater because we are going to show a *modal* dialog via API (instead of clicking a button, for example.) If we use
// GuiActionRunner the test will hang until the modal dialog is closed.
ApplicationManager.getApplication().invokeLater(
() -> {
Project project = getProject();
ShowSettingsUtil.getInstance().showSettingsDialog(project, ShowSettingsUtilImpl.getConfigurableGroups(project, true));
});
IdeSettingsDialogFixture settings = IdeSettingsDialogFixture.find(robot());
robot().waitForIdle();
return settings;
}
@NotNull
public IdeaFrameFixture useLocalGradleDistribution(@NotNull File gradleHomePath) {
return useLocalGradleDistribution(gradleHomePath.getPath());
}
@NotNull
public IdeaFrameFixture useLocalGradleDistribution(@NotNull String gradleHome) {
GradleProjectSettings settings = getGradleSettings();
settings.setDistributionType(LOCAL);
settings.setGradleHome(gradleHome);
return this;
}
@NotNull
public GradleProjectSettings getGradleSettings() {
return GradleProjectSettingsFinder.getInstance().findGradleProjectSettings(getProject());
}
@NotNull
public AvdManagerDialogFixture invokeAvdManager() {
// The action button is prone to move during rendering so that robot.click() could miss.
// So, we use component's click here directly.
ActionButtonFixture actionButtonFixture = findActionButtonByActionId("Android.RunAndroidAvdManager", 30);
execute(new GuiTask() {
@Override
protected void executeInEDT() {
actionButtonFixture.target().click();
}
});
return AvdManagerDialogFixture.find(robot(), myIdeFrameFixture);
}
@NotNull
public IdeSettingsDialogFixture invokeSdkManager() {
ActionButton sdkButton = waitUntilShowingAndEnabled(robot(), target(), new GenericTypeMatcher<ActionButton>(ActionButton.class) {
@Override
protected boolean isMatching(@NotNull ActionButton actionButton) {
return "SDK Manager".equals(actionButton.getAccessibleContext().getAccessibleName());
}
});
robot().click(sdkButton);
return IdeSettingsDialogFixture.find(robot());
}
@NotNull
public ProjectViewFixture getProjectView() {
return new ProjectViewFixture(myIdeFrameFixture);
}
@NotNull
public Project getProject() {
return target().getProject();
}
public FlutterWelcomeFrameFixture closeProject() {
myIsClosed = true;
requestFocusIfLost(); // "Close Project" can be disabled if no component has focus
return openFromMenu(FlutterWelcomeFrameFixture::find, "File", "Close Project");
}
public boolean isClosed() {
return myIsClosed;
}
@NotNull
public MessagesFixture findMessageDialog(@NotNull String title) {
return MessagesFixture.findByTitle(robot(), title);
}
@NotNull
public DialogFixture waitForDialog(@NotNull String title) {
return new DialogFixture(robot(), GuiTests.waitUntilShowing(robot(), Matchers.byTitle(JDialog.class, title)));
}
@NotNull
public DialogFixture waitForDialog(@NotNull String title, long secondsToWait) {
return new DialogFixture(robot(), GuiTests.waitUntilShowing(robot(), null, Matchers.byTitle(JDialog.class, title), secondsToWait));
}
@NotNull
public GradleBuildModelFixture parseBuildFileForModule(@NotNull String moduleName) {
Module module = getModule(moduleName);
VirtualFile buildFile = getGradleBuildFile(module);
Ref<GradleBuildModel> buildModelRef = new Ref<>();
ReadAction.run(() -> buildModelRef.set(GradleBuildModel.parseBuildFile(buildFile, getProject())));
return new GradleBuildModelFixture(buildModelRef.get());
}
private static class NoOpDisposable implements Disposable {
@Override
public void dispose() {
}
}
public void selectApp(@NotNull String appName) {
ActionButtonFixture runButton = findRunApplicationButton();
Container actionToolbarContainer = GuiQuery.getNonNull(() -> runButton.target().getParent());
ComboBoxActionFixture comboBoxActionFixture = ComboBoxActionFixture.findComboBoxByClientPropertyAndText(
robot(),
actionToolbarContainer,
"styleCombo",
RunConfigurationsComboBoxAction.class,
appName);
comboBoxActionFixture.selectItem(appName);
robot().pressAndReleaseKey(KeyEvent.VK_ENTER);
Wait.seconds(1).expecting("ComboBox to be selected").until(() -> appName.equals(comboBoxActionFixture.getSelectedItemText()));
}
/**
* Gets the focus back to Android Studio if it was lost
*/
public void requestFocusIfLost() {
KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
Wait.seconds(5).expecting("a component to have the focus").until(() -> {
// Keep requesting focus until it is obtained by a component which is showing. Since there is no guarantee that the request focus will
// be granted keep asking until it is. This problem has appeared at least when not using a window manager when running tests. The focus
// can sometimes temporarily be held by a component that is not showing, when closing a dialog for example. This is a transition state
// and we want to make sure to keep going until the focus is held by a stable component.
Component focusOwner = keyboardFocusManager.getFocusOwner();
if (focusOwner == null || !focusOwner.isShowing()) {
if (SystemInfo.isMac) {
robot().click(target(), new Point(1, 1)); // Simulate title bar click
}
GuiTask.execute(() -> target().requestFocus());
return false;
}
return true;
});
}
public void selectPreviousEditor() {
robot().pressAndReleaseKey(KeyEvent.VK_E, SystemInfo.isMac ? META_MASK : CTRL_MASK);
GuiTests.waitUntilShowing(robot(), new GenericTypeMatcher<JLabel>(JLabel.class) {
@Override
protected boolean isMatching(@NotNull JLabel header) {
return Objects.equals(header.getText(), "Recent Files");
}
});
robot().pressAndReleaseKey(KeyEvent.VK_ENTER, 0);
}
@NotNull
public Dimension getIdeFrameSize() {
return target().getSize();
}
@NotNull
@SuppressWarnings("UnusedReturnValue")
public IdeaFrameFixture setIdeFrameSize(@NotNull Dimension size) {
target().setSize(size);
return this;
}
@NotNull
public IdeaFrameFixture closeProjectPanel() {
new JToggleButtonFixture(robot(), GuiTests.waitUntilShowing(robot(), Matchers.byText(StripeButton.class, "1: Project"))).deselect();
return this;
}
@NotNull
public IdeaFrameFixture closeBuildPanel() {
new JToggleButtonFixture(robot(), GuiTests.waitUntilShowing(robot(), Matchers.byText(StripeButton.class, "Build"))).deselect();
return this;
}
@NotNull
public IdeaFrameFixture openResourceManager() {
new JToggleButtonFixture(robot(), GuiTests.waitUntilShowing(robot(), Matchers.byText(StripeButton.class, "Resource Manager"))).select();
return this;
}
@NotNull
public IdeaFrameFixture closeResourceManager() {
new JToggleButtonFixture(robot(), GuiTests.waitUntilShowing(robot(), Matchers.byText(StripeButton.class, "Resource Manager")))
.deselect();
return this;
}
}
| flutter-intellij/flutter-studio/testSrc/com/android/tools/idea/tests/gui/framework/fixture/IdeaFrameFixture.java/0 | {
"file_path": "flutter-intellij/flutter-studio/testSrc/com/android/tools/idea/tests/gui/framework/fixture/IdeaFrameFixture.java",
"repo_id": "flutter-intellij",
"token_count": 9860
} | 630 |
#!/bin/bash
# This script should execute after a commit.
date
echo "Automatic build started"
# Fail on any error.
set -e
# Display commands being run. Only do this while debugging and be careful
# that no confidential information is displayed.
# set -x
# Code under repo is checked out to ${KOKORO_ARTIFACTS_DIR}/github.
# The final directory name in this path is determined by the scm name specified
# in the job configuration.
cd ${KOKORO_ARTIFACTS_DIR}/github/flutter-intellij-kokoro
./tool/kokoro/build.sh
| flutter-intellij/kokoro/macos_external/kokoro_build.sh/0 | {
"file_path": "flutter-intellij/kokoro/macos_external/kokoro_build.sh",
"repo_id": "flutter-intellij",
"token_count": 157
} | 631 |
<?xml version="1.0"?>
<!--
* Copyright 2020 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
-->
<!-- TODO Fill this out! -->
<tutorialBundle
icon="icons/flutter_13.png"
logo="icons/flutter_13.png"
name="Flutter News"
version="1.17.1"
resourceRoot="/"
stepByStep="false"
hideStepIndex="true">
<feature
name="New Features">
<tutorial
key="flutter_news"
label="New Features in 1.17.1 and 47"
remoteLink="TODO_url_to_web_version"
remoteLinkLabel="Read in a browser">
<description>
<![CDATA[
This panel describes some of the new features and behavior changes included in this update. This
panel is applicable to Flutter SDK 1.17.1 and plugin 47.
<br><br>
To open this panel again later, select <b>Help > What's New in Flutter</b> from the main menu.
]]>
</description>
<step label="Plugin Dev Channel">
<stepElement>
<section>
<![CDATA[
The dev channel isn't really new; it was introduced in plugin version 45. It is updated
weekly with the latest changes from the master branch.
<br><br>There are
<a href="https://github.com/flutter/flutter-intellij/wiki/Dev-Channel">instructions on the web</a>
for how to use it.
]]>
</section>
</stepElement>
</step>
<step label="Label for Step 2">
<stepElement>
<section>
<![CDATA[Arbitrary text that may contain simple html]]>
</section>
</stepElement>
<stepElement>
<code fileType="DART">dart code</code>
</stepElement>
</step>
</tutorial>
</feature>
</tutorialBundle>
| flutter-intellij/resources/flutter-news-assistant.xml/0 | {
"file_path": "flutter-intellij/resources/flutter-news-assistant.xml",
"repo_id": "flutter-intellij",
"token_count": 795
} | 632 |
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io';
import 'package:grinder/grinder.dart';
import 'package:http/http.dart' as http;
void main(List<String> args) => grind(args);
@Task('Check plugin URLs for live-ness')
void checkUrls() async {
log('checking URLs in FlutterBundle.properties...');
var lines =
await File('flutter-idea/src/io/flutter/FlutterBundle.properties').readAsLines();
for (var line in lines) {
var split = line.split('=');
if (split.length == 2) {
// flutter.io.gettingStarted.url | flutter.analytics.privacyUrl
if (split[0].toLowerCase().endsWith('url')) {
var url = split[1];
var response = await http.get(Uri.parse(url));
log('checking: $url...');
if (response.statusCode != 200) {
fail(
'$url GET failed: [${response.statusCode}] ${response.reasonPhrase}');
}
}
}
}
log('OK!');
}
@Task('Create Outline view icons from svgs')
void outlineIcons() async {
Directory previewIconsDir = getDir('resources/icons/preview');
log('using svgexport (npm install -g svgexport)');
for (File file in previewIconsDir
.listSync()
.whereType<File>()
.cast<File>()
.where((file) => file.path.endsWith('.svg'))) {
log('processing ${file.path}...');
String name = fileName(file);
name = name.substring(0, name.indexOf('.'));
_createPng(file, '$name.png', size: 24, forLight: true);
_createPng(file, '[email protected]', size: 48, forLight: true);
_createPng(file, '${name}_dark.png', size: 24, forLight: false);
_createPng(file, '$name@2x_dark.png', size: 48, forLight: false);
}
}
void _createPng(
File sourceSvg,
String targetName, {
required int? size,
bool forLight = false,
}) {
File targetFile = joinFile(sourceSvg.parent, [targetName]);
String color = forLight ? '#7a7a7a' : '#9e9e9e';
String originalContent = sourceSvg.readAsStringSync();
String newContent =
originalContent.replaceAll('<svg ', '<svg fill="$color" ');
sourceSvg.writeAsStringSync(newContent);
try {
ProcessResult result = Process.runSync('svgexport', [
sourceSvg.path,
targetFile.path,
'100%',
'$size:$size',
]);
if (result.exitCode != 0) {
print(
'Error resizing image with imagemagick: ${result.stdout}\n${result.stderr}');
exit(1);
}
} finally {
sourceSvg.writeAsStringSync(originalContent);
}
}
| flutter-intellij/tool/grind.dart/0 | {
"file_path": "flutter-intellij/tool/grind.dart",
"repo_id": "flutter-intellij",
"token_count": 1027
} | 633 |
// Copyright 2017 The Chromium Authors. All rights reserved. Use of this source
// code is governed by a BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'dart:io';
import 'package:args/command_runner.dart';
import 'build_spec.dart';
import 'globals.dart';
import 'util.dart';
class BuildCommandRunner extends CommandRunner {
BuildCommandRunner()
: super('plugin',
'A script to build, test, and deploy the Flutter IntelliJ plugin.') {
argParser.addOption(
'release',
abbr: 'r',
help: 'The release identifier; the numeric suffix of the git branch name',
valueHelp: 'id',
);
argParser.addOption(
'cwd',
abbr: 'd',
help: 'For testing only; the prefix used to locate the root path (../..)',
valueHelp: 'relative-path',
);
}
void writeJxBrowserKeyToFile() {
final jxBrowserKey =
readTokenFromKeystore('FLUTTER_KEYSTORE_JXBROWSER_KEY_NAME');
final propertiesFile =
File("$rootPath/resources/jxbrowser/jxbrowser.properties");
if (jxBrowserKey.isNotEmpty) {
final contents = '''
jxbrowser.license.key=$jxBrowserKey
''';
propertiesFile.writeAsStringSync(contents);
}
}
Future<int> buildPlugin(BuildSpec spec, String version) async {
writeJxBrowserKeyToFile();
return await runGradleCommand(['buildPlugin', '--stacktrace'], spec, version, 'false');
}
Future<int> runGradleCommand(
List<String> command,
BuildSpec spec,
String version,
String testing,
) async {
String javaVersion, smaliPlugin, langPlugin;
if (['2022.1', '2022.2'].contains(spec.version)) {
javaVersion = '11';
smaliPlugin = 'smali';
langPlugin = 'IntelliLang';
} else {
javaVersion = '17';
if (spec.version == '2022.2') {
smaliPlugin = 'smali';
} else {
smaliPlugin = 'com.android.tools.idea.smali';
}
langPlugin = 'org.intellij.intelliLang';
}
final contents = '''
name = "flutter-intellij"
org.gradle.parallel=true
org.gradle.jvmargs=-Xms1024m -Xmx4048m
javaVersion=$javaVersion
androidVersion=${spec.androidPluginVersion}
dartVersion=${spec.dartPluginVersion}
flutterPluginVersion=$version
ide=${spec.ideaProduct}
testing=$testing
buildSpec=${spec.version}
baseVersion=${spec.baseVersion}
smaliPlugin=$smaliPlugin
langPlugin=$langPlugin
kotlin.stdlib.default.dependency=false
ideVersion=${spec.ideaVersion}
''';
final propertiesFile = File("$rootPath/gradle.properties");
final source = propertiesFile.readAsStringSync();
propertiesFile.writeAsStringSync(contents);
int result;
// Using the Gradle daemon causes a strange problem.
// --daemon => Invalid byte 1 of 1-byte UTF-8 sequence, which is nonsense.
// During instrumentation of FlutterProjectStep.form, which is a UTF-8 file.
try {
if (Platform.isWindows) {
if (spec.version == '4.1') {
log('CANNOT BUILD ${spec.version} ON WINDOWS');
return 0;
}
result = await exec('.\\third_party\\gradlew.bat', command);
} else {
if (spec.version == '4.1') {
return await runShellScript(command, spec);
} else {
result = await exec('./third_party/gradlew', command);
}
}
} finally {
propertiesFile.writeAsStringSync(source);
}
return result;
}
Future<int> runShellScript(List<String> command, BuildSpec spec) async {
var script = '''
#!/bin/bash
export JAVA_HOME=\$JAVA_HOME_OLD
./third_party/gradlew ${command.join(' ')}
''';
var systemTempDir = Directory.systemTemp;
var dir = systemTempDir.createTempSync();
var file = File("${dir.path}/script");
file.createSync();
file.writeAsStringSync(script);
try {
return await exec('bash', [(file.absolute.path)]);
} finally {
dir.deleteSync(recursive: true);
}
}
}
| flutter-intellij/tool/plugin/lib/runner.dart/0 | {
"file_path": "flutter-intellij/tool/plugin/lib/runner.dart",
"repo_id": "flutter-intellij",
"token_count": 1517
} | 634 |
Google hereby grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this
section) patent license to make, have made, use, offer to sell, sell,
import, transfer, and otherwise run, modify and propagate the contents
of this implementation, where such license applies only to those
patent claims, both currently owned by Google and acquired in the
future, licensable by Google that are necessarily infringed by this
implementation. This grant does not include claims that would be
infringed only as a consequence of further modification of this
implementation. If you or your agent or exclusive licensee institute
or order or agree to the institution of patent litigation or any other
patent enforcement activity against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that this
implementation constitutes direct or contributory patent infringement,
or inducement of patent infringement, then any patent rights granted
to you under this License for this implementation shall terminate as
of the date such litigation is filed.
| flutter/PATENT_GRANT/0 | {
"file_path": "flutter/PATENT_GRANT",
"repo_id": "flutter",
"token_count": 229
} | 635 |
flutter_infra_release/gradle-wrapper/fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa/gradle-wrapper.tgz
| flutter/bin/internal/gradle_wrapper.version/0 | {
"file_path": "flutter/bin/internal/gradle_wrapper.version",
"repo_id": "flutter",
"token_count": 50
} | 636 |
# a11y_assessments
An application to conduct accessibility assessments.
| flutter/dev/a11y_assessments/README.md/0 | {
"file_path": "flutter/dev/a11y_assessments/README.md",
"repo_id": "flutter",
"token_count": 18
} | 637 |
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
| flutter/dev/a11y_assessments/android/app/src/profile/AndroidManifest.xml/0 | {
"file_path": "flutter/dev/a11y_assessments/android/app/src/profile/AndroidManifest.xml",
"repo_id": "flutter",
"token_count": 158
} | 638 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'use_cases.dart';
class CheckBoxListTile extends UseCase {
@override
String get name => 'CheckBoxListTile';
@override
String get route => '/check-box-list-tile';
@override
Widget build(BuildContext context) => _MainWidget();
}
class _MainWidget extends StatefulWidget {
@override
State<_MainWidget> createState() => _MainWidgetState();
}
class _MainWidgetState extends State<_MainWidget> {
bool _checked = false;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('CheckBoxListTile')),
body: ListView(
children: <Widget>[
CheckboxListTile(
value: _checked,
onChanged: (bool? value) {
setState(() {
_checked = value!;
});
},
title: const Text('a check box list title'),
),
CheckboxListTile(
value: _checked,
onChanged: (bool? value) {
setState(() {
_checked = value!;
});
},
title: const Text('a disabled check box list title'),
enabled: false,
),
],
),
);
}
}
| flutter/dev/a11y_assessments/lib/use_cases/check_box_list_tile.dart/0 | {
"file_path": "flutter/dev/a11y_assessments/lib/use_cases/check_box_list_tile.dart",
"repo_id": "flutter",
"token_count": 621
} | 639 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_MY_APPLICATION_H_
#define FLUTTER_MY_APPLICATION_H_
#include <gtk/gtk.h>
G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
GtkApplication)
/**
* my_application_new:
*
* Creates a new Flutter-based application.
*
* Returns: a new #MyApplication.
*/
MyApplication* my_application_new();
#endif // FLUTTER_MY_APPLICATION_H_
| flutter/dev/a11y_assessments/linux/my_application.h/0 | {
"file_path": "flutter/dev/a11y_assessments/linux/my_application.h",
"repo_id": "flutter",
"token_count": 204
} | 640 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:a11y_assessments/use_cases/check_box_list_tile.dart';
import 'package:flutter_test/flutter_test.dart';
import 'test_utils.dart';
void main() {
testWidgets('check box list tile use-case renders check boxes', (WidgetTester tester) async {
await pumpsUseCase(tester, CheckBoxListTile());
expect(find.text('a check box list title'), findsOneWidget);
expect(find.text('a disabled check box list title'), findsOneWidget);
});
}
| flutter/dev/a11y_assessments/test/check_box_list_tile_test.dart/0 | {
"file_path": "flutter/dev/a11y_assessments/test/check_box_list_tile_test.dart",
"repo_id": "flutter",
"token_count": 195
} | 641 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Rendering Error', (WidgetTester tester) async {
// Assets can load with its package name.
await tester.pumpWidget(
Image.asset('icon/test.png',
width: 54,
height: 54,
fit: BoxFit.none,
),
);
});
}
| flutter/dev/automated_tests/flutter_test/package_assets_test.dart/0 | {
"file_path": "flutter/dev/automated_tests/flutter_test/package_assets_test.dart",
"repo_id": "flutter",
"token_count": 199
} | 642 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
// This test must start on Line 11 or the test
// "flutter test should run a test by line number in URI format"
// in test/integration.shard/test_test.dart updated.
test('exactTestName', () {
expect(2 + 2, 4);
});
test('not exactTestName', () {
throw 'this test should have been filtered out';
});
}
| flutter/dev/automated_tests/flutter_test/uri_format_test.dart/0 | {
"file_path": "flutter/dev/automated_tests/flutter_test/uri_format_test.dart",
"repo_id": "flutter",
"token_count": 176
} | 643 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;
enum ScrollMode { complex, tile }
class ComplexLayoutApp extends StatefulWidget {
const ComplexLayoutApp({super.key, this.badScroll = false});
final bool badScroll;
@override
ComplexLayoutAppState createState() => ComplexLayoutAppState();
static ComplexLayoutAppState? of(BuildContext context) => context.findAncestorStateOfType<ComplexLayoutAppState>();
}
class ComplexLayoutAppState extends State<ComplexLayoutApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: lightTheme ? ThemeData.light() : ThemeData.dark(),
title: 'Advanced Layout',
home: scrollMode == ScrollMode.complex ? ComplexLayout(badScroll: widget.badScroll) : const TileScrollLayout());
}
bool _lightTheme = true;
bool get lightTheme => _lightTheme;
set lightTheme(bool value) {
setState(() {
_lightTheme = value;
});
}
ScrollMode _scrollMode = ScrollMode.complex;
ScrollMode get scrollMode => _scrollMode;
set scrollMode(ScrollMode mode) {
setState(() {
_scrollMode = mode;
});
}
void toggleAnimationSpeed() {
setState(() {
timeDilation = (timeDilation != 1.0) ? 1.0 : 5.0;
});
}
}
class TileScrollLayout extends StatelessWidget {
const TileScrollLayout({ super.key });
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Tile Scrolling Layout')),
body: ListView.builder(
key: const Key('tiles-scroll'),
itemCount: 200,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.all(5.0),
child: Material(
elevation: (index % 5 + 1).toDouble(),
color: Colors.white,
child: const IconBar(),
),
);
},
),
drawer: const GalleryDrawer(),
);
}
}
class ComplexLayout extends StatefulWidget {
const ComplexLayout({ super.key, required this.badScroll });
final bool badScroll;
@override
ComplexLayoutState createState() => ComplexLayoutState();
static ComplexLayoutState? of(BuildContext context) => context.findAncestorStateOfType<ComplexLayoutState>();
}
class ComplexLayoutState extends State<ComplexLayout> {
@override
Widget build(BuildContext context) {
Widget body = ListView.builder(
key: const Key('complex-scroll'), // this key is used by the driver test
controller: ScrollController(), // So that the scroll offset can be tracked
itemCount: widget.badScroll ? 500 : null,
shrinkWrap: widget.badScroll,
itemBuilder: (BuildContext context, int index) {
if (index.isEven) {
return FancyImageItem(index, key: PageStorageKey<int>(index));
} else {
return FancyGalleryItem(index, key: PageStorageKey<int>(index));
}
},
);
if (widget.badScroll) {
body = ListView(
key: const Key('complex-scroll-bad'),
children: <Widget>[body],
);
}
return Scaffold(
appBar: AppBar(
title: const Text('Advanced Layout'),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.create),
tooltip: 'Search',
onPressed: () {
print('Pressed search');
},
),
const TopBarMenu(),
],
),
body: Column(
children: <Widget>[
Expanded(child: body),
const BottomBar(),
],
),
drawer: const GalleryDrawer(),
);
}
}
class TopBarMenu extends StatelessWidget {
const TopBarMenu({super.key});
@override
Widget build(BuildContext context) {
return PopupMenuButton<String>(
onSelected: (String value) { print('Selected: $value'); },
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
const PopupMenuItem<String>(
value: 'Friends',
child: MenuItemWithIcon(Icons.people, 'Friends', '5 new'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.event, 'Events', '12 upcoming'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.group, 'Groups', '14'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.image, 'Pictures', '12'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.near_me, 'Nearby', '33'),
),
const PopupMenuItem<String>(
value: 'Friends',
child: MenuItemWithIcon(Icons.people, 'Friends', '5'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.event, 'Events', '12'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.group, 'Groups', '14'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.image, 'Pictures', '12'),
),
const PopupMenuItem<String>(
value: 'Events',
child: MenuItemWithIcon(Icons.near_me, 'Nearby', '33'),
),
],
);
}
}
class MenuItemWithIcon extends StatelessWidget {
const MenuItemWithIcon(this.icon, this.title, this.subtitle, {super.key});
final IconData icon;
final String title;
final String subtitle;
@override
Widget build(BuildContext context) {
return Row(
children: <Widget>[
Icon(icon),
Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: Text(title),
),
Text(subtitle, style: Theme.of(context).textTheme.bodySmall),
],
);
}
}
class FancyImageItem extends StatelessWidget {
const FancyImageItem(this.index, {super.key});
final int index;
@override
Widget build(BuildContext context) {
return ListBody(
children: <Widget>[
UserHeader('Ali Connors $index'),
const ItemDescription(),
const ItemImageBox(),
const InfoBar(),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Divider(),
),
const IconBar(),
const FatDivider(),
],
);
}
}
class FancyGalleryItem extends StatelessWidget {
const FancyGalleryItem(this.index, {super.key});
final int index;
@override
Widget build(BuildContext context) {
return ListBody(
children: <Widget>[
const UserHeader('Ali Connors'),
ItemGalleryBox(index),
const InfoBar(),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Divider(),
),
const IconBar(),
const FatDivider(),
],
);
}
}
class InfoBar extends StatelessWidget {
const InfoBar({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
const MiniIconWithText(Icons.thumb_up, '42'),
Text('3 Comments', style: Theme.of(context).textTheme.bodySmall),
],
),
);
}
}
class IconBar extends StatelessWidget {
const IconBar({super.key});
@override
Widget build(BuildContext context) {
return const Padding(
padding: EdgeInsets.only(left: 16.0, right: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconWithText(Icons.thumb_up, 'Like'),
IconWithText(Icons.comment, 'Comment'),
IconWithText(Icons.share, 'Share'),
],
),
);
}
}
class IconWithText extends StatelessWidget {
const IconWithText(this.icon, this.title, {super.key});
final IconData icon;
final String title;
@override
Widget build(BuildContext context) {
return Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
icon: Icon(icon),
onPressed: () { print('Pressed $title button'); },
),
Text(title),
],
);
}
}
class MiniIconWithText extends StatelessWidget {
const MiniIconWithText(this.icon, this.title, {super.key});
final IconData icon;
final String title;
@override
Widget build(BuildContext context) {
return Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Container(
width: 16.0,
height: 16.0,
decoration: ShapeDecoration(
color: Theme.of(context).primaryColor,
shape: const CircleBorder(),
),
child: Icon(icon, color: Colors.white, size: 12.0),
),
),
Text(title, style: Theme.of(context).textTheme.bodySmall),
],
);
}
}
class FatDivider extends StatelessWidget {
const FatDivider({super.key});
@override
Widget build(BuildContext context) {
return Container(
height: 8.0,
color: Theme.of(context).dividerColor,
);
}
}
class UserHeader extends StatelessWidget {
const UserHeader(this.userName, {super.key});
final String userName;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Padding(
padding: EdgeInsets.only(right: 8.0),
child: Image(
image: AssetImage('packages/flutter_gallery_assets/people/square/ali.png'),
width: 32.0,
height: 32.0,
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
RichText(text: TextSpan(
style: Theme.of(context).textTheme.bodyMedium,
children: <TextSpan>[
TextSpan(text: userName, style: const TextStyle(fontWeight: FontWeight.bold)),
const TextSpan(text: ' shared a new '),
const TextSpan(text: 'photo', style: TextStyle(fontWeight: FontWeight.bold)),
],
)),
Row(
children: <Widget>[
Text('Yesterday at 11:55 • ', style: Theme.of(context).textTheme.bodySmall),
Icon(Icons.people, size: 16.0, color: Theme.of(context).textTheme.bodySmall!.color),
],
),
],
),
),
const TopBarMenu(),
],
),
);
}
}
class ItemDescription extends StatelessWidget {
const ItemDescription({super.key});
@override
Widget build(BuildContext context) {
return const Padding(
padding: EdgeInsets.all(8.0),
child: Text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'),
);
}
}
class ItemImageBox extends StatelessWidget {
const ItemImageBox({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Stack(
children: <Widget>[
const SizedBox(
height: 230.0,
child: Image(
image: AssetImage('packages/flutter_gallery_assets/places/india_chettinad_silk_maker.png')
),
),
Theme(
data: ThemeData.dark(),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
IconButton(
icon: const Icon(Icons.edit),
onPressed: () { print('Pressed edit button'); },
),
IconButton(
icon: const Icon(Icons.zoom_in),
onPressed: () { print('Pressed zoom button'); },
),
],
),
),
Positioned(
bottom: 4.0,
left: 4.0,
child: Container(
decoration: BoxDecoration(
color: Colors.black54,
borderRadius: BorderRadius.circular(2.0),
),
padding: const EdgeInsets.all(4.0),
child: RichText(
text: const TextSpan(
style: TextStyle(color: Colors.white),
children: <TextSpan>[
TextSpan(
text: 'Photo by '
),
TextSpan(
style: TextStyle(fontWeight: FontWeight.bold),
text: 'Chris Godley',
),
],
),
),
),
),
],
)
,
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text('Artisans of Southern India', style: Theme.of(context).textTheme.bodyLarge),
Text('Silk Spinners', style: Theme.of(context).textTheme.bodyMedium),
Text('Sivaganga, Tamil Nadu', style: Theme.of(context).textTheme.bodySmall),
],
),
),
],
),
),
);
}
}
class ItemGalleryBox extends StatelessWidget {
const ItemGalleryBox(this.index, {super.key});
final int index;
@override
Widget build(BuildContext context) {
final List<String> tabNames = <String>[
'A', 'B', 'C', 'D',
];
return SizedBox(
height: 200.0,
child: DefaultTabController(
length: tabNames.length,
child: Column(
children: <Widget>[
Expanded(
child: TabBarView(
children: tabNames.map<Widget>((String tabName) {
return Container(
key: PageStorageKey<String>(tabName),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: Column(
children: <Widget>[
Expanded(
child: ColoredBox(
color: Theme.of(context).primaryColor,
child: Center(
child: Text(tabName, style: Theme.of(context).textTheme.headlineSmall!.copyWith(color: Colors.white)),
),
),
),
Row(
children: <Widget>[
IconButton(
icon: const Icon(Icons.share),
onPressed: () { print('Pressed share'); },
),
IconButton(
icon: const Icon(Icons.event),
onPressed: () { print('Pressed event'); },
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text('This is item $tabName'),
),
),
],
),
],
),
),
),
);
}).toList(),
),
),
const TabPageSelector(),
],
),
),
);
}
}
class BottomBar extends StatelessWidget {
const BottomBar({super.key});
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: Theme.of(context).dividerColor,
),
),
),
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
BottomBarButton(Icons.new_releases, 'News'),
BottomBarButton(Icons.people, 'Requests'),
BottomBarButton(Icons.chat, 'Messenger'),
BottomBarButton(Icons.bookmark, 'Bookmark'),
BottomBarButton(Icons.alarm, 'Alarm'),
],
),
);
}
}
class BottomBarButton extends StatelessWidget {
const BottomBarButton(this.icon, this.title, {super.key});
final IconData icon;
final String title;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
IconButton(
icon: Icon(icon),
onPressed: () { print('Pressed: $title'); },
),
Text(title, style: Theme.of(context).textTheme.bodySmall),
],
),
);
}
}
class GalleryDrawer extends StatelessWidget {
const GalleryDrawer({ super.key });
void _changeTheme(BuildContext context, bool value) {
ComplexLayoutApp.of(context)?.lightTheme = value;
}
void _changeScrollMode(BuildContext context, ScrollMode mode) {
ComplexLayoutApp.of(context)?.scrollMode = mode;
}
@override
Widget build(BuildContext context) {
final ScrollMode currentMode = ComplexLayoutApp.of(context)!.scrollMode;
return Drawer(
// For real apps, see the Gallery material Drawer demo. More
// typically, a drawer would have a fixed header with a scrolling body
// below it.
child: ListView(
key: const PageStorageKey<String>('gallery-drawer'),
padding: EdgeInsets.zero,
children: <Widget>[
const FancyDrawerHeader(),
ListTile(
key: const Key('scroll-switcher'),
title: const Text('Scroll Mode'),
onTap: () {
_changeScrollMode(context, currentMode == ScrollMode.complex ? ScrollMode.tile : ScrollMode.complex);
Navigator.pop(context);
},
trailing: Text(currentMode == ScrollMode.complex ? 'Tile' : 'Complex'),
),
ListTile(
leading: const Icon(Icons.brightness_5),
title: const Text('Light'),
onTap: () { _changeTheme(context, true); },
selected: ComplexLayoutApp.of(context)!.lightTheme,
trailing: Radio<bool>(
value: true,
groupValue: ComplexLayoutApp.of(context)!.lightTheme,
onChanged: (bool? value) { _changeTheme(context, value!); },
),
),
ListTile(
leading: const Icon(Icons.brightness_7),
title: const Text('Dark'),
onTap: () { _changeTheme(context, false); },
selected: !ComplexLayoutApp.of(context)!.lightTheme,
trailing: Radio<bool>(
value: false,
groupValue: ComplexLayoutApp.of(context)!.lightTheme,
onChanged: (bool? value) { _changeTheme(context, value!); },
),
),
const Divider(),
ListTile(
leading: const Icon(Icons.hourglass_empty),
title: const Text('Animate Slowly'),
selected: timeDilation != 1.0,
onTap: () { ComplexLayoutApp.of(context)!.toggleAnimationSpeed(); },
trailing: Checkbox(
value: timeDilation != 1.0,
onChanged: (bool? value) { ComplexLayoutApp.of(context)!.toggleAnimationSpeed(); },
),
),
],
),
);
}
}
class FancyDrawerHeader extends StatelessWidget {
const FancyDrawerHeader({super.key});
@override
Widget build(BuildContext context) {
return Container(
color: Colors.purple,
height: 200.0,
child: const SafeArea(
bottom: false,
child: Placeholder(),
),
);
}
}
| flutter/dev/benchmarks/complex_layout/lib/src/app.dart/0 | {
"file_path": "flutter/dev/benchmarks/complex_layout/lib/src/app.dart",
"repo_id": "flutter",
"token_count": 10191
} | 644 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:ui';
import 'package:flutter/material.dart';
class BackdropFilterPage extends StatefulWidget {
const BackdropFilterPage({super.key});
@override
State<BackdropFilterPage> createState() => _BackdropFilterPageState();
}
class _BackdropFilterPageState extends State<BackdropFilterPage> with TickerProviderStateMixin {
bool _blurGroup = false;
bool _blurTexts = true;
late AnimationController animation;
@override
void initState() {
super.initState();
animation = AnimationController(vsync: this, duration: const Duration(seconds: 1));
animation.repeat();
}
@override
void dispose() {
animation.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
Widget addBlur(Widget child, bool shouldBlur) {
if (shouldBlur) {
return ClipRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: child,
),
);
} else {
return child;
}
}
final Widget txt = addBlur(Container(
padding: const EdgeInsets.all(5),
child: const Text('txt'),
), _blurTexts);
Widget col(Widget w, int numRows) {
return Column(
children: List<Widget>.generate(numRows, (int i) => w),
);
}
Widget grid(Widget w, int numRows, int numCols) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: List<Widget>.generate(numCols, (int i) => col(w, numRows)),
);
}
return Scaffold(
backgroundColor: Colors.grey,
body: Stack(
children: <Widget>[
Text('0' * 10000, style: const TextStyle(color: Colors.yellow)),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
child: RepaintBoundary(
child: Center(
child: AnimatedBuilder(
animation: animation,
builder: (BuildContext c, Widget? w) {
final int val = (animation.value * 255).round();
return Container(
width: 50,
height: 50,
color: Color.fromARGB(255, val, val, val));
}),
)),
),
const SizedBox(height: 20),
RepaintBoundary(
child: addBlur(grid(txt, 17, 5), _blurGroup),
),
const SizedBox(height: 20),
ColoredBox(
color: Colors.white,
child:Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('Backdrop per txt:'),
Checkbox(
value: _blurTexts,
onChanged: (bool? v) => setState(() { _blurTexts = v ?? false; }),
),
const SizedBox(width: 10),
const Text('Backdrop grid:'),
Checkbox(
value: _blurGroup,
onChanged: (bool? v) => setState(() { _blurGroup = v ?? false; }),
),
],
),
),
],
),
],
),
);
}
}
| flutter/dev/benchmarks/macrobenchmarks/lib/src/backdrop_filter.dart/0 | {
"file_path": "flutter/dev/benchmarks/macrobenchmarks/lib/src/backdrop_filter.dart",
"repo_id": "flutter",
"token_count": 1866
} | 645 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
class ColumnOfText extends StatefulWidget {
const ColumnOfText({super.key});
@override
State<ColumnOfText> createState() => ColumnOfTextState();
}
class ColumnOfTextState extends State<ColumnOfText> with SingleTickerProviderStateMixin {
bool _showText = false;
late AnimationController _controller;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 300),
)
..addStatusListener((AnimationStatus status) {
if (status == AnimationStatus.completed) {
setState(() {
_showText = !_showText;
});
_controller
..reset()
..forward();
}
})
..forward();
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Material(
child: OverflowBox(
alignment: Alignment.topCenter,
maxHeight: double.infinity,
child: !_showText
? Container()
: Column(
children: List<Widget>.generate(9, (int index) {
return ListTile(
leading: CircleAvatar(
child: Text('G$index'),
),
title: Text(
'Foo contact from $index-th local contact',
overflow: TextOverflow.ellipsis,
),
subtitle: Text('+91 88888 8800$index'),
);
}),
),
),
);
}
}
| flutter/dev/benchmarks/macrobenchmarks/lib/src/list_text_layout.dart/0 | {
"file_path": "flutter/dev/benchmarks/macrobenchmarks/lib/src/list_text_layout.dart",
"repo_id": "flutter",
"token_count": 846
} | 646 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'recorder.dart';
/// Measures how expensive it is to construct material checkboxes.
///
/// Creates a 10x10 grid of tristate checkboxes.
class BenchBuildMaterialCheckbox extends WidgetBuildRecorder {
BenchBuildMaterialCheckbox() : super(name: benchmarkName);
static const String benchmarkName = 'build_material_checkbox';
static bool? _isChecked;
@override
Widget createWidget() {
return Directionality(
textDirection: TextDirection.ltr,
child: Material(
child: Column(
children: List<Widget>.generate(10, (int i) {
return _buildRow();
}),
),
),
);
}
Row _buildRow() {
if (_isChecked == null) {
_isChecked = true;
} else if (_isChecked!) {
_isChecked = false;
} else {
_isChecked = null;
}
return Row(
children: List<Widget>.generate(10, (int i) {
return Expanded(
child: Checkbox(
value: _isChecked,
tristate: true,
onChanged: (bool? newValue) {
// Intentionally empty.
},
),
);
}),
);
}
}
| flutter/dev/benchmarks/macrobenchmarks/lib/src/web/bench_build_material_checkbox.dart/0 | {
"file_path": "flutter/dev/benchmarks/macrobenchmarks/lib/src/web/bench_build_material_checkbox.dart",
"repo_id": "flutter",
"token_count": 563
} | 647 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:ui';
// The code below was generated by modify several parts of the engine
// May 2020 and running Flutter Gallery.
late PathFillType gFillType;
late Rect gBounds;
late List<dynamic> allPaths;
late Path path8;
late Path path10;
late Path path12;
late Path path14;
late Path path16;
late Path path18;
late Path path34;
late Path path50;
late Path path60;
late Path path63;
late Path path66;
late Path path69;
late Path path72;
late Path path75;
late Path path78;
late Path path80;
late Path path82;
late Path path84;
late Path path86;
late Path path88;
late Path path119;
late Path path120;
late Path path121;
late Path path122;
late Path path123;
late Path path125;
late Path path127;
late Path path129;
late Path path131;
late Path path132;
late Path path134;
late Path path137;
late Path path140;
late Path path143;
late Path path145;
late Path path147;
late Path path208;
late Path path209;
late Path path210;
late Path path211;
late Path path213;
late Path path216;
late Path path219;
late Path path222;
late Path path225;
late Path path227;
late Path path229;
late Path path232;
late Path path235;
late Path path238;
late Path path240;
late Path path242;
late Path path277;
late Path path278;
late Path path279;
late Path path280;
late Path path281;
late Path path282;
late Path path284;
late Path path286;
late Path path288;
late Path path290;
late Path path292;
late Path path295;
late Path path298;
late Path path301;
late Path path330;
late Path path331;
late Path path332;
late Path path333;
late Path path334;
late Path path336;
late Path path338;
late Path path340;
late Path path342;
late Path path344;
late Path path345;
late Path path346;
late Path path349;
late Path path352;
late Path path356;
late Path path358;
late Path path359;
late Path path360;
late Path path361;
late Path path362;
late Path path363;
late Path path366;
late Path path369;
late Path path372;
late Path path373;
late Path path374;
late Path path375;
late Path path376;
late Path path379;
late Path path382;
late Path path385;
late Path path386;
late Path path387;
late Path path388;
late Path path389;
late Path path392;
late Path path395;
late Path path398;
late Path path399;
late Path path400;
late Path path401;
late Path path402;
late Path path405;
late Path path408;
late Path path411;
late Path path412;
late Path path413;
late Path path414;
late Path path415;
late Path path418;
late Path path421;
late Path path424;
late Path path425;
late Path path426;
late Path path427;
late Path path428;
late Path path431;
late Path path434;
late Path path437;
late Path path438;
late Path path439;
late Path path440;
late Path path441;
late Path path444;
late Path path447;
late Path path450;
late Path path451;
late Path path452;
late Path path453;
late Path path454;
late Path path457;
late Path path460;
late Path path463;
late Path path464;
late Path path465;
late Path path466;
late Path path467;
late Path path470;
late Path path473;
late Path path476;
late Path path477;
late Path path478;
late Path path479;
late Path path480;
late Path path483;
late Path path486;
late Path path489;
late Path path490;
late Path path491;
late Path path492;
late Path path493;
late Path path496;
late Path path499;
late Path path502;
late Path path503;
late Path path504;
late Path path505;
late Path path506;
late Path path509;
late Path path512;
late Path path515;
late Path path516;
late Path path517;
late Path path518;
late Path path519;
late Path path522;
late Path path525;
late Path path528;
late Path path529;
late Path path530;
late Path path531;
late Path path532;
late Path path535;
late Path path538;
late Path path541;
late Path path542;
late Path path543;
late Path path544;
late Path path545;
late Path path548;
late Path path551;
late Path path554;
late Path path555;
late Path path556;
late Path path557;
late Path path558;
late Path path561;
late Path path564;
late Path path573;
late Path path577;
late Path path579;
late Path path591;
late Path path592;
late Path path593;
late Path path594;
late Path path595;
late Path path597;
late Path path599;
late Path path601;
late Path path603;
late Path path606;
late Path path608;
void createPaths() {
allPaths = <dynamic>[];
pathOps0();
pathOps1();
pathOps2();
pathOps3();
pathOps4();
pathOps5();
pathOps6();
pathOps7();
pathOps8();
pathOps9();
pathOps10();
pathOps11();
pathOps12();
pathOps13();
pathOps14();
pathOps15();
pathOps16();
pathOps17();
pathOps18();
pathOps19();
pathOps20();
pathOps21();
pathOps22();
pathOps23();
pathOps24();
pathOps25();
pathOps26();
pathOps27();
pathOps28();
pathOps29();
pathOps30();
pathOps31();
pathOps32();
pathOps33();
pathOps34();
pathOps35();
pathOps36();
pathOps37();
pathOps38();
pathOps39();
pathOps40();
pathOps41();
pathOps42();
pathOps43();
pathOps44();
pathOps45();
pathOps46();
pathOps47();
pathOps48();
pathOps49();
pathOps50();
pathOps51();
pathOps52();
pathOps53();
pathOps54();
pathOps55();
pathOps56();
pathOps57();
pathOps58();
pathOps59();
pathOps60();
pathOps61();
pathOps62();
pathOps63();
pathOps64();
pathOps65();
pathOps66();
pathOps67();
pathOps68();
pathOps69();
pathOps70();
pathOps71();
pathOps72();
pathOps73();
pathOps74();
pathOps75();
pathOps76();
pathOps77();
pathOps78();
pathOps79();
pathOps80();
pathOps81();
pathOps82();
pathOps83();
pathOps84();
pathOps85();
pathOps86();
pathOps87();
pathOps88();
pathOps89();
pathOps90();
pathOps91();
pathOps92();
pathOps93();
pathOps94();
pathOps95();
pathOps96();
pathOps97();
pathOps98();
pathOps99();
pathOps100();
pathOps101();
pathOps102();
pathOps103();
pathOps104();
pathOps105();
pathOps106();
pathOps107();
pathOps108();
pathOps109();
pathOps110();
pathOps111();
pathOps112();
pathOps113();
pathOps114();
pathOps115();
pathOps116();
pathOps117();
pathOps118();
pathOps119();
pathOps120();
pathOps121();
pathOps122();
pathOps123();
pathOps124();
pathOps125();
pathOps126();
pathOps127();
pathOps128();
pathOps129();
pathOps130();
pathOps131();
pathOps132();
pathOps133();
pathOps134();
pathOps135();
pathOps136();
pathOps137();
pathOps138();
pathOps139();
pathOps140();
pathOps141();
pathOps142();
pathOps143();
pathOps144();
pathOps145();
pathOps146();
pathOps147();
pathOps149();
pathOps150();
pathOps155();
pathOps156();
pathOps161();
pathOps162();
pathOps164();
pathOps165();
pathOps167();
pathOps168();
pathOps173();
pathOps174();
pathOps178();
pathOps179();
pathOps180();
pathOps181();
pathOps182();
pathOps183();
pathOps184();
pathOps185();
pathOps186();
pathOps187();
pathOps188();
pathOps189();
pathOps190();
pathOps191();
pathOps192();
pathOps193();
pathOps194();
pathOps195();
pathOps196();
pathOps197();
pathOps198();
pathOps199();
pathOps200();
pathOps201();
pathOps202();
pathOps203();
pathOps204();
pathOps205();
pathOps206();
pathOps207();
pathOps208();
pathOps209();
pathOps210();
pathOps211();
pathOps212();
pathOps213();
pathOps214();
pathOps215();
pathOps216();
pathOps217();
pathOps218();
pathOps219();
pathOps220();
pathOps221();
pathOps222();
pathOps223();
pathOps224();
pathOps225();
pathOps226();
pathOps227();
pathOps228();
pathOps229();
pathOps230();
pathOps231();
pathOps232();
pathOps233();
pathOps234();
pathOps235();
pathOps236();
pathOps237();
pathOps238();
pathOps239();
pathOps240();
pathOps241();
pathOps242();
pathOps243();
pathOps244();
pathOps245();
pathOps246();
pathOps247();
pathOps248();
pathOps249();
pathOps250();
pathOps251();
pathOps252();
pathOps253();
pathOps254();
pathOps255();
pathOps256();
pathOps257();
pathOps258();
pathOps259();
pathOps260();
pathOps261();
pathOps262();
pathOps263();
pathOps264();
pathOps265();
pathOps266();
pathOps267();
pathOps268();
pathOps269();
pathOps270();
pathOps271();
pathOps272();
pathOps273();
pathOps274();
pathOps275();
pathOps276();
pathOps277();
pathOps278();
pathOps279();
pathOps280();
pathOps281();
pathOps282();
pathOps283();
pathOps284();
pathOps285();
pathOps286();
pathOps287();
pathOps288();
pathOps289();
pathOps290();
pathOps291();
pathOps292();
pathOps293();
pathOps294();
pathOps295();
pathOps296();
pathOps297();
pathOps298();
pathOps299();
pathOps300();
pathOps301();
pathOps302();
pathOps303();
pathOps304();
pathOps305();
pathOps306();
pathOps307();
pathOps308();
pathOps309();
pathOps310();
pathOps311();
pathOps312();
pathOps313();
pathOps314();
pathOps315();
pathOps316();
pathOps317();
pathOps318();
pathOps319();
pathOps320();
pathOps321();
pathOps322();
pathOps323();
pathOps324();
pathOps325();
pathOps326();
pathOps327();
pathOps328();
pathOps329();
pathOps330();
pathOps331();
pathOps332();
pathOps333();
pathOps334();
pathOps335();
pathOps336();
pathOps337();
pathOps338();
pathOps339();
pathOps340();
pathOps341();
pathOps342();
pathOps343();
pathOps344();
pathOps345();
pathOps346();
pathOps347();
pathOps348();
pathOps349();
pathOps350();
pathOps351();
pathOps352();
pathOps353();
pathOps354();
pathOps355();
pathOps356();
pathOps357();
pathOps358();
pathOps359();
pathOps360();
pathOps361();
pathOps362();
pathOps363();
pathOps364();
pathOps365();
pathOps366();
pathOps367();
pathOps368();
pathOps369();
pathOps370();
pathOps371();
pathOps372();
pathOps373();
pathOps374();
pathOps375();
pathOps376();
pathOps377();
pathOps378();
pathOps379();
pathOps380();
pathOps381();
pathOps382();
pathOps383();
pathOps384();
pathOps385();
pathOps386();
pathOps387();
pathOps388();
pathOps389();
pathOps390();
pathOps391();
pathOps392();
pathOps393();
pathOps394();
pathOps395();
pathOps396();
pathOps397();
pathOps398();
pathOps399();
pathOps400();
pathOps401();
pathOps402();
pathOps403();
pathOps404();
pathOps405();
pathOps406();
pathOps407();
pathOps408();
pathOps409();
pathOps410();
pathOps411();
pathOps412();
pathOps413();
pathOps414();
pathOps415();
pathOps416();
pathOps417();
pathOps418();
pathOps419();
pathOps420();
pathOps421();
pathOps422();
pathOps423();
pathOps424();
pathOps425();
pathOps426();
pathOps427();
pathOps428();
pathOps429();
pathOps430();
pathOps431();
pathOps432();
pathOps433();
pathOps434();
pathOps435();
pathOps436();
pathOps437();
pathOps438();
pathOps439();
pathOps440();
pathOps441();
pathOps442();
pathOps443();
pathOps444();
pathOps445();
pathOps446();
pathOps447();
pathOps448();
pathOps449();
pathOps450();
pathOps451();
pathOps452();
pathOps453();
pathOps454();
pathOps455();
pathOps456();
pathOps457();
pathOps458();
pathOps459();
pathOps460();
pathOps461();
pathOps462();
pathOps463();
pathOps464();
pathOps465();
pathOps466();
pathOps467();
pathOps468();
pathOps469();
pathOps470();
pathOps471();
pathOps472();
pathOps473();
pathOps474();
pathOps475();
pathOps476();
pathOps477();
pathOps478();
pathOps479();
pathOps480();
pathOps481();
pathOps482();
pathOps483();
pathOps484();
pathOps485();
pathOps486();
pathOps487();
pathOps488();
pathOps489();
pathOps490();
pathOps491();
pathOps492();
pathOps493();
pathOps494();
pathOps495();
pathOps496();
pathOps497();
pathOps498();
pathOps499();
pathOps500();
pathOps501();
pathOps502();
pathOps503();
pathOps504();
pathOps505();
pathOps506();
pathOps507();
pathOps508();
pathOps509();
pathOps510();
pathOps511();
pathOps512();
pathOps513();
pathOps514();
pathOps515();
pathOps516();
pathOps517();
pathOps518();
pathOps519();
pathOps520();
pathOps521();
pathOps522();
pathOps523();
pathOps524();
pathOps525();
pathOps526();
pathOps527();
pathOps528();
pathOps529();
pathOps530();
pathOps531();
pathOps532();
pathOps533();
pathOps534();
pathOps535();
pathOps536();
pathOps537();
pathOps538();
pathOps539();
pathOps540();
pathOps541();
pathOps542();
pathOps543();
pathOps544();
pathOps545();
pathOps546();
pathOps547();
pathOps548();
pathOps549();
pathOps550();
pathOps551();
pathOps552();
pathOps553();
pathOps554();
pathOps555();
pathOps556();
pathOps557();
pathOps558();
pathOps559();
pathOps560();
pathOps561();
pathOps562();
pathOps563();
pathOps564();
pathOps565();
pathOps566();
pathOps567();
pathOps568();
pathOps569();
pathOps570();
pathOps571();
pathOps572();
pathOps573();
pathOps574();
pathOps575();
pathOps576();
pathOps577();
pathOps578();
pathOps579();
pathOps580();
pathOps581();
pathOps582();
pathOps583();
pathOps584();
pathOps585();
pathOps586();
pathOps587();
pathOps588();
pathOps589();
pathOps590();
pathOps596();
pathOps598();
pathOps600();
pathOps602();
pathOps604();
pathOps605();
pathOps607();
}
void pathOps0() {
final Path path0 = Path();
path0.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(20, 20, 60, 60), const Radius.circular(10)));
gBounds = path0.getBounds();
gBounds = path0.getBounds();
gBounds = path0.getBounds();
_runPathTest(path0);
gBounds = path0.getBounds();
_runPathTest(path0);
allPaths.add(path0);
}
void pathOps1() {
final Path path1 = Path();
path1.addOval(const Rect.fromLTRB(20, 20, 60, 60));
gBounds = path1.getBounds();
gBounds = path1.getBounds();
gBounds = path1.getBounds();
gBounds = path1.getBounds();
_runPathTest(path1);
gFillType = path1.fillType;
_runPathTest(path1);
gFillType = path1.fillType;
_runPathTest(path1);
gFillType = path1.fillType;
_runPathTest(path1);
gFillType = path1.fillType;
allPaths.add(path1);
}
void pathOps2() {
final Path path2 = Path();
path2.moveTo(20, 60);
path2.quadraticBezierTo(60, 20, 60, 60);
path2.close();
path2.moveTo(60, 20);
path2.quadraticBezierTo(60, 60, 20, 60);
gBounds = path2.getBounds();
gBounds = path2.getBounds();
gBounds = path2.getBounds();
gBounds = path2.getBounds();
_runPathTest(path2);
gFillType = path2.fillType;
_runPathTest(path2);
gFillType = path2.fillType;
_runPathTest(path2);
gFillType = path2.fillType;
_runPathTest(path2);
gFillType = path2.fillType;
allPaths.add(path2);
}
void pathOps3() {
final Path path3 = Path();
path3.moveTo(20, 30);
path3.lineTo(40, 20);
path3.lineTo(60, 30);
path3.lineTo(60, 60);
path3.lineTo(20, 60);
path3.close();
gBounds = path3.getBounds();
gBounds = path3.getBounds();
gBounds = path3.getBounds();
gBounds = path3.getBounds();
_runPathTest(path3);
gFillType = path3.fillType;
_runPathTest(path3);
gFillType = path3.fillType;
_runPathTest(path3);
gFillType = path3.fillType;
_runPathTest(path3);
gFillType = path3.fillType;
allPaths.add(path3);
}
void pathOps4() {
final Path path4 = Path();
path4.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(8, 8, 328, 248), const Radius.circular(16)));
_runPathTest(path4);
allPaths.add(path4);
}
void pathOps5() {
final Path path5 = Path();
path5.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(8, 8, 328, 248), const Radius.circular(16)));
_runPathTest(path5);
allPaths.add(path5);
}
void pathOps6() {
final Path path6 = Path();
path6.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 136, 970, 1144), Radius.zero));
gBounds = path6.getBounds();
allPaths.add(path6);
}
void pathOps7() {
final Path path7 = Path();
path7.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 179.5, 200), const Radius.circular(10)));
gFillType = path7.fillType;
path8 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path121 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path210 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path278 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path332 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path359 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path372 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path385 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path398 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path411 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path424 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path437 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path450 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path463 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path476 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path489 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path502 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path515 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path528 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path541 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path554 = path7.shift(const Offset(15, 8));
gFillType = path7.fillType;
path591 = path7.shift(const Offset(15, 8));
allPaths.add(path7);
}
void pathOps8() {
gBounds = path8.getBounds();
allPaths.add(path8);
}
void pathOps9() {
final Path path9 = Path();
path9.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 179.5, 200), const Radius.circular(10)));
gFillType = path9.fillType;
path10 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path120 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path209 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path279 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path331 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path360 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path373 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path386 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path399 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path412 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path425 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path438 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path451 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path464 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path477 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path490 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path503 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path516 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path529 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path542 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path555 = path9.shift(const Offset(15, 8));
gFillType = path9.fillType;
path592 = path9.shift(const Offset(15, 8));
allPaths.add(path9);
}
void pathOps10() {
gBounds = path10.getBounds();
allPaths.add(path10);
}
void pathOps11() {
final Path path11 = Path();
path11.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 179.5, 200), const Radius.circular(10)));
gFillType = path11.fillType;
path12 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path119 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path208 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path280 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path330 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path361 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path374 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path387 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path400 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path413 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path426 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path439 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path452 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path465 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path478 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path491 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path504 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path517 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path530 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path543 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path556 = path11.shift(const Offset(15, 8));
gFillType = path11.fillType;
path593 = path11.shift(const Offset(15, 8));
allPaths.add(path11);
}
void pathOps12() {
gBounds = path12.getBounds();
allPaths.add(path12);
}
void pathOps13() {
final Path path13 = Path();
path13.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 179.5, 200), const Radius.circular(10)));
gFillType = path13.fillType;
path14 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path122 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path211 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path277 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path333 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path362 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path375 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path388 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path401 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path414 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path427 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path440 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path453 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path466 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path479 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path492 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path505 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path518 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path531 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path544 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path557 = path13.shift(const Offset(15, 8));
gFillType = path13.fillType;
path594 = path13.shift(const Offset(15, 8));
allPaths.add(path13);
}
void pathOps14() {
gBounds = path14.getBounds();
allPaths.add(path14);
}
void pathOps15() {
final Path path15 = Path();
path15.addOval(const Rect.fromLTRB(0, 0, 58, 58));
gFillType = path15.fillType;
path16 = path15.shift(const Offset(860, 79));
gFillType = path15.fillType;
path143 = path15.shift(const Offset(860, 79));
gFillType = path15.fillType;
path238 = path15.shift(const Offset(860, 79));
gFillType = path15.fillType;
path301 = path15.shift(const Offset(860, 79));
gFillType = path15.fillType;
path345 = path15.shift(const Offset(860, 79));
allPaths.add(path15);
}
void pathOps16() {
gBounds = path16.getBounds();
allPaths.add(path16);
}
void pathOps17() {
final Path path17 = Path();
path17.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 585), const Radius.circular(10)));
gFillType = path17.fillType;
path18 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path134 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path229 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path292 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path346 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path363 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path376 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path389 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path402 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path415 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path428 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path441 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path454 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path467 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path480 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path493 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path506 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path519 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path532 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path545 = path17.shift(const Offset(81, 0));
gFillType = path17.fillType;
path558 = path17.shift(const Offset(81, 0));
allPaths.add(path17);
}
void pathOps18() {
gBounds = path18.getBounds();
allPaths.add(path18);
}
void pathOps19() {
final Path path19 = Path();
path19.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path19.getBounds();
allPaths.add(path19);
}
void pathOps20() {
final Path path20 = Path();
path20.reset();
path20.moveTo(331.66666666666663, 86);
path20.lineTo(81, 86);
path20.lineTo(81, 84);
path20.lineTo(331.66666666666663, 84);
gBounds = path20.getBounds();
_runPathTest(path20);
gFillType = path20.fillType;
allPaths.add(path20);
}
void pathOps21() {
final Path path21 = Path();
path21.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path21.getBounds();
allPaths.add(path21);
}
void pathOps22() {
final Path path22 = Path();
path22.reset();
path22.moveTo(234.66666666666666, 87);
path22.lineTo(96, 87);
path22.lineTo(96, 86);
path22.lineTo(234.66666666666666, 86);
gBounds = path22.getBounds();
_runPathTest(path22);
gFillType = path22.fillType;
allPaths.add(path22);
}
void pathOps23() {
final Path path23 = Path();
path23.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 101), Radius.zero));
gBounds = path23.getBounds();
allPaths.add(path23);
}
void pathOps24() {
final Path path24 = Path();
path24.reset();
path24.moveTo(234.66666666666666, 101);
path24.lineTo(96, 101);
path24.lineTo(96, 100);
path24.lineTo(234.66666666666666, 100);
gBounds = path24.getBounds();
_runPathTest(path24);
gFillType = path24.fillType;
allPaths.add(path24);
}
void pathOps25() {
final Path path25 = Path();
path25.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 101), Radius.zero));
gBounds = path25.getBounds();
allPaths.add(path25);
}
void pathOps26() {
final Path path26 = Path();
path26.reset();
path26.moveTo(234.66666666666666, 101);
path26.lineTo(96, 101);
path26.lineTo(96, 100);
path26.lineTo(234.66666666666666, 100);
gBounds = path26.getBounds();
_runPathTest(path26);
gFillType = path26.fillType;
allPaths.add(path26);
}
void pathOps27() {
final Path path27 = Path();
path27.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 101), Radius.zero));
gBounds = path27.getBounds();
allPaths.add(path27);
}
void pathOps28() {
final Path path28 = Path();
path28.reset();
path28.moveTo(234.66666666666666, 101);
path28.lineTo(96, 101);
path28.lineTo(96, 100);
path28.lineTo(234.66666666666666, 100);
gBounds = path28.getBounds();
_runPathTest(path28);
gFillType = path28.fillType;
allPaths.add(path28);
}
void pathOps29() {
final Path path29 = Path();
path29.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path29.getBounds();
allPaths.add(path29);
}
void pathOps30() {
final Path path30 = Path();
path30.reset();
path30.moveTo(234.66666666666666, 87);
path30.lineTo(96, 87);
path30.lineTo(96, 86);
path30.lineTo(234.66666666666666, 86);
gBounds = path30.getBounds();
allPaths.add(path30);
}
void pathOps31() {
final Path path31 = Path();
path31.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path31.getBounds();
allPaths.add(path31);
}
void pathOps32() {
final Path path32 = Path();
path32.reset();
path32.moveTo(234.66666666666666, 87);
path32.lineTo(96, 87);
path32.lineTo(96, 86);
path32.lineTo(234.66666666666666, 86);
gBounds = path32.getBounds();
allPaths.add(path32);
}
void pathOps33() {
final Path path33 = Path();
path33.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 585), const Radius.circular(10)));
gFillType = path33.fillType;
path34 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path137 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path232 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path295 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path349 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path366 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path379 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path392 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path405 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path418 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path431 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path444 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path457 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path470 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path483 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path496 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path509 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path522 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path535 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path548 = path33.shift(const Offset(359.66666666666663, 0));
gFillType = path33.fillType;
path561 = path33.shift(const Offset(359.66666666666663, 0));
allPaths.add(path33);
}
void pathOps34() {
gBounds = path34.getBounds();
allPaths.add(path34);
}
void pathOps35() {
final Path path35 = Path();
path35.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path35.getBounds();
allPaths.add(path35);
}
void pathOps36() {
final Path path36 = Path();
path36.reset();
path36.moveTo(610.3333333333333, 86);
path36.lineTo(359.66666666666663, 86);
path36.lineTo(359.66666666666663, 84);
path36.lineTo(610.3333333333333, 84);
gBounds = path36.getBounds();
_runPathTest(path36);
gFillType = path36.fillType;
allPaths.add(path36);
}
void pathOps37() {
final Path path37 = Path();
path37.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path37.getBounds();
allPaths.add(path37);
}
void pathOps38() {
final Path path38 = Path();
path38.reset();
path38.moveTo(234.66666666666666, 87);
path38.lineTo(96, 87);
path38.lineTo(96, 86);
path38.lineTo(234.66666666666666, 86);
gBounds = path38.getBounds();
_runPathTest(path38);
gFillType = path38.fillType;
allPaths.add(path38);
}
void pathOps39() {
final Path path39 = Path();
path39.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path39.getBounds();
allPaths.add(path39);
}
void pathOps40() {
final Path path40 = Path();
path40.reset();
path40.moveTo(234.66666666666666, 87);
path40.lineTo(96, 87);
path40.lineTo(96, 86);
path40.lineTo(234.66666666666666, 86);
gBounds = path40.getBounds();
_runPathTest(path40);
gFillType = path40.fillType;
allPaths.add(path40);
}
void pathOps41() {
final Path path41 = Path();
path41.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 73), Radius.zero));
gBounds = path41.getBounds();
allPaths.add(path41);
}
void pathOps42() {
final Path path42 = Path();
path42.reset();
path42.moveTo(234.66666666666666, 73);
path42.lineTo(96, 73);
path42.lineTo(96, 72);
path42.lineTo(234.66666666666666, 72);
gBounds = path42.getBounds();
_runPathTest(path42);
gFillType = path42.fillType;
allPaths.add(path42);
}
void pathOps43() {
final Path path43 = Path();
path43.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path43.getBounds();
allPaths.add(path43);
}
void pathOps44() {
final Path path44 = Path();
path44.reset();
path44.moveTo(234.66666666666666, 87);
path44.lineTo(96, 87);
path44.lineTo(96, 86);
path44.lineTo(234.66666666666666, 86);
gBounds = path44.getBounds();
_runPathTest(path44);
gFillType = path44.fillType;
allPaths.add(path44);
}
void pathOps45() {
final Path path45 = Path();
path45.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path45.getBounds();
allPaths.add(path45);
}
void pathOps46() {
final Path path46 = Path();
path46.reset();
path46.moveTo(234.66666666666666, 87);
path46.lineTo(96, 87);
path46.lineTo(96, 86);
path46.lineTo(234.66666666666666, 86);
gBounds = path46.getBounds();
_runPathTest(path46);
gFillType = path46.fillType;
allPaths.add(path46);
}
void pathOps47() {
final Path path47 = Path();
path47.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path47.getBounds();
allPaths.add(path47);
}
void pathOps48() {
final Path path48 = Path();
path48.reset();
path48.moveTo(234.66666666666666, 87);
path48.lineTo(96, 87);
path48.lineTo(96, 86);
path48.lineTo(234.66666666666666, 86);
gBounds = path48.getBounds();
allPaths.add(path48);
}
void pathOps49() {
final Path path49 = Path();
path49.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 585), const Radius.circular(10)));
gFillType = path49.fillType;
path50 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path140 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path235 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path298 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path352 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path369 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path382 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path395 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path408 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path421 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path434 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path447 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path460 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path473 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path486 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path499 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path512 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path525 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path538 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path551 = path49.shift(const Offset(638.3333333333333, 0));
gFillType = path49.fillType;
path564 = path49.shift(const Offset(638.3333333333333, 0));
allPaths.add(path49);
}
void pathOps50() {
gBounds = path50.getBounds();
allPaths.add(path50);
}
void pathOps51() {
final Path path51 = Path();
path51.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path51.getBounds();
allPaths.add(path51);
}
void pathOps52() {
final Path path52 = Path();
path52.reset();
path52.moveTo(889, 86);
path52.lineTo(638.3333333333333, 86);
path52.lineTo(638.3333333333333, 84);
path52.lineTo(889, 84);
gBounds = path52.getBounds();
_runPathTest(path52);
gFillType = path52.fillType;
allPaths.add(path52);
}
void pathOps53() {
final Path path53 = Path();
path53.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 87), Radius.zero));
gBounds = path53.getBounds();
allPaths.add(path53);
}
void pathOps54() {
final Path path54 = Path();
path54.reset();
path54.moveTo(234.66666666666669, 87);
path54.lineTo(96, 87);
path54.lineTo(96, 86);
path54.lineTo(234.66666666666669, 86);
gBounds = path54.getBounds();
_runPathTest(path54);
gFillType = path54.fillType;
allPaths.add(path54);
}
void pathOps55() {
final Path path55 = Path();
path55.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 87), Radius.zero));
gBounds = path55.getBounds();
allPaths.add(path55);
}
void pathOps56() {
final Path path56 = Path();
path56.reset();
path56.moveTo(234.66666666666669, 87);
path56.lineTo(96, 87);
path56.lineTo(96, 86);
path56.lineTo(234.66666666666669, 86);
gBounds = path56.getBounds();
_runPathTest(path56);
gFillType = path56.fillType;
allPaths.add(path56);
}
void pathOps57() {
final Path path57 = Path();
path57.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 73), Radius.zero));
gBounds = path57.getBounds();
allPaths.add(path57);
}
void pathOps58() {
final Path path58 = Path();
path58.reset();
path58.moveTo(234.66666666666669, 73);
path58.lineTo(96, 73);
path58.lineTo(96, 72);
path58.lineTo(234.66666666666669, 72);
gBounds = path58.getBounds();
_runPathTest(path58);
gFillType = path58.fillType;
allPaths.add(path58);
}
void pathOps59() {
final Path path59 = Path();
path59.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 520, 560), const Radius.circular(40)));
gFillType = path59.fillType;
path60 = path59.shift(const Offset(450, 136));
gFillType = path59.fillType;
path82 = path59.shift(const Offset(450, 136));
gFillType = path59.fillType;
path86 = path59.shift(const Offset(450, 136));
gFillType = path59.fillType;
path145 = path59.shift(const Offset(450, 136));
gFillType = path59.fillType;
path240 = path59.shift(const Offset(450, 136));
gFillType = path59.fillType;
path356 = path59.shift(const Offset(450, 136));
gFillType = path59.fillType;
path606 = path59.shift(const Offset(450, 136));
allPaths.add(path59);
}
void pathOps60() {
gBounds = path60.getBounds();
allPaths.add(path60);
}
void pathOps61() {
final Path path61 = Path();
path61.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(450, 136, 970, 696), Radius.zero));
gBounds = path61.getBounds();
allPaths.add(path61);
}
void pathOps62() {
final Path path62 = Path();
path62.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 456, 52), const Radius.circular(10)));
gFillType = path62.fillType;
path63 = path62.shift(const Offset(32, 0));
gFillType = path62.fillType;
path123 = path62.shift(const Offset(32, 0));
allPaths.add(path62);
}
void pathOps63() {
gBounds = path63.getBounds();
allPaths.add(path63);
}
void pathOps64() {
final Path path64 = Path();
path64.reset();
path64.moveTo(56, 40);
path64.lineTo(56, 40);
path64.lineTo(58, 40);
path64.lineTo(58, 40);
gBounds = path64.getBounds();
allPaths.add(path64);
}
void pathOps65() {
final Path path65 = Path();
path65.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 456, 52), const Radius.circular(10)));
gFillType = path65.fillType;
path66 = path65.shift(const Offset(32, 0));
gFillType = path65.fillType;
path125 = path65.shift(const Offset(32, 0));
allPaths.add(path65);
}
void pathOps66() {
gBounds = path66.getBounds();
allPaths.add(path66);
}
void pathOps67() {
final Path path67 = Path();
path67.reset();
path67.moveTo(56, 40);
path67.lineTo(56, 40);
path67.lineTo(58, 40);
path67.lineTo(58, 40);
gBounds = path67.getBounds();
allPaths.add(path67);
}
void pathOps68() {
final Path path68 = Path();
path68.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 456, 52), const Radius.circular(10)));
gFillType = path68.fillType;
path69 = path68.shift(const Offset(32, 0));
gFillType = path68.fillType;
path127 = path68.shift(const Offset(32, 0));
allPaths.add(path68);
}
void pathOps69() {
gBounds = path69.getBounds();
allPaths.add(path69);
}
void pathOps70() {
final Path path70 = Path();
path70.reset();
path70.moveTo(56, 40);
path70.lineTo(56, 40);
path70.lineTo(58, 40);
path70.lineTo(58, 40);
gBounds = path70.getBounds();
allPaths.add(path70);
}
void pathOps71() {
final Path path71 = Path();
path71.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 456, 52), const Radius.circular(10)));
gFillType = path71.fillType;
path72 = path71.shift(const Offset(32, 0));
gFillType = path71.fillType;
path129 = path71.shift(const Offset(32, 0));
allPaths.add(path71);
}
void pathOps72() {
gBounds = path72.getBounds();
allPaths.add(path72);
}
void pathOps73() {
final Path path73 = Path();
path73.reset();
path73.moveTo(56, 40);
path73.lineTo(56, 40);
path73.lineTo(58, 40);
path73.lineTo(58, 40);
gBounds = path73.getBounds();
allPaths.add(path73);
}
void pathOps74() {
final Path path74 = Path();
path74.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 456, 52), const Radius.circular(10)));
gFillType = path74.fillType;
path75 = path74.shift(const Offset(32, 0));
gFillType = path74.fillType;
path132 = path74.shift(const Offset(32, 0));
allPaths.add(path74);
}
void pathOps75() {
gBounds = path75.getBounds();
allPaths.add(path75);
}
void pathOps76() {
final Path path76 = Path();
path76.reset();
path76.moveTo(56, 40);
path76.lineTo(56, 40);
path76.lineTo(58, 40);
path76.lineTo(58, 40);
gBounds = path76.getBounds();
allPaths.add(path76);
}
void pathOps77() {
final Path path77 = Path();
path77.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 456, 50), const Radius.circular(10)));
gFillType = path77.fillType;
path78 = path77.shift(const Offset(32, 0));
gFillType = path77.fillType;
path131 = path77.shift(const Offset(32, 0));
allPaths.add(path77);
}
void pathOps78() {
gBounds = path78.getBounds();
allPaths.add(path78);
}
void pathOps79() {
final Path path79 = Path();
path79.addRRect(RRect.fromRectAndCorners(const Rect.fromLTRB(0, 0, 64, 56), bottomLeft: const Radius.circular(10), ));
gFillType = path79.fillType;
path80 = path79.shift(const Offset(906, 136));
gFillType = path79.fillType;
path84 = path79.shift(const Offset(906, 136));
gFillType = path79.fillType;
path88 = path79.shift(const Offset(906, 136));
gFillType = path79.fillType;
path147 = path79.shift(const Offset(906, 136));
gFillType = path79.fillType;
path242 = path79.shift(const Offset(906, 136));
gFillType = path79.fillType;
path358 = path79.shift(const Offset(906, 136));
gFillType = path79.fillType;
path608 = path79.shift(const Offset(906, 136));
allPaths.add(path79);
}
void pathOps80() {
gBounds = path80.getBounds();
allPaths.add(path80);
}
void pathOps81() {
final Path path81 = Path();
path81.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 136, 970, 1144), Radius.zero));
gBounds = path81.getBounds();
allPaths.add(path81);
}
void pathOps82() {
gBounds = path82.getBounds();
allPaths.add(path82);
}
void pathOps83() {
final Path path83 = Path();
path83.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(450, 136, 970, 696), Radius.zero));
gBounds = path83.getBounds();
allPaths.add(path83);
}
void pathOps84() {
gBounds = path84.getBounds();
allPaths.add(path84);
}
void pathOps85() {
final Path path85 = Path();
path85.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 136, 970, 1144), Radius.zero));
gBounds = path85.getBounds();
allPaths.add(path85);
}
void pathOps86() {
gBounds = path86.getBounds();
allPaths.add(path86);
}
void pathOps87() {
final Path path87 = Path();
path87.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(450, 136, 970, 696), Radius.zero));
gBounds = path87.getBounds();
allPaths.add(path87);
}
void pathOps88() {
gBounds = path88.getBounds();
allPaths.add(path88);
}
void pathOps89() {
final Path path89 = Path();
path89.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 87), Radius.zero));
gBounds = path89.getBounds();
allPaths.add(path89);
}
void pathOps90() {
final Path path90 = Path();
path90.reset();
path90.moveTo(234.66666666666669, 87);
path90.lineTo(96, 87);
path90.lineTo(96, 86);
path90.lineTo(234.66666666666669, 86);
gBounds = path90.getBounds();
_runPathTest(path90);
gFillType = path90.fillType;
allPaths.add(path90);
}
void pathOps91() {
final Path path91 = Path();
path91.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 73), Radius.zero));
gBounds = path91.getBounds();
allPaths.add(path91);
}
void pathOps92() {
final Path path92 = Path();
path92.reset();
path92.moveTo(234.66666666666669, 73);
path92.lineTo(96, 73);
path92.lineTo(96, 72);
path92.lineTo(234.66666666666669, 72);
gBounds = path92.getBounds();
_runPathTest(path92);
gFillType = path92.fillType;
allPaths.add(path92);
}
void pathOps93() {
final Path path93 = Path();
path93.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 101), Radius.zero));
gBounds = path93.getBounds();
allPaths.add(path93);
}
void pathOps94() {
final Path path94 = Path();
path94.reset();
path94.moveTo(234.66666666666666, 101);
path94.lineTo(96, 101);
path94.lineTo(96, 100);
path94.lineTo(234.66666666666666, 100);
gBounds = path94.getBounds();
_runPathTest(path94);
gFillType = path94.fillType;
allPaths.add(path94);
}
void pathOps95() {
final Path path95 = Path();
path95.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path95.getBounds();
allPaths.add(path95);
}
void pathOps96() {
final Path path96 = Path();
path96.reset();
path96.moveTo(234.66666666666666, 87);
path96.lineTo(96, 87);
path96.lineTo(96, 86);
path96.lineTo(234.66666666666666, 86);
gBounds = path96.getBounds();
_runPathTest(path96);
gFillType = path96.fillType;
allPaths.add(path96);
}
void pathOps97() {
final Path path97 = Path();
path97.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 101), Radius.zero));
gBounds = path97.getBounds();
allPaths.add(path97);
}
void pathOps98() {
final Path path98 = Path();
path98.reset();
path98.moveTo(234.66666666666666, 101);
path98.lineTo(96, 101);
path98.lineTo(96, 100);
path98.lineTo(234.66666666666666, 100);
gBounds = path98.getBounds();
_runPathTest(path98);
gFillType = path98.fillType;
allPaths.add(path98);
}
void pathOps99() {
final Path path99 = Path();
path99.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 101), Radius.zero));
gBounds = path99.getBounds();
allPaths.add(path99);
}
void pathOps100() {
final Path path100 = Path();
path100.reset();
path100.moveTo(234.66666666666666, 101);
path100.lineTo(96, 101);
path100.lineTo(96, 100);
path100.lineTo(234.66666666666666, 100);
gBounds = path100.getBounds();
_runPathTest(path100);
gFillType = path100.fillType;
allPaths.add(path100);
}
void pathOps101() {
final Path path101 = Path();
path101.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 73), Radius.zero));
gBounds = path101.getBounds();
allPaths.add(path101);
}
void pathOps102() {
final Path path102 = Path();
path102.reset();
path102.moveTo(234.66666666666666, 73);
path102.lineTo(96, 73);
path102.lineTo(96, 72);
path102.lineTo(234.66666666666666, 72);
gBounds = path102.getBounds();
_runPathTest(path102);
gFillType = path102.fillType;
allPaths.add(path102);
}
void pathOps103() {
final Path path103 = Path();
path103.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path103.getBounds();
allPaths.add(path103);
}
void pathOps104() {
final Path path104 = Path();
path104.reset();
path104.moveTo(234.66666666666666, 87);
path104.lineTo(96, 87);
path104.lineTo(96, 86);
path104.lineTo(234.66666666666666, 86);
gBounds = path104.getBounds();
allPaths.add(path104);
}
void pathOps105() {
final Path path105 = Path();
path105.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path105.getBounds();
allPaths.add(path105);
}
void pathOps106() {
final Path path106 = Path();
path106.reset();
path106.moveTo(234.66666666666666, 87);
path106.lineTo(96, 87);
path106.lineTo(96, 86);
path106.lineTo(234.66666666666666, 86);
gBounds = path106.getBounds();
allPaths.add(path106);
}
void pathOps107() {
final Path path107 = Path();
path107.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path107.getBounds();
allPaths.add(path107);
}
void pathOps108() {
final Path path108 = Path();
path108.reset();
path108.moveTo(234.66666666666666, 87);
path108.lineTo(96, 87);
path108.lineTo(96, 86);
path108.lineTo(234.66666666666666, 86);
gBounds = path108.getBounds();
_runPathTest(path108);
gFillType = path108.fillType;
allPaths.add(path108);
}
void pathOps109() {
final Path path109 = Path();
path109.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path109.getBounds();
allPaths.add(path109);
}
void pathOps110() {
final Path path110 = Path();
path110.reset();
path110.moveTo(234.66666666666666, 87);
path110.lineTo(96, 87);
path110.lineTo(96, 86);
path110.lineTo(234.66666666666666, 86);
gBounds = path110.getBounds();
_runPathTest(path110);
gFillType = path110.fillType;
allPaths.add(path110);
}
void pathOps111() {
final Path path111 = Path();
path111.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path111.getBounds();
allPaths.add(path111);
}
void pathOps112() {
final Path path112 = Path();
path112.reset();
path112.moveTo(234.66666666666666, 87);
path112.lineTo(96, 87);
path112.lineTo(96, 86);
path112.lineTo(234.66666666666666, 86);
gBounds = path112.getBounds();
_runPathTest(path112);
gFillType = path112.fillType;
allPaths.add(path112);
}
void pathOps113() {
final Path path113 = Path();
path113.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path113.getBounds();
allPaths.add(path113);
}
void pathOps114() {
final Path path114 = Path();
path114.reset();
path114.moveTo(234.66666666666666, 87);
path114.lineTo(96, 87);
path114.lineTo(96, 86);
path114.lineTo(234.66666666666666, 86);
gBounds = path114.getBounds();
_runPathTest(path114);
gFillType = path114.fillType;
allPaths.add(path114);
}
void pathOps115() {
final Path path115 = Path();
path115.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 87), Radius.zero));
gBounds = path115.getBounds();
allPaths.add(path115);
}
void pathOps116() {
final Path path116 = Path();
path116.reset();
path116.moveTo(234.66666666666666, 87);
path116.lineTo(96, 87);
path116.lineTo(96, 86);
path116.lineTo(234.66666666666666, 86);
gBounds = path116.getBounds();
allPaths.add(path116);
}
void pathOps117() {
final Path path117 = Path();
path117.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 87), Radius.zero));
gBounds = path117.getBounds();
allPaths.add(path117);
}
void pathOps118() {
final Path path118 = Path();
path118.reset();
path118.moveTo(234.66666666666669, 87);
path118.lineTo(96, 87);
path118.lineTo(96, 86);
path118.lineTo(234.66666666666669, 86);
gBounds = path118.getBounds();
_runPathTest(path118);
gFillType = path118.fillType;
allPaths.add(path118);
}
void pathOps119() {
gBounds = path119.getBounds();
allPaths.add(path119);
}
void pathOps120() {
gBounds = path120.getBounds();
allPaths.add(path120);
}
void pathOps121() {
gBounds = path121.getBounds();
allPaths.add(path121);
}
void pathOps122() {
gBounds = path122.getBounds();
allPaths.add(path122);
}
void pathOps123() {
gBounds = path123.getBounds();
allPaths.add(path123);
}
void pathOps124() {
final Path path124 = Path();
path124.reset();
path124.moveTo(56, 40);
path124.lineTo(56, 40);
path124.lineTo(58, 40);
path124.lineTo(58, 40);
gBounds = path124.getBounds();
allPaths.add(path124);
}
void pathOps125() {
gBounds = path125.getBounds();
allPaths.add(path125);
}
void pathOps126() {
final Path path126 = Path();
path126.reset();
path126.moveTo(56, 40);
path126.lineTo(56, 40);
path126.lineTo(58, 40);
path126.lineTo(58, 40);
gBounds = path126.getBounds();
allPaths.add(path126);
}
void pathOps127() {
gBounds = path127.getBounds();
allPaths.add(path127);
}
void pathOps128() {
final Path path128 = Path();
path128.reset();
path128.moveTo(56, 40);
path128.lineTo(56, 40);
path128.lineTo(58, 40);
path128.lineTo(58, 40);
gBounds = path128.getBounds();
allPaths.add(path128);
}
void pathOps129() {
gBounds = path129.getBounds();
allPaths.add(path129);
}
void pathOps130() {
final Path path130 = Path();
path130.reset();
path130.moveTo(56, 40);
path130.lineTo(56, 40);
path130.lineTo(58, 40);
path130.lineTo(58, 40);
gBounds = path130.getBounds();
allPaths.add(path130);
}
void pathOps131() {
gBounds = path131.getBounds();
allPaths.add(path131);
}
void pathOps132() {
gBounds = path132.getBounds();
allPaths.add(path132);
}
void pathOps133() {
final Path path133 = Path();
path133.reset();
path133.moveTo(56, 40);
path133.lineTo(56, 40);
path133.lineTo(58, 40);
path133.lineTo(58, 40);
gBounds = path133.getBounds();
allPaths.add(path133);
}
void pathOps134() {
gBounds = path134.getBounds();
allPaths.add(path134);
}
void pathOps135() {
final Path path135 = Path();
path135.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path135.getBounds();
allPaths.add(path135);
}
void pathOps136() {
final Path path136 = Path();
path136.reset();
path136.moveTo(331.66666666666663, 86);
path136.lineTo(81, 86);
path136.lineTo(81, 84);
path136.lineTo(331.66666666666663, 84);
gBounds = path136.getBounds();
_runPathTest(path136);
gFillType = path136.fillType;
allPaths.add(path136);
}
void pathOps137() {
gBounds = path137.getBounds();
allPaths.add(path137);
}
void pathOps138() {
final Path path138 = Path();
path138.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path138.getBounds();
allPaths.add(path138);
}
void pathOps139() {
final Path path139 = Path();
path139.reset();
path139.moveTo(610.3333333333333, 86);
path139.lineTo(359.66666666666663, 86);
path139.lineTo(359.66666666666663, 84);
path139.lineTo(610.3333333333333, 84);
gBounds = path139.getBounds();
_runPathTest(path139);
gFillType = path139.fillType;
allPaths.add(path139);
}
void pathOps140() {
gBounds = path140.getBounds();
allPaths.add(path140);
}
void pathOps141() {
final Path path141 = Path();
path141.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path141.getBounds();
allPaths.add(path141);
}
void pathOps142() {
final Path path142 = Path();
path142.reset();
path142.moveTo(889, 86);
path142.lineTo(638.3333333333333, 86);
path142.lineTo(638.3333333333333, 84);
path142.lineTo(889, 84);
gBounds = path142.getBounds();
_runPathTest(path142);
gFillType = path142.fillType;
allPaths.add(path142);
}
void pathOps143() {
gBounds = path143.getBounds();
allPaths.add(path143);
}
void pathOps144() {
final Path path144 = Path();
path144.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 136, 970, 1144), Radius.zero));
gBounds = path144.getBounds();
allPaths.add(path144);
}
void pathOps145() {
gBounds = path145.getBounds();
allPaths.add(path145);
}
void pathOps146() {
final Path path146 = Path();
path146.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(450, 136, 970, 696), Radius.zero));
gBounds = path146.getBounds();
allPaths.add(path146);
}
void pathOps147() {
gBounds = path147.getBounds();
allPaths.add(path147);
}
void pathOps149() {
final Path path149 = Path();
path149.reset();
path149.moveTo(-2, 0);
path149.cubicTo(-2, -1.100000023841858, -1.100000023841858, -2, 0, -2);
path149.cubicTo(1.100000023841858, -2, 2, -1.100000023841858, 2, 0);
path149.cubicTo(2, 1.100000023841858, 1.100000023841858, 2, 0, 2);
path149.cubicTo(-1.100000023841858, 2, -2, 1.100000023841858, -2, 0);
allPaths.add(path149);
}
void pathOps150() {
final Path path150 = Path();
path150.reset();
path150.fillType = PathFillType.nonZero;
gBounds = path150.getBounds();
_runPathTest(path150);
gFillType = path150.fillType;
path150.fillType = PathFillType.nonZero;
gBounds = path150.getBounds();
_runPathTest(path150);
gFillType = path150.fillType;
path150.fillType = PathFillType.nonZero;
gBounds = path150.getBounds();
allPaths.add(path150);
}
void pathOps155() {
final Path path155 = Path();
path155.reset();
path155.moveTo(-3, -9);
path155.cubicTo(-3, -10.649999618530273, -1.649999976158142, -12, 0, -12);
path155.cubicTo(0, -12, 0, -12, 0, -12);
path155.cubicTo(1.649999976158142, -12, 3, -10.649999618530273, 3, -9);
path155.cubicTo(3, -9, 3, 9, 3, 9);
path155.cubicTo(3, 10.649999618530273, 1.649999976158142, 12, 0, 12);
path155.cubicTo(0, 12, 0, 12, 0, 12);
path155.cubicTo(-1.649999976158142, 12, -3, 10.649999618530273, -3, 9);
path155.cubicTo(-3, 9, -3, -9, -3, -9);
path155.close();
allPaths.add(path155);
}
void pathOps156() {
final Path path156 = Path();
path156.reset();
path156.fillType = PathFillType.nonZero;
gBounds = path156.getBounds();
_runPathTest(path156);
gFillType = path156.fillType;
path156.fillType = PathFillType.nonZero;
gBounds = path156.getBounds();
_runPathTest(path156);
gFillType = path156.fillType;
path156.fillType = PathFillType.nonZero;
gBounds = path156.getBounds();
allPaths.add(path156);
}
void pathOps161() {
final Path path161 = Path();
path161.reset();
path161.moveTo(-2, -10);
path161.cubicTo(-2, -11.100000381469727, -1.100000023841858, -12, 0, -12);
path161.cubicTo(0, -12, 0, -12, 0, -12);
path161.cubicTo(1.100000023841858, -12, 2, -11.100000381469727, 2, -10);
path161.cubicTo(2, -10, 2, 10, 2, 10);
path161.cubicTo(2, 11.100000381469727, 1.100000023841858, 12, 0, 12);
path161.cubicTo(0, 12, 0, 12, 0, 12);
path161.cubicTo(-1.100000023841858, 12, -2, 11.100000381469727, -2, 10);
path161.cubicTo(-2, 10, -2, -10, -2, -10);
path161.close();
allPaths.add(path161);
}
void pathOps162() {
final Path path162 = Path();
path162.reset();
path162.fillType = PathFillType.nonZero;
gBounds = path162.getBounds();
_runPathTest(path162);
gFillType = path162.fillType;
path162.fillType = PathFillType.nonZero;
gBounds = path162.getBounds();
_runPathTest(path162);
gFillType = path162.fillType;
path162.fillType = PathFillType.nonZero;
gBounds = path162.getBounds();
allPaths.add(path162);
}
void pathOps164() {
final Path path164 = Path();
path164.reset();
path164.moveTo(-3, -9);
path164.cubicTo(-3, -10.649999618530273, -1.649999976158142, -12, 0, -12);
path164.cubicTo(0, -12, 0, -12, 0, -12);
path164.cubicTo(1.649999976158142, -12, 3, -10.649999618530273, 3, -9);
path164.cubicTo(3, -9, 3, 9, 3, 9);
path164.cubicTo(3, 10.649999618530273, 1.649999976158142, 12, 0, 12);
path164.cubicTo(0, 12, 0, 12, 0, 12);
path164.cubicTo(-1.649999976158142, 12, -3, 10.649999618530273, -3, 9);
path164.cubicTo(-3, 9, -3, -9, -3, -9);
path164.close();
allPaths.add(path164);
}
void pathOps165() {
final Path path165 = Path();
path165.reset();
path165.fillType = PathFillType.nonZero;
gBounds = path165.getBounds();
_runPathTest(path165);
gFillType = path165.fillType;
path165.fillType = PathFillType.nonZero;
gBounds = path165.getBounds();
_runPathTest(path165);
gFillType = path165.fillType;
path165.fillType = PathFillType.nonZero;
gBounds = path165.getBounds();
allPaths.add(path165);
}
void pathOps167() {
final Path path167 = Path();
path167.reset();
path167.moveTo(2, 0);
path167.cubicTo(2, 1.1100000143051147, 1.100000023841858, 2, 0, 2);
path167.cubicTo(-1.1100000143051147, 2, -2, 1.1100000143051147, -2, 0);
path167.cubicTo(-2, -1.100000023841858, -1.1100000143051147, -2, 0, -2);
path167.cubicTo(1.100000023841858, -2, 2, -1.100000023841858, 2, 0);
allPaths.add(path167);
}
void pathOps168() {
final Path path168 = Path();
path168.reset();
path168.fillType = PathFillType.nonZero;
gBounds = path168.getBounds();
_runPathTest(path168);
gFillType = path168.fillType;
path168.fillType = PathFillType.nonZero;
gBounds = path168.getBounds();
_runPathTest(path168);
gFillType = path168.fillType;
path168.fillType = PathFillType.nonZero;
gBounds = path168.getBounds();
allPaths.add(path168);
}
void pathOps173() {
final Path path173 = Path();
path173.reset();
path173.moveTo(-2, -10);
path173.cubicTo(-2, -11.100000381469727, -1.100000023841858, -12, 0, -12);
path173.cubicTo(0, -12, 0, -12, 0, -12);
path173.cubicTo(1.100000023841858, -12, 2, -11.100000381469727, 2, -10);
path173.cubicTo(2, -10, 2, 10, 2, 10);
path173.cubicTo(2, 11.100000381469727, 1.100000023841858, 12, 0, 12);
path173.cubicTo(0, 12, 0, 12, 0, 12);
path173.cubicTo(-1.100000023841858, 12, -2, 11.100000381469727, -2, 10);
path173.cubicTo(-2, 10, -2, -10, -2, -10);
path173.close();
allPaths.add(path173);
}
void pathOps174() {
final Path path174 = Path();
path174.reset();
path174.fillType = PathFillType.nonZero;
gBounds = path174.getBounds();
_runPathTest(path174);
gFillType = path174.fillType;
path174.fillType = PathFillType.nonZero;
gBounds = path174.getBounds();
_runPathTest(path174);
gFillType = path174.fillType;
path174.fillType = PathFillType.nonZero;
gBounds = path174.getBounds();
allPaths.add(path174);
}
void pathOps178() {
final Path path178 = Path();
path178.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 105), Radius.zero));
gBounds = path178.getBounds();
allPaths.add(path178);
}
void pathOps179() {
final Path path179 = Path();
path179.reset();
path179.moveTo(234.66666666666669, 105);
path179.lineTo(96, 105);
path179.lineTo(96, 104);
path179.lineTo(234.66666666666669, 104);
gBounds = path179.getBounds();
_runPathTest(path179);
gFillType = path179.fillType;
allPaths.add(path179);
}
void pathOps180() {
final Path path180 = Path();
path180.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 94), Radius.zero));
gBounds = path180.getBounds();
allPaths.add(path180);
}
void pathOps181() {
final Path path181 = Path();
path181.reset();
path181.moveTo(234.66666666666669, 94);
path181.lineTo(96, 94);
path181.lineTo(96, 93);
path181.lineTo(234.66666666666669, 93);
gBounds = path181.getBounds();
_runPathTest(path181);
gFillType = path181.fillType;
allPaths.add(path181);
}
void pathOps182() {
final Path path182 = Path();
path182.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 105), Radius.zero));
gBounds = path182.getBounds();
allPaths.add(path182);
}
void pathOps183() {
final Path path183 = Path();
path183.reset();
path183.moveTo(234.66666666666666, 105);
path183.lineTo(96, 105);
path183.lineTo(96, 104);
path183.lineTo(234.66666666666666, 104);
gBounds = path183.getBounds();
allPaths.add(path183);
}
void pathOps184() {
final Path path184 = Path();
path184.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 105), Radius.zero));
gBounds = path184.getBounds();
allPaths.add(path184);
}
void pathOps185() {
final Path path185 = Path();
path185.reset();
path185.moveTo(234.66666666666666, 105);
path185.lineTo(96, 105);
path185.lineTo(96, 104);
path185.lineTo(234.66666666666666, 104);
gBounds = path185.getBounds();
_runPathTest(path185);
gFillType = path185.fillType;
allPaths.add(path185);
}
void pathOps186() {
final Path path186 = Path();
path186.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 120), Radius.zero));
gBounds = path186.getBounds();
allPaths.add(path186);
}
void pathOps187() {
final Path path187 = Path();
path187.reset();
path187.moveTo(234.66666666666666, 120);
path187.lineTo(96, 120);
path187.lineTo(96, 119);
path187.lineTo(234.66666666666666, 119);
gBounds = path187.getBounds();
_runPathTest(path187);
gFillType = path187.fillType;
allPaths.add(path187);
}
void pathOps188() {
final Path path188 = Path();
path188.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 139), Radius.zero));
gBounds = path188.getBounds();
allPaths.add(path188);
}
void pathOps189() {
final Path path189 = Path();
path189.reset();
path189.moveTo(234.66666666666666, 139);
path189.lineTo(96, 139);
path189.lineTo(96, 138);
path189.lineTo(234.66666666666666, 138);
gBounds = path189.getBounds();
_runPathTest(path189);
gFillType = path189.fillType;
allPaths.add(path189);
}
void pathOps190() {
final Path path190 = Path();
path190.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 75), Radius.zero));
gBounds = path190.getBounds();
allPaths.add(path190);
}
void pathOps191() {
final Path path191 = Path();
path191.reset();
path191.moveTo(234.66666666666666, 75);
path191.lineTo(96, 75);
path191.lineTo(96, 74);
path191.lineTo(234.66666666666666, 74);
gBounds = path191.getBounds();
_runPathTest(path191);
gFillType = path191.fillType;
allPaths.add(path191);
}
void pathOps192() {
final Path path192 = Path();
path192.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path192.getBounds();
allPaths.add(path192);
}
void pathOps193() {
final Path path193 = Path();
path193.reset();
path193.moveTo(234.66666666666666, 90);
path193.lineTo(96, 90);
path193.lineTo(96, 89);
path193.lineTo(234.66666666666666, 89);
gBounds = path193.getBounds();
allPaths.add(path193);
}
void pathOps194() {
final Path path194 = Path();
path194.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 105), Radius.zero));
allPaths.add(path194);
}
void pathOps195() {
final Path path195 = Path();
path195.reset();
path195.moveTo(234.66666666666666, 105);
path195.lineTo(96, 105);
path195.lineTo(96, 104);
path195.lineTo(234.66666666666666, 104);
gBounds = path195.getBounds();
allPaths.add(path195);
}
void pathOps196() {
final Path path196 = Path();
path196.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path196.getBounds();
allPaths.add(path196);
}
void pathOps197() {
final Path path197 = Path();
path197.reset();
path197.moveTo(234.66666666666666, 90);
path197.lineTo(96, 90);
path197.lineTo(96, 89);
path197.lineTo(234.66666666666666, 89);
gBounds = path197.getBounds();
_runPathTest(path197);
gFillType = path197.fillType;
allPaths.add(path197);
}
void pathOps198() {
final Path path198 = Path();
path198.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path198.getBounds();
allPaths.add(path198);
}
void pathOps199() {
final Path path199 = Path();
path199.reset();
path199.moveTo(234.66666666666666, 90);
path199.lineTo(96, 90);
path199.lineTo(96, 89);
path199.lineTo(234.66666666666666, 89);
gBounds = path199.getBounds();
_runPathTest(path199);
gFillType = path199.fillType;
allPaths.add(path199);
}
void pathOps200() {
final Path path200 = Path();
path200.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path200.getBounds();
allPaths.add(path200);
}
void pathOps201() {
final Path path201 = Path();
path201.reset();
path201.moveTo(234.66666666666666, 90);
path201.lineTo(96, 90);
path201.lineTo(96, 89);
path201.lineTo(234.66666666666666, 89);
gBounds = path201.getBounds();
_runPathTest(path201);
gFillType = path201.fillType;
allPaths.add(path201);
}
void pathOps202() {
final Path path202 = Path();
path202.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path202.getBounds();
allPaths.add(path202);
}
void pathOps203() {
final Path path203 = Path();
path203.reset();
path203.moveTo(234.66666666666666, 90);
path203.lineTo(96, 90);
path203.lineTo(96, 89);
path203.lineTo(234.66666666666666, 89);
gBounds = path203.getBounds();
_runPathTest(path203);
gFillType = path203.fillType;
allPaths.add(path203);
}
void pathOps204() {
final Path path204 = Path();
path204.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path204.getBounds();
allPaths.add(path204);
}
void pathOps205() {
final Path path205 = Path();
path205.reset();
path205.moveTo(234.66666666666666, 90);
path205.lineTo(96, 90);
path205.lineTo(96, 89);
path205.lineTo(234.66666666666666, 89);
gBounds = path205.getBounds();
allPaths.add(path205);
}
void pathOps206() {
final Path path206 = Path();
path206.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 90), Radius.zero));
gBounds = path206.getBounds();
allPaths.add(path206);
}
void pathOps207() {
final Path path207 = Path();
path207.reset();
path207.moveTo(234.66666666666669, 90);
path207.lineTo(96, 90);
path207.lineTo(96, 89);
path207.lineTo(234.66666666666669, 89);
gBounds = path207.getBounds();
_runPathTest(path207);
gFillType = path207.fillType;
allPaths.add(path207);
}
void pathOps208() {
gBounds = path208.getBounds();
allPaths.add(path208);
}
void pathOps209() {
gBounds = path209.getBounds();
allPaths.add(path209);
}
void pathOps210() {
gBounds = path210.getBounds();
allPaths.add(path210);
}
void pathOps211() {
gBounds = path211.getBounds();
allPaths.add(path211);
}
void pathOps212() {
final Path path212 = Path();
path212.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 456, 54), const Radius.circular(10)));
gFillType = path212.fillType;
path213 = path212.shift(const Offset(32, 0));
gFillType = path212.fillType;
path290 = path212.shift(const Offset(32, 0));
gFillType = path212.fillType;
path334 = path212.shift(const Offset(32, 0));
gFillType = path212.fillType;
path595 = path212.shift(const Offset(32, 0));
allPaths.add(path212);
}
void pathOps213() {
gBounds = path213.getBounds();
allPaths.add(path213);
}
void pathOps214() {
final Path path214 = Path();
path214.reset();
path214.moveTo(56, 42);
path214.lineTo(56, 42);
path214.lineTo(58, 42);
path214.lineTo(58, 42);
gBounds = path214.getBounds();
allPaths.add(path214);
}
void pathOps215() {
final Path path215 = Path();
path215.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 456, 54), const Radius.circular(10)));
gFillType = path215.fillType;
path216 = path215.shift(const Offset(32, 0));
gFillType = path215.fillType;
path288 = path215.shift(const Offset(32, 0));
gFillType = path215.fillType;
path336 = path215.shift(const Offset(32, 0));
gFillType = path215.fillType;
path597 = path215.shift(const Offset(32, 0));
allPaths.add(path215);
}
void pathOps216() {
gBounds = path216.getBounds();
allPaths.add(path216);
}
void pathOps217() {
final Path path217 = Path();
path217.reset();
path217.moveTo(56, 42);
path217.lineTo(56, 42);
path217.lineTo(58, 42);
path217.lineTo(58, 42);
gBounds = path217.getBounds();
allPaths.add(path217);
}
void pathOps218() {
final Path path218 = Path();
path218.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 456, 54), const Radius.circular(10)));
gFillType = path218.fillType;
path219 = path218.shift(const Offset(32, 0));
gFillType = path218.fillType;
path286 = path218.shift(const Offset(32, 0));
gFillType = path218.fillType;
path338 = path218.shift(const Offset(32, 0));
gFillType = path218.fillType;
path599 = path218.shift(const Offset(32, 0));
allPaths.add(path218);
}
void pathOps219() {
gBounds = path219.getBounds();
allPaths.add(path219);
}
void pathOps220() {
final Path path220 = Path();
path220.reset();
path220.moveTo(56, 42);
path220.lineTo(56, 42);
path220.lineTo(58, 42);
path220.lineTo(58, 42);
gBounds = path220.getBounds();
allPaths.add(path220);
}
void pathOps221() {
final Path path221 = Path();
path221.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 456, 54), const Radius.circular(10)));
gFillType = path221.fillType;
path222 = path221.shift(const Offset(32, 0));
gFillType = path221.fillType;
path284 = path221.shift(const Offset(32, 0));
gFillType = path221.fillType;
path340 = path221.shift(const Offset(32, 0));
gFillType = path221.fillType;
path601 = path221.shift(const Offset(32, 0));
allPaths.add(path221);
}
void pathOps222() {
gBounds = path222.getBounds();
allPaths.add(path222);
}
void pathOps223() {
final Path path223 = Path();
path223.reset();
path223.moveTo(56, 42);
path223.lineTo(56, 42);
path223.lineTo(58, 42);
path223.lineTo(58, 42);
gBounds = path223.getBounds();
allPaths.add(path223);
}
void pathOps224() {
final Path path224 = Path();
path224.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 456, 51), const Radius.circular(10)));
gFillType = path224.fillType;
path225 = path224.shift(const Offset(32, 0));
gFillType = path224.fillType;
path281 = path224.shift(const Offset(32, 0));
gFillType = path224.fillType;
path344 = path224.shift(const Offset(32, 0));
allPaths.add(path224);
}
void pathOps225() {
gBounds = path225.getBounds();
allPaths.add(path225);
}
void pathOps226() {
final Path path226 = Path();
path226.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 456, 54), const Radius.circular(10)));
gFillType = path226.fillType;
path227 = path226.shift(const Offset(32, 0));
gFillType = path226.fillType;
path282 = path226.shift(const Offset(32, 0));
gFillType = path226.fillType;
path342 = path226.shift(const Offset(32, 0));
gFillType = path226.fillType;
path603 = path226.shift(const Offset(32, 0));
allPaths.add(path226);
}
void pathOps227() {
gBounds = path227.getBounds();
allPaths.add(path227);
}
void pathOps228() {
final Path path228 = Path();
path228.reset();
path228.moveTo(56, 42);
path228.lineTo(56, 42);
path228.lineTo(58, 42);
path228.lineTo(58, 42);
gBounds = path228.getBounds();
allPaths.add(path228);
}
void pathOps229() {
gBounds = path229.getBounds();
allPaths.add(path229);
}
void pathOps230() {
final Path path230 = Path();
path230.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path230.getBounds();
allPaths.add(path230);
}
void pathOps231() {
final Path path231 = Path();
path231.reset();
path231.moveTo(331.66666666666663, 86);
path231.lineTo(81, 86);
path231.lineTo(81, 84);
path231.lineTo(331.66666666666663, 84);
gBounds = path231.getBounds();
_runPathTest(path231);
gFillType = path231.fillType;
allPaths.add(path231);
}
void pathOps232() {
gBounds = path232.getBounds();
allPaths.add(path232);
}
void pathOps233() {
final Path path233 = Path();
path233.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path233.getBounds();
allPaths.add(path233);
}
void pathOps234() {
final Path path234 = Path();
path234.reset();
path234.moveTo(610.3333333333333, 86);
path234.lineTo(359.66666666666663, 86);
path234.lineTo(359.66666666666663, 84);
path234.lineTo(610.3333333333333, 84);
gBounds = path234.getBounds();
_runPathTest(path234);
gFillType = path234.fillType;
allPaths.add(path234);
}
void pathOps235() {
gBounds = path235.getBounds();
allPaths.add(path235);
}
void pathOps236() {
final Path path236 = Path();
path236.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path236.getBounds();
allPaths.add(path236);
}
void pathOps237() {
final Path path237 = Path();
path237.reset();
path237.moveTo(889, 86);
path237.lineTo(638.3333333333333, 86);
path237.lineTo(638.3333333333333, 84);
path237.lineTo(889, 84);
gBounds = path237.getBounds();
_runPathTest(path237);
gFillType = path237.fillType;
allPaths.add(path237);
}
void pathOps238() {
gBounds = path238.getBounds();
allPaths.add(path238);
}
void pathOps239() {
final Path path239 = Path();
path239.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 136, 970, 1144), Radius.zero));
gBounds = path239.getBounds();
gBounds = path239.getBounds();
gBounds = path239.getBounds();
allPaths.add(path239);
}
void pathOps240() {
gBounds = path240.getBounds();
gBounds = path240.getBounds();
gBounds = path240.getBounds();
allPaths.add(path240);
}
void pathOps241() {
final Path path241 = Path();
path241.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(450, 136, 970, 696), Radius.zero));
gBounds = path241.getBounds();
gBounds = path241.getBounds();
gBounds = path241.getBounds();
allPaths.add(path241);
}
void pathOps242() {
gBounds = path242.getBounds();
allPaths.add(path242);
}
void pathOps243() {
final Path path243 = Path();
path243.moveTo(-3.0000008960834634, -8.999999251003146);
path243.cubicTo(-3.0000008960834634, -10.64999886953342, -1.6500008722416055, -11.999999251003146, -8.960834634308412e-7, -11.999999251003146);
path243.cubicTo(-8.960834634308412e-7, -11.999999251003146, -8.960834634308412e-7, -11.999999251003146, -8.960834634308412e-7, -11.999999251003146);
path243.cubicTo(1.6499990800746787, -11.999999251003146, 2.9999991039165366, -10.64999886953342, 2.9999991039165366, -8.999999251003146);
path243.cubicTo(2.9999991039165366, -8.999999251003146, 2.9999991039165366, 9.000000748996854, 2.9999991039165366, 9.000000748996854);
path243.cubicTo(2.9999991039165366, 10.650000367527127, 1.6499990800746787, 12.000000748996854, -8.960834634308412e-7, 12.000000748996854);
path243.cubicTo(-8.960834634308412e-7, 12.000000748996854, -8.960834634308412e-7, 12.000000748996854, -8.960834634308412e-7, 12.000000748996854);
path243.cubicTo(-1.6500008722416055, 12.000000748996854, -3.0000008960834634, 10.650000367527127, -3.0000008960834634, 9.000000748996854);
path243.cubicTo(-3.0000008960834634, 9.000000748996854, -3.0000008960834634, -8.999999251003146, -3.0000008960834634, -8.999999251003146);
path243.close();
allPaths.add(path243);
}
void pathOps244() {
final Path path244 = Path();
path244.moveTo(-2.0000008960834634, -9.999999251003146);
path244.cubicTo(-2.0000008960834634, -11.099999632472873, -1.1000009199253213, -11.999999251003146, -8.960834634308412e-7, -11.999999251003146);
path244.cubicTo(-8.960834634308412e-7, -11.999999251003146, -8.960834634308412e-7, -11.999999251003146, -8.960834634308412e-7, -11.999999251003146);
path244.cubicTo(1.0999991277583945, -11.999999251003146, 1.9999991039165366, -11.099999632472873, 1.9999991039165366, -9.999999251003146);
path244.cubicTo(1.9999991039165366, -9.999999251003146, 1.9999991039165366, 10.000000748996854, 1.9999991039165366, 10.000000748996854);
path244.cubicTo(1.9999991039165366, 11.10000113046658, 1.0999991277583945, 12.000000748996854, -8.960834634308412e-7, 12.000000748996854);
path244.cubicTo(-8.960834634308412e-7, 12.000000748996854, -8.960834634308412e-7, 12.000000748996854, -8.960834634308412e-7, 12.000000748996854);
path244.cubicTo(-1.1000009199253213, 12.000000748996854, -2.0000008960834634, 11.10000113046658, -2.0000008960834634, 10.000000748996854);
path244.cubicTo(-2.0000008960834634, 10.000000748996854, -2.0000008960834634, -9.999999251003146, -2.0000008960834634, -9.999999251003146);
path244.close();
allPaths.add(path244);
}
void pathOps245() {
final Path path245 = Path();
path245.moveTo(2.0000006178626677, 7.489968538720859e-7);
path245.cubicTo(2.0000006178626677, 1.1100007633019686, 1.1000006417045256, 2.000000748996854, 6.178626676955901e-7, 2.000000748996854);
path245.cubicTo(-1.109999396442447, 2.000000748996854, -1.9999993821373323, 1.1100007633019686, -1.9999993821373323, 7.489968538720859e-7);
path245.cubicTo(-1.9999993821373323, -1.099999274845004, -1.109999396442447, -1.9999992510031461, 6.178626676955901e-7, -1.9999992510031461);
path245.cubicTo(1.1000006417045256, -1.9999992510031461, 2.0000006178626677, -1.099999274845004, 2.0000006178626677, 7.489968538720859e-7);
allPaths.add(path245);
}
void pathOps246() {
final Path path246 = Path();
path246.moveTo(-3.0000008960834634, -9.000000721237882);
path246.cubicTo(-3.0000008960834634, -10.650000339768155, -1.6500008722416055, -12.000000721237882, -8.960834634308412e-7, -12.000000721237882);
path246.cubicTo(-8.960834634308412e-7, -12.000000721237882, -8.960834634308412e-7, -12.000000721237882, -8.960834634308412e-7, -12.000000721237882);
path246.cubicTo(1.6499990800746787, -12.000000721237882, 2.9999991039165366, -10.650000339768155, 2.9999991039165366, -9.000000721237882);
path246.cubicTo(2.9999991039165366, -9.000000721237882, 2.9999991039165366, 8.999999278762118, 2.9999991039165366, 8.999999278762118);
path246.cubicTo(2.9999991039165366, 10.649998897292392, 1.6499990800746787, 11.999999278762118, -8.960834634308412e-7, 11.999999278762118);
path246.cubicTo(-8.960834634308412e-7, 11.999999278762118, -8.960834634308412e-7, 11.999999278762118, -8.960834634308412e-7, 11.999999278762118);
path246.cubicTo(-1.6500008722416055, 11.999999278762118, -3.0000008960834634, 10.649998897292392, -3.0000008960834634, 8.999999278762118);
path246.cubicTo(-3.0000008960834634, 8.999999278762118, -3.0000008960834634, -9.000000721237882, -3.0000008960834634, -9.000000721237882);
path246.close();
allPaths.add(path246);
}
void pathOps247() {
final Path path247 = Path();
path247.moveTo(-2.0000008960834634, -10.000000721237882);
path247.cubicTo(-2.0000008960834634, -11.100001102707608, -1.1000009199253213, -12.000000721237882, -8.960834634308412e-7, -12.000000721237882);
path247.cubicTo(-8.960834634308412e-7, -12.000000721237882, -8.960834634308412e-7, -12.000000721237882, -8.960834634308412e-7, -12.000000721237882);
path247.cubicTo(1.0999991277583945, -12.000000721237882, 1.9999991039165366, -11.100001102707608, 1.9999991039165366, -10.000000721237882);
path247.cubicTo(1.9999991039165366, -10.000000721237882, 1.9999991039165366, 9.999999278762118, 1.9999991039165366, 9.999999278762118);
path247.cubicTo(1.9999991039165366, 11.099999660231845, 1.0999991277583945, 11.999999278762118, -8.960834634308412e-7, 11.999999278762118);
path247.cubicTo(-8.960834634308412e-7, 11.999999278762118, -8.960834634308412e-7, 11.999999278762118, -8.960834634308412e-7, 11.999999278762118);
path247.cubicTo(-1.1000009199253213, 11.999999278762118, -2.0000008960834634, 11.099999660231845, -2.0000008960834634, 9.999999278762118);
path247.cubicTo(-2.0000008960834634, 9.999999278762118, -2.0000008960834634, -10.000000721237882, -2.0000008960834634, -10.000000721237882);
path247.close();
allPaths.add(path247);
}
void pathOps248() {
final Path path248 = Path();
path248.moveTo(-2.0000005026809617, 2.324364061223605e-7);
path248.cubicTo(-2.0000005026809617, -1.0999997914054518, -1.1000005265228197, -1.9999997675635939, -5.026809617447725e-7, -1.9999997675635939);
path248.cubicTo(1.0999995211608962, -1.9999997675635939, 1.9999994973190383, -1.0999997914054518, 1.9999994973190383, 2.324364061223605e-7);
path248.cubicTo(1.9999994973190383, 1.100000256278264, 1.0999995211608962, 2.000000232436406, -5.026809617447725e-7, 2.000000232436406);
path248.cubicTo(-1.1000005265228197, 2.000000232436406, -2.0000005026809617, 1.100000256278264, -2.0000005026809617, 2.324364061223605e-7);
allPaths.add(path248);
}
void pathOps249() {
final Path path249 = Path();
path249.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path249.getBounds();
allPaths.add(path249);
}
void pathOps250() {
final Path path250 = Path();
path250.reset();
path250.moveTo(234.66666666666666, 90);
path250.lineTo(96, 90);
path250.lineTo(96, 89);
path250.lineTo(234.66666666666666, 89);
gBounds = path250.getBounds();
allPaths.add(path250);
}
void pathOps251() {
final Path path251 = Path();
path251.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 105), Radius.zero));
gBounds = path251.getBounds();
allPaths.add(path251);
}
void pathOps252() {
final Path path252 = Path();
path252.reset();
path252.moveTo(234.66666666666669, 105);
path252.lineTo(96, 105);
path252.lineTo(96, 104);
path252.lineTo(234.66666666666669, 104);
gBounds = path252.getBounds();
_runPathTest(path252);
gFillType = path252.fillType;
allPaths.add(path252);
}
void pathOps253() {
final Path path253 = Path();
path253.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 90), Radius.zero));
gBounds = path253.getBounds();
allPaths.add(path253);
}
void pathOps254() {
final Path path254 = Path();
path254.reset();
path254.moveTo(234.66666666666669, 90);
path254.lineTo(96, 90);
path254.lineTo(96, 89);
path254.lineTo(234.66666666666669, 89);
gBounds = path254.getBounds();
_runPathTest(path254);
gFillType = path254.fillType;
allPaths.add(path254);
}
void pathOps255() {
final Path path255 = Path();
path255.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path255.getBounds();
allPaths.add(path255);
}
void pathOps256() {
final Path path256 = Path();
path256.reset();
path256.moveTo(234.66666666666666, 90);
path256.lineTo(96, 90);
path256.lineTo(96, 89);
path256.lineTo(234.66666666666666, 89);
gBounds = path256.getBounds();
allPaths.add(path256);
}
void pathOps257() {
final Path path257 = Path();
path257.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path257.getBounds();
allPaths.add(path257);
}
void pathOps258() {
final Path path258 = Path();
path258.reset();
path258.moveTo(234.66666666666666, 90);
path258.lineTo(96, 90);
path258.lineTo(96, 89);
path258.lineTo(234.66666666666666, 89);
gBounds = path258.getBounds();
_runPathTest(path258);
gFillType = path258.fillType;
allPaths.add(path258);
}
void pathOps259() {
final Path path259 = Path();
path259.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 105), Radius.zero));
gBounds = path259.getBounds();
allPaths.add(path259);
}
void pathOps260() {
final Path path260 = Path();
path260.reset();
path260.moveTo(234.66666666666666, 105);
path260.lineTo(96, 105);
path260.lineTo(96, 104);
path260.lineTo(234.66666666666666, 104);
gBounds = path260.getBounds();
_runPathTest(path260);
gFillType = path260.fillType;
allPaths.add(path260);
}
void pathOps261() {
final Path path261 = Path();
path261.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path261.getBounds();
allPaths.add(path261);
}
void pathOps262() {
final Path path262 = Path();
path262.reset();
path262.moveTo(234.66666666666666, 90);
path262.lineTo(96, 90);
path262.lineTo(96, 89);
path262.lineTo(234.66666666666666, 89);
gBounds = path262.getBounds();
_runPathTest(path262);
gFillType = path262.fillType;
allPaths.add(path262);
}
void pathOps263() {
final Path path263 = Path();
path263.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path263.getBounds();
allPaths.add(path263);
}
void pathOps264() {
final Path path264 = Path();
path264.reset();
path264.moveTo(234.66666666666666, 90);
path264.lineTo(96, 90);
path264.lineTo(96, 89);
path264.lineTo(234.66666666666666, 89);
gBounds = path264.getBounds();
_runPathTest(path264);
gFillType = path264.fillType;
allPaths.add(path264);
}
void pathOps265() {
final Path path265 = Path();
path265.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path265.getBounds();
allPaths.add(path265);
}
void pathOps266() {
final Path path266 = Path();
path266.reset();
path266.moveTo(234.66666666666666, 90);
path266.lineTo(96, 90);
path266.lineTo(96, 89);
path266.lineTo(234.66666666666666, 89);
gBounds = path266.getBounds();
_runPathTest(path266);
gFillType = path266.fillType;
allPaths.add(path266);
}
void pathOps267() {
final Path path267 = Path();
path267.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 75), Radius.zero));
gBounds = path267.getBounds();
allPaths.add(path267);
}
void pathOps268() {
final Path path268 = Path();
path268.reset();
path268.moveTo(234.66666666666666, 75);
path268.lineTo(96, 75);
path268.lineTo(96, 74);
path268.lineTo(234.66666666666666, 74);
gBounds = path268.getBounds();
_runPathTest(path268);
gFillType = path268.fillType;
allPaths.add(path268);
}
void pathOps269() {
final Path path269 = Path();
path269.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 105), Radius.zero));
gBounds = path269.getBounds();
allPaths.add(path269);
}
void pathOps270() {
final Path path270 = Path();
path270.reset();
path270.moveTo(234.66666666666666, 105);
path270.lineTo(96, 105);
path270.lineTo(96, 104);
path270.lineTo(234.66666666666666, 104);
gBounds = path270.getBounds();
allPaths.add(path270);
}
void pathOps271() {
final Path path271 = Path();
path271.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 139), Radius.zero));
gBounds = path271.getBounds();
allPaths.add(path271);
}
void pathOps272() {
final Path path272 = Path();
path272.reset();
path272.moveTo(234.66666666666666, 139);
path272.lineTo(96, 139);
path272.lineTo(96, 138);
path272.lineTo(234.66666666666666, 138);
gBounds = path272.getBounds();
_runPathTest(path272);
gFillType = path272.fillType;
allPaths.add(path272);
}
void pathOps273() {
final Path path273 = Path();
path273.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 120), Radius.zero));
gBounds = path273.getBounds();
allPaths.add(path273);
}
void pathOps274() {
final Path path274 = Path();
path274.reset();
path274.moveTo(234.66666666666666, 120);
path274.lineTo(96, 120);
path274.lineTo(96, 119);
path274.lineTo(234.66666666666666, 119);
gBounds = path274.getBounds();
_runPathTest(path274);
gFillType = path274.fillType;
allPaths.add(path274);
}
void pathOps275() {
final Path path275 = Path();
path275.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 94), Radius.zero));
gBounds = path275.getBounds();
allPaths.add(path275);
}
void pathOps276() {
final Path path276 = Path();
path276.reset();
path276.moveTo(234.66666666666669, 94);
path276.lineTo(96, 94);
path276.lineTo(96, 93);
path276.lineTo(234.66666666666669, 93);
gBounds = path276.getBounds();
_runPathTest(path276);
gFillType = path276.fillType;
allPaths.add(path276);
}
void pathOps277() {
gBounds = path277.getBounds();
allPaths.add(path277);
}
void pathOps278() {
gBounds = path278.getBounds();
allPaths.add(path278);
}
void pathOps279() {
gBounds = path279.getBounds();
allPaths.add(path279);
}
void pathOps280() {
gBounds = path280.getBounds();
allPaths.add(path280);
}
void pathOps281() {
gBounds = path281.getBounds();
allPaths.add(path281);
}
void pathOps282() {
gBounds = path282.getBounds();
allPaths.add(path282);
}
void pathOps283() {
final Path path283 = Path();
path283.reset();
path283.moveTo(56, 42);
path283.lineTo(56, 42);
path283.lineTo(58, 42);
path283.lineTo(58, 42);
gBounds = path283.getBounds();
allPaths.add(path283);
}
void pathOps284() {
gBounds = path284.getBounds();
allPaths.add(path284);
}
void pathOps285() {
final Path path285 = Path();
path285.reset();
path285.moveTo(56, 42);
path285.lineTo(56, 42);
path285.lineTo(58, 42);
path285.lineTo(58, 42);
gBounds = path285.getBounds();
allPaths.add(path285);
}
void pathOps286() {
gBounds = path286.getBounds();
allPaths.add(path286);
}
void pathOps287() {
final Path path287 = Path();
path287.reset();
path287.moveTo(56, 42);
path287.lineTo(56, 42);
path287.lineTo(58, 42);
path287.lineTo(58, 42);
gBounds = path287.getBounds();
allPaths.add(path287);
}
void pathOps288() {
gBounds = path288.getBounds();
allPaths.add(path288);
}
void pathOps289() {
final Path path289 = Path();
path289.reset();
path289.moveTo(56, 42);
path289.lineTo(56, 42);
path289.lineTo(58, 42);
path289.lineTo(58, 42);
gBounds = path289.getBounds();
allPaths.add(path289);
}
void pathOps290() {
gBounds = path290.getBounds();
allPaths.add(path290);
}
void pathOps291() {
final Path path291 = Path();
path291.reset();
path291.moveTo(56, 42);
path291.lineTo(56, 42);
path291.lineTo(58, 42);
path291.lineTo(58, 42);
gBounds = path291.getBounds();
allPaths.add(path291);
}
void pathOps292() {
gBounds = path292.getBounds();
allPaths.add(path292);
}
void pathOps293() {
final Path path293 = Path();
path293.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path293.getBounds();
allPaths.add(path293);
}
void pathOps294() {
final Path path294 = Path();
path294.reset();
path294.moveTo(331.66666666666663, 86);
path294.lineTo(81, 86);
path294.lineTo(81, 84);
path294.lineTo(331.66666666666663, 84);
gBounds = path294.getBounds();
_runPathTest(path294);
gFillType = path294.fillType;
allPaths.add(path294);
}
void pathOps295() {
gBounds = path295.getBounds();
allPaths.add(path295);
}
void pathOps296() {
final Path path296 = Path();
path296.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path296.getBounds();
allPaths.add(path296);
}
void pathOps297() {
final Path path297 = Path();
path297.reset();
path297.moveTo(610.3333333333333, 86);
path297.lineTo(359.66666666666663, 86);
path297.lineTo(359.66666666666663, 84);
path297.lineTo(610.3333333333333, 84);
gBounds = path297.getBounds();
_runPathTest(path297);
gFillType = path297.fillType;
allPaths.add(path297);
}
void pathOps298() {
gBounds = path298.getBounds();
allPaths.add(path298);
}
void pathOps299() {
final Path path299 = Path();
path299.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path299.getBounds();
allPaths.add(path299);
}
void pathOps300() {
final Path path300 = Path();
path300.reset();
path300.moveTo(889, 86);
path300.lineTo(638.3333333333333, 86);
path300.lineTo(638.3333333333333, 84);
path300.lineTo(889, 84);
gBounds = path300.getBounds();
_runPathTest(path300);
gFillType = path300.fillType;
allPaths.add(path300);
}
void pathOps301() {
gBounds = path301.getBounds();
allPaths.add(path301);
}
void pathOps302() {
final Path path302 = Path();
path302.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 94), Radius.zero));
gBounds = path302.getBounds();
allPaths.add(path302);
}
void pathOps303() {
final Path path303 = Path();
path303.reset();
path303.moveTo(234.66666666666669, 94);
path303.lineTo(96, 94);
path303.lineTo(96, 93);
path303.lineTo(234.66666666666669, 93);
gBounds = path303.getBounds();
_runPathTest(path303);
gFillType = path303.fillType;
allPaths.add(path303);
}
void pathOps304() {
final Path path304 = Path();
path304.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 105), Radius.zero));
gBounds = path304.getBounds();
allPaths.add(path304);
}
void pathOps305() {
final Path path305 = Path();
path305.reset();
path305.moveTo(234.66666666666666, 105);
path305.lineTo(96, 105);
path305.lineTo(96, 104);
path305.lineTo(234.66666666666666, 104);
gBounds = path305.getBounds();
allPaths.add(path305);
}
void pathOps306() {
final Path path306 = Path();
path306.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 105), Radius.zero));
gBounds = path306.getBounds();
allPaths.add(path306);
}
void pathOps307() {
final Path path307 = Path();
path307.reset();
path307.moveTo(234.66666666666669, 105);
path307.lineTo(96, 105);
path307.lineTo(96, 104);
path307.lineTo(234.66666666666669, 104);
gBounds = path307.getBounds();
_runPathTest(path307);
gFillType = path307.fillType;
allPaths.add(path307);
}
void pathOps308() {
final Path path308 = Path();
path308.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 105), Radius.zero));
gBounds = path308.getBounds();
allPaths.add(path308);
}
void pathOps309() {
final Path path309 = Path();
path309.reset();
path309.moveTo(234.66666666666666, 105);
path309.lineTo(96, 105);
path309.lineTo(96, 104);
path309.lineTo(234.66666666666666, 104);
gBounds = path309.getBounds();
_runPathTest(path309);
gFillType = path309.fillType;
allPaths.add(path309);
}
void pathOps310() {
final Path path310 = Path();
path310.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 120), Radius.zero));
gBounds = path310.getBounds();
allPaths.add(path310);
}
void pathOps311() {
final Path path311 = Path();
path311.reset();
path311.moveTo(234.66666666666666, 120);
path311.lineTo(96, 120);
path311.lineTo(96, 119);
path311.lineTo(234.66666666666666, 119);
gBounds = path311.getBounds();
_runPathTest(path311);
gFillType = path311.fillType;
allPaths.add(path311);
}
void pathOps312() {
final Path path312 = Path();
path312.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 139), Radius.zero));
gBounds = path312.getBounds();
allPaths.add(path312);
}
void pathOps313() {
final Path path313 = Path();
path313.reset();
path313.moveTo(234.66666666666666, 139);
path313.lineTo(96, 139);
path313.lineTo(96, 138);
path313.lineTo(234.66666666666666, 138);
gBounds = path313.getBounds();
_runPathTest(path313);
gFillType = path313.fillType;
allPaths.add(path313);
}
void pathOps314() {
final Path path314 = Path();
path314.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 75), Radius.zero));
gBounds = path314.getBounds();
allPaths.add(path314);
}
void pathOps315() {
final Path path315 = Path();
path315.reset();
path315.moveTo(234.66666666666666, 75);
path315.lineTo(96, 75);
path315.lineTo(96, 74);
path315.lineTo(234.66666666666666, 74);
gBounds = path315.getBounds();
_runPathTest(path315);
gFillType = path315.fillType;
allPaths.add(path315);
}
void pathOps316() {
final Path path316 = Path();
path316.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path316.getBounds();
allPaths.add(path316);
}
void pathOps317() {
final Path path317 = Path();
path317.reset();
path317.moveTo(234.66666666666666, 90);
path317.lineTo(96, 90);
path317.lineTo(96, 89);
path317.lineTo(234.66666666666666, 89);
gBounds = path317.getBounds();
allPaths.add(path317);
}
void pathOps318() {
final Path path318 = Path();
path318.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path318.getBounds();
allPaths.add(path318);
}
void pathOps319() {
final Path path319 = Path();
path319.reset();
path319.moveTo(234.66666666666666, 90);
path319.lineTo(96, 90);
path319.lineTo(96, 89);
path319.lineTo(234.66666666666666, 89);
gBounds = path319.getBounds();
_runPathTest(path319);
gFillType = path319.fillType;
allPaths.add(path319);
}
void pathOps320() {
final Path path320 = Path();
path320.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path320.getBounds();
allPaths.add(path320);
}
void pathOps321() {
final Path path321 = Path();
path321.reset();
path321.moveTo(234.66666666666666, 90);
path321.lineTo(96, 90);
path321.lineTo(96, 89);
path321.lineTo(234.66666666666666, 89);
gBounds = path321.getBounds();
_runPathTest(path321);
gFillType = path321.fillType;
allPaths.add(path321);
}
void pathOps322() {
final Path path322 = Path();
path322.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path322.getBounds();
allPaths.add(path322);
}
void pathOps323() {
final Path path323 = Path();
path323.reset();
path323.moveTo(234.66666666666666, 90);
path323.lineTo(96, 90);
path323.lineTo(96, 89);
path323.lineTo(234.66666666666666, 89);
gBounds = path323.getBounds();
_runPathTest(path323);
gFillType = path323.fillType;
allPaths.add(path323);
}
void pathOps324() {
final Path path324 = Path();
path324.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path324.getBounds();
allPaths.add(path324);
}
void pathOps325() {
final Path path325 = Path();
path325.reset();
path325.moveTo(234.66666666666666, 90);
path325.lineTo(96, 90);
path325.lineTo(96, 89);
path325.lineTo(234.66666666666666, 89);
gBounds = path325.getBounds();
_runPathTest(path325);
gFillType = path325.fillType;
allPaths.add(path325);
}
void pathOps326() {
final Path path326 = Path();
path326.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 90), Radius.zero));
gBounds = path326.getBounds();
allPaths.add(path326);
}
void pathOps327() {
final Path path327 = Path();
path327.reset();
path327.moveTo(234.66666666666666, 90);
path327.lineTo(96, 90);
path327.lineTo(96, 89);
path327.lineTo(234.66666666666666, 89);
gBounds = path327.getBounds();
allPaths.add(path327);
}
void pathOps328() {
final Path path328 = Path();
path328.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666669, 90), Radius.zero));
gBounds = path328.getBounds();
allPaths.add(path328);
}
void pathOps329() {
final Path path329 = Path();
path329.reset();
path329.moveTo(234.66666666666669, 90);
path329.lineTo(96, 90);
path329.lineTo(96, 89);
path329.lineTo(234.66666666666669, 89);
gBounds = path329.getBounds();
_runPathTest(path329);
gFillType = path329.fillType;
allPaths.add(path329);
}
void pathOps330() {
gBounds = path330.getBounds();
allPaths.add(path330);
}
void pathOps331() {
gBounds = path331.getBounds();
allPaths.add(path331);
}
void pathOps332() {
gBounds = path332.getBounds();
allPaths.add(path332);
}
void pathOps333() {
gBounds = path333.getBounds();
allPaths.add(path333);
}
void pathOps334() {
gBounds = path334.getBounds();
allPaths.add(path334);
}
void pathOps335() {
final Path path335 = Path();
path335.reset();
path335.moveTo(56, 42);
path335.lineTo(56, 42);
path335.lineTo(58, 42);
path335.lineTo(58, 42);
gBounds = path335.getBounds();
allPaths.add(path335);
}
void pathOps336() {
gBounds = path336.getBounds();
allPaths.add(path336);
}
void pathOps337() {
final Path path337 = Path();
path337.reset();
path337.moveTo(56, 42);
path337.lineTo(56, 42);
path337.lineTo(58, 42);
path337.lineTo(58, 42);
gBounds = path337.getBounds();
allPaths.add(path337);
}
void pathOps338() {
gBounds = path338.getBounds();
allPaths.add(path338);
}
void pathOps339() {
final Path path339 = Path();
path339.reset();
path339.moveTo(56, 42);
path339.lineTo(56, 42);
path339.lineTo(58, 42);
path339.lineTo(58, 42);
gBounds = path339.getBounds();
allPaths.add(path339);
}
void pathOps340() {
gBounds = path340.getBounds();
allPaths.add(path340);
}
void pathOps341() {
final Path path341 = Path();
path341.reset();
path341.moveTo(56, 42);
path341.lineTo(56, 42);
path341.lineTo(58, 42);
path341.lineTo(58, 42);
gBounds = path341.getBounds();
allPaths.add(path341);
}
void pathOps342() {
gBounds = path342.getBounds();
allPaths.add(path342);
}
void pathOps343() {
final Path path343 = Path();
path343.reset();
path343.moveTo(56, 42);
path343.lineTo(56, 42);
path343.lineTo(58, 42);
path343.lineTo(58, 42);
gBounds = path343.getBounds();
allPaths.add(path343);
}
void pathOps344() {
gBounds = path344.getBounds();
allPaths.add(path344);
}
void pathOps345() {
gBounds = path345.getBounds();
allPaths.add(path345);
}
void pathOps346() {
gBounds = path346.getBounds();
allPaths.add(path346);
}
void pathOps347() {
final Path path347 = Path();
path347.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path347.getBounds();
allPaths.add(path347);
}
void pathOps348() {
final Path path348 = Path();
path348.reset();
path348.moveTo(331.66666666666663, 86);
path348.lineTo(81, 86);
path348.lineTo(81, 84);
path348.lineTo(331.66666666666663, 84);
gBounds = path348.getBounds();
_runPathTest(path348);
gFillType = path348.fillType;
allPaths.add(path348);
}
void pathOps349() {
gBounds = path349.getBounds();
allPaths.add(path349);
}
void pathOps350() {
final Path path350 = Path();
path350.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path350.getBounds();
allPaths.add(path350);
}
void pathOps351() {
final Path path351 = Path();
path351.reset();
path351.moveTo(610.3333333333333, 86);
path351.lineTo(359.66666666666663, 86);
path351.lineTo(359.66666666666663, 84);
path351.lineTo(610.3333333333333, 84);
gBounds = path351.getBounds();
_runPathTest(path351);
gFillType = path351.fillType;
allPaths.add(path351);
}
void pathOps352() {
gBounds = path352.getBounds();
allPaths.add(path352);
}
void pathOps353() {
final Path path353 = Path();
path353.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path353.getBounds();
allPaths.add(path353);
}
void pathOps354() {
final Path path354 = Path();
path354.reset();
path354.moveTo(889, 86);
path354.lineTo(638.3333333333333, 86);
path354.lineTo(638.3333333333333, 84);
path354.lineTo(889, 84);
gBounds = path354.getBounds();
_runPathTest(path354);
gFillType = path354.fillType;
allPaths.add(path354);
}
void pathOps355() {
final Path path355 = Path();
path355.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 136, 970, 1144), Radius.zero));
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
gBounds = path355.getBounds();
allPaths.add(path355);
}
void pathOps356() {
gBounds = path356.getBounds();
allPaths.add(path356);
}
void pathOps357() {
final Path path357 = Path();
path357.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(450, 136, 970, 696), Radius.zero));
gBounds = path357.getBounds();
allPaths.add(path357);
}
void pathOps358() {
gBounds = path358.getBounds();
allPaths.add(path358);
}
void pathOps359() {
gBounds = path359.getBounds();
allPaths.add(path359);
}
void pathOps360() {
gBounds = path360.getBounds();
allPaths.add(path360);
}
void pathOps361() {
gBounds = path361.getBounds();
allPaths.add(path361);
}
void pathOps362() {
gBounds = path362.getBounds();
allPaths.add(path362);
}
void pathOps363() {
gBounds = path363.getBounds();
allPaths.add(path363);
}
void pathOps364() {
final Path path364 = Path();
path364.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path364.getBounds();
allPaths.add(path364);
}
void pathOps365() {
final Path path365 = Path();
path365.reset();
path365.moveTo(331.66666666666663, 86);
path365.lineTo(81, 86);
path365.lineTo(81, 84);
path365.lineTo(331.66666666666663, 84);
gBounds = path365.getBounds();
_runPathTest(path365);
gFillType = path365.fillType;
allPaths.add(path365);
}
void pathOps366() {
gBounds = path366.getBounds();
allPaths.add(path366);
}
void pathOps367() {
final Path path367 = Path();
path367.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path367.getBounds();
allPaths.add(path367);
}
void pathOps368() {
final Path path368 = Path();
path368.reset();
path368.moveTo(610.3333333333333, 86);
path368.lineTo(359.66666666666663, 86);
path368.lineTo(359.66666666666663, 84);
path368.lineTo(610.3333333333333, 84);
gBounds = path368.getBounds();
_runPathTest(path368);
gFillType = path368.fillType;
allPaths.add(path368);
}
void pathOps369() {
gBounds = path369.getBounds();
allPaths.add(path369);
}
void pathOps370() {
final Path path370 = Path();
path370.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path370.getBounds();
allPaths.add(path370);
}
void pathOps371() {
final Path path371 = Path();
path371.reset();
path371.moveTo(889, 86);
path371.lineTo(638.3333333333333, 86);
path371.lineTo(638.3333333333333, 84);
path371.lineTo(889, 84);
gBounds = path371.getBounds();
_runPathTest(path371);
gFillType = path371.fillType;
allPaths.add(path371);
}
void pathOps372() {
gBounds = path372.getBounds();
allPaths.add(path372);
}
void pathOps373() {
gBounds = path373.getBounds();
allPaths.add(path373);
}
void pathOps374() {
gBounds = path374.getBounds();
allPaths.add(path374);
}
void pathOps375() {
gBounds = path375.getBounds();
allPaths.add(path375);
}
void pathOps376() {
gBounds = path376.getBounds();
allPaths.add(path376);
}
void pathOps377() {
final Path path377 = Path();
path377.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path377.getBounds();
allPaths.add(path377);
}
void pathOps378() {
final Path path378 = Path();
path378.reset();
path378.moveTo(331.66666666666663, 86);
path378.lineTo(81, 86);
path378.lineTo(81, 84);
path378.lineTo(331.66666666666663, 84);
gBounds = path378.getBounds();
_runPathTest(path378);
gFillType = path378.fillType;
allPaths.add(path378);
}
void pathOps379() {
gBounds = path379.getBounds();
allPaths.add(path379);
}
void pathOps380() {
final Path path380 = Path();
path380.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path380.getBounds();
allPaths.add(path380);
}
void pathOps381() {
final Path path381 = Path();
path381.reset();
path381.moveTo(610.3333333333333, 86);
path381.lineTo(359.66666666666663, 86);
path381.lineTo(359.66666666666663, 84);
path381.lineTo(610.3333333333333, 84);
gBounds = path381.getBounds();
_runPathTest(path381);
gFillType = path381.fillType;
allPaths.add(path381);
}
void pathOps382() {
gBounds = path382.getBounds();
allPaths.add(path382);
}
void pathOps383() {
final Path path383 = Path();
path383.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path383.getBounds();
allPaths.add(path383);
}
void pathOps384() {
final Path path384 = Path();
path384.reset();
path384.moveTo(889, 86);
path384.lineTo(638.3333333333333, 86);
path384.lineTo(638.3333333333333, 84);
path384.lineTo(889, 84);
gBounds = path384.getBounds();
_runPathTest(path384);
gFillType = path384.fillType;
allPaths.add(path384);
}
void pathOps385() {
gBounds = path385.getBounds();
allPaths.add(path385);
}
void pathOps386() {
gBounds = path386.getBounds();
allPaths.add(path386);
}
void pathOps387() {
gBounds = path387.getBounds();
allPaths.add(path387);
}
void pathOps388() {
gBounds = path388.getBounds();
allPaths.add(path388);
}
void pathOps389() {
gBounds = path389.getBounds();
allPaths.add(path389);
}
void pathOps390() {
final Path path390 = Path();
path390.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path390.getBounds();
allPaths.add(path390);
}
void pathOps391() {
final Path path391 = Path();
path391.reset();
path391.moveTo(331.66666666666663, 86);
path391.lineTo(81, 86);
path391.lineTo(81, 84);
path391.lineTo(331.66666666666663, 84);
gBounds = path391.getBounds();
_runPathTest(path391);
gFillType = path391.fillType;
allPaths.add(path391);
}
void pathOps392() {
gBounds = path392.getBounds();
allPaths.add(path392);
}
void pathOps393() {
final Path path393 = Path();
path393.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path393.getBounds();
allPaths.add(path393);
}
void pathOps394() {
final Path path394 = Path();
path394.reset();
path394.moveTo(610.3333333333333, 86);
path394.lineTo(359.66666666666663, 86);
path394.lineTo(359.66666666666663, 84);
path394.lineTo(610.3333333333333, 84);
gBounds = path394.getBounds();
_runPathTest(path394);
gFillType = path394.fillType;
allPaths.add(path394);
}
void pathOps395() {
gBounds = path395.getBounds();
allPaths.add(path395);
}
void pathOps396() {
final Path path396 = Path();
path396.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path396.getBounds();
allPaths.add(path396);
}
void pathOps397() {
final Path path397 = Path();
path397.reset();
path397.moveTo(889, 86);
path397.lineTo(638.3333333333333, 86);
path397.lineTo(638.3333333333333, 84);
path397.lineTo(889, 84);
gBounds = path397.getBounds();
_runPathTest(path397);
gFillType = path397.fillType;
allPaths.add(path397);
}
void pathOps398() {
gBounds = path398.getBounds();
allPaths.add(path398);
}
void pathOps399() {
gBounds = path399.getBounds();
allPaths.add(path399);
}
void pathOps400() {
gBounds = path400.getBounds();
allPaths.add(path400);
}
void pathOps401() {
gBounds = path401.getBounds();
allPaths.add(path401);
}
void pathOps402() {
gBounds = path402.getBounds();
allPaths.add(path402);
}
void pathOps403() {
final Path path403 = Path();
path403.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path403.getBounds();
allPaths.add(path403);
}
void pathOps404() {
final Path path404 = Path();
path404.reset();
path404.moveTo(331.66666666666663, 86);
path404.lineTo(81, 86);
path404.lineTo(81, 84);
path404.lineTo(331.66666666666663, 84);
gBounds = path404.getBounds();
_runPathTest(path404);
gFillType = path404.fillType;
allPaths.add(path404);
}
void pathOps405() {
gBounds = path405.getBounds();
allPaths.add(path405);
}
void pathOps406() {
final Path path406 = Path();
path406.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path406.getBounds();
allPaths.add(path406);
}
void pathOps407() {
final Path path407 = Path();
path407.reset();
path407.moveTo(610.3333333333333, 86);
path407.lineTo(359.66666666666663, 86);
path407.lineTo(359.66666666666663, 84);
path407.lineTo(610.3333333333333, 84);
gBounds = path407.getBounds();
_runPathTest(path407);
gFillType = path407.fillType;
allPaths.add(path407);
}
void pathOps408() {
gBounds = path408.getBounds();
allPaths.add(path408);
}
void pathOps409() {
final Path path409 = Path();
path409.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path409.getBounds();
allPaths.add(path409);
}
void pathOps410() {
final Path path410 = Path();
path410.reset();
path410.moveTo(889, 86);
path410.lineTo(638.3333333333333, 86);
path410.lineTo(638.3333333333333, 84);
path410.lineTo(889, 84);
gBounds = path410.getBounds();
_runPathTest(path410);
gFillType = path410.fillType;
allPaths.add(path410);
}
void pathOps411() {
gBounds = path411.getBounds();
allPaths.add(path411);
}
void pathOps412() {
gBounds = path412.getBounds();
allPaths.add(path412);
}
void pathOps413() {
gBounds = path413.getBounds();
allPaths.add(path413);
}
void pathOps414() {
gBounds = path414.getBounds();
allPaths.add(path414);
}
void pathOps415() {
gBounds = path415.getBounds();
allPaths.add(path415);
}
void pathOps416() {
final Path path416 = Path();
path416.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path416.getBounds();
allPaths.add(path416);
}
void pathOps417() {
final Path path417 = Path();
path417.reset();
path417.moveTo(331.66666666666663, 86);
path417.lineTo(81, 86);
path417.lineTo(81, 84);
path417.lineTo(331.66666666666663, 84);
gBounds = path417.getBounds();
_runPathTest(path417);
gFillType = path417.fillType;
allPaths.add(path417);
}
void pathOps418() {
gBounds = path418.getBounds();
allPaths.add(path418);
}
void pathOps419() {
final Path path419 = Path();
path419.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path419.getBounds();
allPaths.add(path419);
}
void pathOps420() {
final Path path420 = Path();
path420.reset();
path420.moveTo(610.3333333333333, 86);
path420.lineTo(359.66666666666663, 86);
path420.lineTo(359.66666666666663, 84);
path420.lineTo(610.3333333333333, 84);
gBounds = path420.getBounds();
_runPathTest(path420);
gFillType = path420.fillType;
allPaths.add(path420);
}
void pathOps421() {
gBounds = path421.getBounds();
allPaths.add(path421);
}
void pathOps422() {
final Path path422 = Path();
path422.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path422.getBounds();
allPaths.add(path422);
}
void pathOps423() {
final Path path423 = Path();
path423.reset();
path423.moveTo(889, 86);
path423.lineTo(638.3333333333333, 86);
path423.lineTo(638.3333333333333, 84);
path423.lineTo(889, 84);
gBounds = path423.getBounds();
_runPathTest(path423);
gFillType = path423.fillType;
allPaths.add(path423);
}
void pathOps424() {
gBounds = path424.getBounds();
allPaths.add(path424);
}
void pathOps425() {
gBounds = path425.getBounds();
allPaths.add(path425);
}
void pathOps426() {
gBounds = path426.getBounds();
allPaths.add(path426);
}
void pathOps427() {
gBounds = path427.getBounds();
allPaths.add(path427);
}
void pathOps428() {
gBounds = path428.getBounds();
allPaths.add(path428);
}
void pathOps429() {
final Path path429 = Path();
path429.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path429.getBounds();
allPaths.add(path429);
}
void pathOps430() {
final Path path430 = Path();
path430.reset();
path430.moveTo(331.66666666666663, 86);
path430.lineTo(81, 86);
path430.lineTo(81, 84);
path430.lineTo(331.66666666666663, 84);
gBounds = path430.getBounds();
_runPathTest(path430);
gFillType = path430.fillType;
allPaths.add(path430);
}
void pathOps431() {
gBounds = path431.getBounds();
allPaths.add(path431);
}
void pathOps432() {
final Path path432 = Path();
path432.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path432.getBounds();
allPaths.add(path432);
}
void pathOps433() {
final Path path433 = Path();
path433.reset();
path433.moveTo(610.3333333333333, 86);
path433.lineTo(359.66666666666663, 86);
path433.lineTo(359.66666666666663, 84);
path433.lineTo(610.3333333333333, 84);
gBounds = path433.getBounds();
_runPathTest(path433);
gFillType = path433.fillType;
allPaths.add(path433);
}
void pathOps434() {
gBounds = path434.getBounds();
allPaths.add(path434);
}
void pathOps435() {
final Path path435 = Path();
path435.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path435.getBounds();
allPaths.add(path435);
}
void pathOps436() {
final Path path436 = Path();
path436.reset();
path436.moveTo(889, 86);
path436.lineTo(638.3333333333333, 86);
path436.lineTo(638.3333333333333, 84);
path436.lineTo(889, 84);
gBounds = path436.getBounds();
_runPathTest(path436);
gFillType = path436.fillType;
allPaths.add(path436);
}
void pathOps437() {
gBounds = path437.getBounds();
allPaths.add(path437);
}
void pathOps438() {
gBounds = path438.getBounds();
allPaths.add(path438);
}
void pathOps439() {
gBounds = path439.getBounds();
allPaths.add(path439);
}
void pathOps440() {
gBounds = path440.getBounds();
allPaths.add(path440);
}
void pathOps441() {
gBounds = path441.getBounds();
allPaths.add(path441);
}
void pathOps442() {
final Path path442 = Path();
path442.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path442.getBounds();
allPaths.add(path442);
}
void pathOps443() {
final Path path443 = Path();
path443.reset();
path443.moveTo(331.66666666666663, 86);
path443.lineTo(81, 86);
path443.lineTo(81, 84);
path443.lineTo(331.66666666666663, 84);
gBounds = path443.getBounds();
_runPathTest(path443);
gFillType = path443.fillType;
allPaths.add(path443);
}
void pathOps444() {
gBounds = path444.getBounds();
allPaths.add(path444);
}
void pathOps445() {
final Path path445 = Path();
path445.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path445.getBounds();
allPaths.add(path445);
}
void pathOps446() {
final Path path446 = Path();
path446.reset();
path446.moveTo(610.3333333333333, 86);
path446.lineTo(359.66666666666663, 86);
path446.lineTo(359.66666666666663, 84);
path446.lineTo(610.3333333333333, 84);
gBounds = path446.getBounds();
_runPathTest(path446);
gFillType = path446.fillType;
allPaths.add(path446);
}
void pathOps447() {
gBounds = path447.getBounds();
allPaths.add(path447);
}
void pathOps448() {
final Path path448 = Path();
path448.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path448.getBounds();
allPaths.add(path448);
}
void pathOps449() {
final Path path449 = Path();
path449.reset();
path449.moveTo(889, 86);
path449.lineTo(638.3333333333333, 86);
path449.lineTo(638.3333333333333, 84);
path449.lineTo(889, 84);
gBounds = path449.getBounds();
_runPathTest(path449);
gFillType = path449.fillType;
allPaths.add(path449);
}
void pathOps450() {
gBounds = path450.getBounds();
allPaths.add(path450);
}
void pathOps451() {
gBounds = path451.getBounds();
allPaths.add(path451);
}
void pathOps452() {
gBounds = path452.getBounds();
allPaths.add(path452);
}
void pathOps453() {
gBounds = path453.getBounds();
allPaths.add(path453);
}
void pathOps454() {
gBounds = path454.getBounds();
allPaths.add(path454);
}
void pathOps455() {
final Path path455 = Path();
path455.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path455.getBounds();
allPaths.add(path455);
}
void pathOps456() {
final Path path456 = Path();
path456.reset();
path456.moveTo(331.66666666666663, 86);
path456.lineTo(81, 86);
path456.lineTo(81, 84);
path456.lineTo(331.66666666666663, 84);
gBounds = path456.getBounds();
_runPathTest(path456);
gFillType = path456.fillType;
allPaths.add(path456);
}
void pathOps457() {
gBounds = path457.getBounds();
allPaths.add(path457);
}
void pathOps458() {
final Path path458 = Path();
path458.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path458.getBounds();
allPaths.add(path458);
}
void pathOps459() {
final Path path459 = Path();
path459.reset();
path459.moveTo(610.3333333333333, 86);
path459.lineTo(359.66666666666663, 86);
path459.lineTo(359.66666666666663, 84);
path459.lineTo(610.3333333333333, 84);
gBounds = path459.getBounds();
_runPathTest(path459);
gFillType = path459.fillType;
allPaths.add(path459);
}
void pathOps460() {
gBounds = path460.getBounds();
allPaths.add(path460);
}
void pathOps461() {
final Path path461 = Path();
path461.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path461.getBounds();
allPaths.add(path461);
}
void pathOps462() {
final Path path462 = Path();
path462.reset();
path462.moveTo(889, 86);
path462.lineTo(638.3333333333333, 86);
path462.lineTo(638.3333333333333, 84);
path462.lineTo(889, 84);
gBounds = path462.getBounds();
_runPathTest(path462);
gFillType = path462.fillType;
allPaths.add(path462);
}
void pathOps463() {
gBounds = path463.getBounds();
allPaths.add(path463);
}
void pathOps464() {
gBounds = path464.getBounds();
allPaths.add(path464);
}
void pathOps465() {
gBounds = path465.getBounds();
allPaths.add(path465);
}
void pathOps466() {
gBounds = path466.getBounds();
allPaths.add(path466);
}
void pathOps467() {
gBounds = path467.getBounds();
allPaths.add(path467);
}
void pathOps468() {
final Path path468 = Path();
path468.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path468.getBounds();
allPaths.add(path468);
}
void pathOps469() {
final Path path469 = Path();
path469.reset();
path469.moveTo(331.66666666666663, 86);
path469.lineTo(81, 86);
path469.lineTo(81, 84);
path469.lineTo(331.66666666666663, 84);
gBounds = path469.getBounds();
_runPathTest(path469);
gFillType = path469.fillType;
allPaths.add(path469);
}
void pathOps470() {
gBounds = path470.getBounds();
allPaths.add(path470);
}
void pathOps471() {
final Path path471 = Path();
path471.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path471.getBounds();
allPaths.add(path471);
}
void pathOps472() {
final Path path472 = Path();
path472.reset();
path472.moveTo(610.3333333333333, 86);
path472.lineTo(359.66666666666663, 86);
path472.lineTo(359.66666666666663, 84);
path472.lineTo(610.3333333333333, 84);
gBounds = path472.getBounds();
_runPathTest(path472);
gFillType = path472.fillType;
allPaths.add(path472);
}
void pathOps473() {
gBounds = path473.getBounds();
allPaths.add(path473);
}
void pathOps474() {
final Path path474 = Path();
path474.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path474.getBounds();
allPaths.add(path474);
}
void pathOps475() {
final Path path475 = Path();
path475.reset();
path475.moveTo(889, 86);
path475.lineTo(638.3333333333333, 86);
path475.lineTo(638.3333333333333, 84);
path475.lineTo(889, 84);
gBounds = path475.getBounds();
_runPathTest(path475);
gFillType = path475.fillType;
allPaths.add(path475);
}
void pathOps476() {
gBounds = path476.getBounds();
allPaths.add(path476);
}
void pathOps477() {
gBounds = path477.getBounds();
allPaths.add(path477);
}
void pathOps478() {
gBounds = path478.getBounds();
allPaths.add(path478);
}
void pathOps479() {
gBounds = path479.getBounds();
allPaths.add(path479);
}
void pathOps480() {
gBounds = path480.getBounds();
allPaths.add(path480);
}
void pathOps481() {
final Path path481 = Path();
path481.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path481.getBounds();
allPaths.add(path481);
}
void pathOps482() {
final Path path482 = Path();
path482.reset();
path482.moveTo(331.66666666666663, 86);
path482.lineTo(81, 86);
path482.lineTo(81, 84);
path482.lineTo(331.66666666666663, 84);
gBounds = path482.getBounds();
_runPathTest(path482);
gFillType = path482.fillType;
allPaths.add(path482);
}
void pathOps483() {
gBounds = path483.getBounds();
allPaths.add(path483);
}
void pathOps484() {
final Path path484 = Path();
path484.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path484.getBounds();
allPaths.add(path484);
}
void pathOps485() {
final Path path485 = Path();
path485.reset();
path485.moveTo(610.3333333333333, 86);
path485.lineTo(359.66666666666663, 86);
path485.lineTo(359.66666666666663, 84);
path485.lineTo(610.3333333333333, 84);
gBounds = path485.getBounds();
_runPathTest(path485);
gFillType = path485.fillType;
allPaths.add(path485);
}
void pathOps486() {
gBounds = path486.getBounds();
allPaths.add(path486);
}
void pathOps487() {
final Path path487 = Path();
path487.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path487.getBounds();
allPaths.add(path487);
}
void pathOps488() {
final Path path488 = Path();
path488.reset();
path488.moveTo(889, 86);
path488.lineTo(638.3333333333333, 86);
path488.lineTo(638.3333333333333, 84);
path488.lineTo(889, 84);
gBounds = path488.getBounds();
_runPathTest(path488);
gFillType = path488.fillType;
allPaths.add(path488);
}
void pathOps489() {
gBounds = path489.getBounds();
allPaths.add(path489);
}
void pathOps490() {
gBounds = path490.getBounds();
allPaths.add(path490);
}
void pathOps491() {
gBounds = path491.getBounds();
allPaths.add(path491);
}
void pathOps492() {
gBounds = path492.getBounds();
allPaths.add(path492);
}
void pathOps493() {
gBounds = path493.getBounds();
allPaths.add(path493);
}
void pathOps494() {
final Path path494 = Path();
path494.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path494.getBounds();
allPaths.add(path494);
}
void pathOps495() {
final Path path495 = Path();
path495.reset();
path495.moveTo(331.66666666666663, 86);
path495.lineTo(81, 86);
path495.lineTo(81, 84);
path495.lineTo(331.66666666666663, 84);
gBounds = path495.getBounds();
_runPathTest(path495);
gFillType = path495.fillType;
allPaths.add(path495);
}
void pathOps496() {
gBounds = path496.getBounds();
allPaths.add(path496);
}
void pathOps497() {
final Path path497 = Path();
path497.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path497.getBounds();
allPaths.add(path497);
}
void pathOps498() {
final Path path498 = Path();
path498.reset();
path498.moveTo(610.3333333333333, 86);
path498.lineTo(359.66666666666663, 86);
path498.lineTo(359.66666666666663, 84);
path498.lineTo(610.3333333333333, 84);
gBounds = path498.getBounds();
_runPathTest(path498);
gFillType = path498.fillType;
allPaths.add(path498);
}
void pathOps499() {
gBounds = path499.getBounds();
allPaths.add(path499);
}
void pathOps500() {
final Path path500 = Path();
path500.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path500.getBounds();
allPaths.add(path500);
}
void pathOps501() {
final Path path501 = Path();
path501.reset();
path501.moveTo(889, 86);
path501.lineTo(638.3333333333333, 86);
path501.lineTo(638.3333333333333, 84);
path501.lineTo(889, 84);
gBounds = path501.getBounds();
_runPathTest(path501);
gFillType = path501.fillType;
allPaths.add(path501);
}
void pathOps502() {
gBounds = path502.getBounds();
allPaths.add(path502);
}
void pathOps503() {
gBounds = path503.getBounds();
allPaths.add(path503);
}
void pathOps504() {
gBounds = path504.getBounds();
allPaths.add(path504);
}
void pathOps505() {
gBounds = path505.getBounds();
allPaths.add(path505);
}
void pathOps506() {
gBounds = path506.getBounds();
allPaths.add(path506);
}
void pathOps507() {
final Path path507 = Path();
path507.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path507.getBounds();
allPaths.add(path507);
}
void pathOps508() {
final Path path508 = Path();
path508.reset();
path508.moveTo(331.66666666666663, 86);
path508.lineTo(81, 86);
path508.lineTo(81, 84);
path508.lineTo(331.66666666666663, 84);
gBounds = path508.getBounds();
_runPathTest(path508);
gFillType = path508.fillType;
allPaths.add(path508);
}
void pathOps509() {
gBounds = path509.getBounds();
allPaths.add(path509);
}
void pathOps510() {
final Path path510 = Path();
path510.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path510.getBounds();
allPaths.add(path510);
}
void pathOps511() {
final Path path511 = Path();
path511.reset();
path511.moveTo(610.3333333333333, 86);
path511.lineTo(359.66666666666663, 86);
path511.lineTo(359.66666666666663, 84);
path511.lineTo(610.3333333333333, 84);
gBounds = path511.getBounds();
_runPathTest(path511);
gFillType = path511.fillType;
allPaths.add(path511);
}
void pathOps512() {
gBounds = path512.getBounds();
allPaths.add(path512);
}
void pathOps513() {
final Path path513 = Path();
path513.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path513.getBounds();
allPaths.add(path513);
}
void pathOps514() {
final Path path514 = Path();
path514.reset();
path514.moveTo(889, 86);
path514.lineTo(638.3333333333333, 86);
path514.lineTo(638.3333333333333, 84);
path514.lineTo(889, 84);
gBounds = path514.getBounds();
_runPathTest(path514);
gFillType = path514.fillType;
allPaths.add(path514);
}
void pathOps515() {
gBounds = path515.getBounds();
allPaths.add(path515);
}
void pathOps516() {
gBounds = path516.getBounds();
allPaths.add(path516);
}
void pathOps517() {
gBounds = path517.getBounds();
allPaths.add(path517);
}
void pathOps518() {
gBounds = path518.getBounds();
allPaths.add(path518);
}
void pathOps519() {
gBounds = path519.getBounds();
allPaths.add(path519);
}
void pathOps520() {
final Path path520 = Path();
path520.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path520.getBounds();
allPaths.add(path520);
}
void pathOps521() {
final Path path521 = Path();
path521.reset();
path521.moveTo(331.66666666666663, 86);
path521.lineTo(81, 86);
path521.lineTo(81, 84);
path521.lineTo(331.66666666666663, 84);
gBounds = path521.getBounds();
_runPathTest(path521);
gFillType = path521.fillType;
allPaths.add(path521);
}
void pathOps522() {
gBounds = path522.getBounds();
allPaths.add(path522);
}
void pathOps523() {
final Path path523 = Path();
path523.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path523.getBounds();
allPaths.add(path523);
}
void pathOps524() {
final Path path524 = Path();
path524.reset();
path524.moveTo(610.3333333333333, 86);
path524.lineTo(359.66666666666663, 86);
path524.lineTo(359.66666666666663, 84);
path524.lineTo(610.3333333333333, 84);
gBounds = path524.getBounds();
_runPathTest(path524);
gFillType = path524.fillType;
allPaths.add(path524);
}
void pathOps525() {
gBounds = path525.getBounds();
allPaths.add(path525);
}
void pathOps526() {
final Path path526 = Path();
path526.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path526.getBounds();
allPaths.add(path526);
}
void pathOps527() {
final Path path527 = Path();
path527.reset();
path527.moveTo(889, 86);
path527.lineTo(638.3333333333333, 86);
path527.lineTo(638.3333333333333, 84);
path527.lineTo(889, 84);
gBounds = path527.getBounds();
_runPathTest(path527);
gFillType = path527.fillType;
allPaths.add(path527);
}
void pathOps528() {
gBounds = path528.getBounds();
allPaths.add(path528);
}
void pathOps529() {
gBounds = path529.getBounds();
allPaths.add(path529);
}
void pathOps530() {
gBounds = path530.getBounds();
allPaths.add(path530);
}
void pathOps531() {
gBounds = path531.getBounds();
allPaths.add(path531);
}
void pathOps532() {
gBounds = path532.getBounds();
allPaths.add(path532);
}
void pathOps533() {
final Path path533 = Path();
path533.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path533.getBounds();
allPaths.add(path533);
}
void pathOps534() {
final Path path534 = Path();
path534.reset();
path534.moveTo(331.66666666666663, 86);
path534.lineTo(81, 86);
path534.lineTo(81, 84);
path534.lineTo(331.66666666666663, 84);
gBounds = path534.getBounds();
_runPathTest(path534);
gFillType = path534.fillType;
allPaths.add(path534);
}
void pathOps535() {
gBounds = path535.getBounds();
allPaths.add(path535);
}
void pathOps536() {
final Path path536 = Path();
path536.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path536.getBounds();
allPaths.add(path536);
}
void pathOps537() {
final Path path537 = Path();
path537.reset();
path537.moveTo(610.3333333333333, 86);
path537.lineTo(359.66666666666663, 86);
path537.lineTo(359.66666666666663, 84);
path537.lineTo(610.3333333333333, 84);
gBounds = path537.getBounds();
_runPathTest(path537);
gFillType = path537.fillType;
allPaths.add(path537);
}
void pathOps538() {
gBounds = path538.getBounds();
allPaths.add(path538);
}
void pathOps539() {
final Path path539 = Path();
path539.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path539.getBounds();
allPaths.add(path539);
}
void pathOps540() {
final Path path540 = Path();
path540.reset();
path540.moveTo(889, 86);
path540.lineTo(638.3333333333333, 86);
path540.lineTo(638.3333333333333, 84);
path540.lineTo(889, 84);
gBounds = path540.getBounds();
_runPathTest(path540);
gFillType = path540.fillType;
allPaths.add(path540);
}
void pathOps541() {
gBounds = path541.getBounds();
allPaths.add(path541);
}
void pathOps542() {
gBounds = path542.getBounds();
allPaths.add(path542);
}
void pathOps543() {
gBounds = path543.getBounds();
allPaths.add(path543);
}
void pathOps544() {
gBounds = path544.getBounds();
allPaths.add(path544);
}
void pathOps545() {
gBounds = path545.getBounds();
allPaths.add(path545);
}
void pathOps546() {
final Path path546 = Path();
path546.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path546.getBounds();
allPaths.add(path546);
}
void pathOps547() {
final Path path547 = Path();
path547.reset();
path547.moveTo(331.66666666666663, 86);
path547.lineTo(81, 86);
path547.lineTo(81, 84);
path547.lineTo(331.66666666666663, 84);
gBounds = path547.getBounds();
_runPathTest(path547);
gFillType = path547.fillType;
allPaths.add(path547);
}
void pathOps548() {
gBounds = path548.getBounds();
allPaths.add(path548);
}
void pathOps549() {
final Path path549 = Path();
path549.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path549.getBounds();
allPaths.add(path549);
}
void pathOps550() {
final Path path550 = Path();
path550.reset();
path550.moveTo(610.3333333333333, 86);
path550.lineTo(359.66666666666663, 86);
path550.lineTo(359.66666666666663, 84);
path550.lineTo(610.3333333333333, 84);
gBounds = path550.getBounds();
_runPathTest(path550);
gFillType = path550.fillType;
allPaths.add(path550);
}
void pathOps551() {
gBounds = path551.getBounds();
allPaths.add(path551);
}
void pathOps552() {
final Path path552 = Path();
path552.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path552.getBounds();
allPaths.add(path552);
}
void pathOps553() {
final Path path553 = Path();
path553.reset();
path553.moveTo(889, 86);
path553.lineTo(638.3333333333333, 86);
path553.lineTo(638.3333333333333, 84);
path553.lineTo(889, 84);
gBounds = path553.getBounds();
_runPathTest(path553);
gFillType = path553.fillType;
allPaths.add(path553);
}
void pathOps554() {
gBounds = path554.getBounds();
allPaths.add(path554);
}
void pathOps555() {
gBounds = path555.getBounds();
allPaths.add(path555);
}
void pathOps556() {
gBounds = path556.getBounds();
allPaths.add(path556);
}
void pathOps557() {
gBounds = path557.getBounds();
allPaths.add(path557);
}
void pathOps558() {
gBounds = path558.getBounds();
gBounds = path558.getBounds();
gBounds = path558.getBounds();
gBounds = path558.getBounds();
gBounds = path558.getBounds();
gBounds = path558.getBounds();
gBounds = path558.getBounds();
gBounds = path558.getBounds();
allPaths.add(path558);
}
void pathOps559() {
final Path path559 = Path();
path559.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(81, 0, 331.66666666666663, 84), Radius.zero));
gBounds = path559.getBounds();
allPaths.add(path559);
}
void pathOps560() {
final Path path560 = Path();
path560.reset();
path560.moveTo(331.66666666666663, 86);
path560.lineTo(81, 86);
path560.lineTo(81, 84);
path560.lineTo(331.66666666666663, 84);
gBounds = path560.getBounds();
_runPathTest(path560);
gFillType = path560.fillType;
allPaths.add(path560);
}
void pathOps561() {
gBounds = path561.getBounds();
allPaths.add(path561);
}
void pathOps562() {
final Path path562 = Path();
path562.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(359.66666666666663, 0, 610.3333333333333, 84), Radius.zero));
gBounds = path562.getBounds();
allPaths.add(path562);
}
void pathOps563() {
final Path path563 = Path();
path563.reset();
path563.moveTo(610.3333333333333, 86);
path563.lineTo(359.66666666666663, 86);
path563.lineTo(359.66666666666663, 84);
path563.lineTo(610.3333333333333, 84);
gBounds = path563.getBounds();
_runPathTest(path563);
gFillType = path563.fillType;
allPaths.add(path563);
}
void pathOps564() {
gBounds = path564.getBounds();
allPaths.add(path564);
}
void pathOps565() {
final Path path565 = Path();
path565.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(638.3333333333333, 0, 889, 84), Radius.zero));
gBounds = path565.getBounds();
allPaths.add(path565);
}
void pathOps566() {
final Path path566 = Path();
path566.reset();
path566.moveTo(889, 86);
path566.lineTo(638.3333333333333, 86);
path566.lineTo(638.3333333333333, 84);
path566.lineTo(889, 84);
gBounds = path566.getBounds();
_runPathTest(path566);
gFillType = path566.fillType;
allPaths.add(path566);
}
void pathOps567() {
final Path path567 = Path();
path567.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 120), Radius.zero));
gBounds = path567.getBounds();
allPaths.add(path567);
}
void pathOps568() {
final Path path568 = Path();
path568.reset();
path568.moveTo(234.66666666666666, 120);
path568.lineTo(96, 120);
path568.lineTo(96, 119);
path568.lineTo(234.66666666666666, 119);
gBounds = path568.getBounds();
_runPathTest(path568);
gFillType = path568.fillType;
allPaths.add(path568);
}
void pathOps569() {
final Path path569 = Path();
path569.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 120), Radius.zero));
gBounds = path569.getBounds();
allPaths.add(path569);
}
void pathOps570() {
final Path path570 = Path();
path570.reset();
path570.moveTo(234.66666666666666, 120);
path570.lineTo(96, 120);
path570.lineTo(96, 119);
path570.lineTo(234.66666666666666, 119);
gBounds = path570.getBounds();
_runPathTest(path570);
gFillType = path570.fillType;
allPaths.add(path570);
}
void pathOps571() {
final Path path571 = Path();
path571.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(116.39999999999999, 136, 853.6, 1144), Radius.zero));
gBounds = path571.getBounds();
allPaths.add(path571);
}
void pathOps572() {
final Path path572 = Path();
path572.addRRect(RRect.fromRectAndCorners(const Rect.fromLTRB(0, 0, 312.6, 880), topLeft: const Radius.circular(10), topRight: const Radius.circular(10), bottomLeft: const Radius.circular(2), bottomRight: const Radius.circular(2), ));
gFillType = path572.fillType;
path573 = path572.shift(const Offset(525, 248));
allPaths.add(path572);
}
void pathOps573() {
gBounds = path573.getBounds();
allPaths.add(path573);
}
void pathOps574() {
final Path path574 = Path();
path574.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(525, 248, 837.6, 1128), Radius.zero));
gBounds = path574.getBounds();
allPaths.add(path574);
}
void pathOps575() {
final Path path575 = Path();
path575.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(525, 248, 837.6, 304), Radius.zero));
gBounds = path575.getBounds();
allPaths.add(path575);
}
void pathOps576() {
final Path path576 = Path();
path576.moveTo(0, 0);
path576.lineTo(220.60000000000002, 0);
path576.quadraticBezierTo(235.60000000000002, 0, 237.569696969697, 7.817946907441011);
path576.arcToPoint(const Offset(299.630303030303, 7.817946907441011), radius: const Radius.circular(32), clockwise: false);
path576.quadraticBezierTo(301.6, 0, 316.6, 0);
path576.lineTo(312.6, 0);
path576.lineTo(312.6, 48);
path576.lineTo(0, 48);
path576.close();
gFillType = path576.fillType;
path577 = path576.shift(const Offset(525, 1080));
allPaths.add(path576);
}
void pathOps577() {
gBounds = path577.getBounds();
allPaths.add(path577);
}
void pathOps578() {
final Path path578 = Path();
path578.addOval(const Rect.fromLTRB(0, 0, 56, 56));
gFillType = path578.fillType;
path579 = path578.shift(const Offset(765.6, 1052));
allPaths.add(path578);
}
void pathOps579() {
gBounds = path579.getBounds();
allPaths.add(path579);
}
void pathOps580() {
final Path path580 = Path();
path580.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(116.39999999999999, 136, 853.6, 192), Radius.zero));
gBounds = path580.getBounds();
allPaths.add(path580);
}
void pathOps581() {
final Path path581 = Path();
path581.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 120), Radius.zero));
gBounds = path581.getBounds();
allPaths.add(path581);
}
void pathOps582() {
final Path path582 = Path();
path582.reset();
path582.moveTo(234.66666666666666, 120);
path582.lineTo(96, 120);
path582.lineTo(96, 119);
path582.lineTo(234.66666666666666, 119);
gBounds = path582.getBounds();
_runPathTest(path582);
gFillType = path582.fillType;
allPaths.add(path582);
}
void pathOps583() {
final Path path583 = Path();
path583.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 120), Radius.zero));
gBounds = path583.getBounds();
allPaths.add(path583);
}
void pathOps584() {
final Path path584 = Path();
path584.reset();
path584.moveTo(234.66666666666666, 120);
path584.lineTo(96, 120);
path584.lineTo(96, 119);
path584.lineTo(234.66666666666666, 119);
gBounds = path584.getBounds();
_runPathTest(path584);
gFillType = path584.fillType;
allPaths.add(path584);
}
void pathOps585() {
final Path path585 = Path();
path585.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 120), Radius.zero));
gBounds = path585.getBounds();
allPaths.add(path585);
}
void pathOps586() {
final Path path586 = Path();
path586.reset();
path586.moveTo(234.66666666666666, 120);
path586.lineTo(96, 120);
path586.lineTo(96, 119);
path586.lineTo(234.66666666666666, 119);
gBounds = path586.getBounds();
_runPathTest(path586);
gFillType = path586.fillType;
allPaths.add(path586);
}
void pathOps587() {
final Path path587 = Path();
path587.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 120), Radius.zero));
gBounds = path587.getBounds();
allPaths.add(path587);
}
void pathOps588() {
final Path path588 = Path();
path588.reset();
path588.moveTo(234.66666666666666, 120);
path588.lineTo(96, 120);
path588.lineTo(96, 119);
path588.lineTo(234.66666666666666, 119);
gBounds = path588.getBounds();
_runPathTest(path588);
gFillType = path588.fillType;
allPaths.add(path588);
}
void pathOps589() {
final Path path589 = Path();
path589.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 0, 250.66666666666666, 120), Radius.zero));
gBounds = path589.getBounds();
allPaths.add(path589);
}
void pathOps590() {
final Path path590 = Path();
path590.reset();
path590.moveTo(234.66666666666666, 120);
path590.lineTo(96, 120);
path590.lineTo(96, 119);
path590.lineTo(234.66666666666666, 119);
gBounds = path590.getBounds();
_runPathTest(path590);
gFillType = path590.fillType;
allPaths.add(path590);
}
void pathOps596() {
final Path path596 = Path();
path596.reset();
path596.moveTo(56, 42);
path596.lineTo(56, 42);
path596.lineTo(58, 42);
path596.lineTo(58, 42);
gBounds = path596.getBounds();
allPaths.add(path596);
}
void pathOps598() {
final Path path598 = Path();
path598.reset();
path598.moveTo(56, 42);
path598.lineTo(56, 42);
path598.lineTo(58, 42);
path598.lineTo(58, 42);
gBounds = path598.getBounds();
allPaths.add(path598);
}
void pathOps600() {
final Path path600 = Path();
path600.reset();
path600.moveTo(56, 42);
path600.lineTo(56, 42);
path600.lineTo(58, 42);
path600.lineTo(58, 42);
gBounds = path600.getBounds();
allPaths.add(path600);
}
void pathOps602() {
final Path path602 = Path();
path602.reset();
path602.moveTo(56, 42);
path602.lineTo(56, 42);
path602.lineTo(58, 42);
path602.lineTo(58, 42);
gBounds = path602.getBounds();
allPaths.add(path602);
}
void pathOps604() {
final Path path604 = Path();
path604.reset();
path604.moveTo(56, 42);
path604.lineTo(56, 42);
path604.lineTo(58, 42);
path604.lineTo(58, 42);
gBounds = path604.getBounds();
allPaths.add(path604);
}
void pathOps605() {
final Path path605 = Path();
path605.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(0, 136, 970, 1144), Radius.zero));
allPaths.add(path605);
}
void pathOps607() {
final Path path607 = Path();
path607.addRRect(RRect.fromRectAndRadius(const Rect.fromLTRB(450, 136, 970, 696), Radius.zero));
allPaths.add(path607);
}
void _runPathTest(Path path) {
}
| flutter/dev/benchmarks/macrobenchmarks/lib/src/web/bench_paths_recording.dart/0 | {
"file_path": "flutter/dev/benchmarks/macrobenchmarks/lib/src/web/bench_paths_recording.dart",
"repo_id": "flutter",
"token_count": 62314
} | 648 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
Future<void> main() async {
const String fileName = 'animated_image';
test('Animate for 250 frames', () async {
final FlutterDriver driver = await FlutterDriver.connect();
await driver.forceGC();
final Timeline timeline = await driver.traceAction(() async {
await driver.requestData('waitForAnimation');
});
final TimelineSummary summary = TimelineSummary.summarize(timeline);
await summary.writeTimelineToFile(fileName, pretty: true);
await driver.close();
}, timeout: Timeout.none);
}
| flutter/dev/benchmarks/macrobenchmarks/test_driver/animated_image_test.dart/0 | {
"file_path": "flutter/dev/benchmarks/macrobenchmarks/test_driver/animated_image_test.dart",
"repo_id": "flutter",
"token_count": 243
} | 649 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
Future<void> main() async {
const String fileName = 'large_image_changer';
test('Animate for 20 seconds', () async {
final FlutterDriver driver = await FlutterDriver.connect();
await driver.forceGC();
final String targetPlatform = await driver.requestData('getTargetPlatform');
Timeline? timeline;
switch (targetPlatform) {
case 'TargetPlatform.iOS':
{
timeline = await driver.traceAction(() async {
await Future<void>.delayed(const Duration(seconds: 20));
});
}
case 'TargetPlatform.android':
{
// Just run for 20 seconds to collect memory usage. The widget itself
// animates during this time.
await Future<void>.delayed(const Duration(seconds: 20));
}
default:
throw UnsupportedError('Unsupported platform $targetPlatform');
}
if (timeline != null) {
final TimelineSummary summary = TimelineSummary.summarize(timeline);
await summary.writeTimelineToFile(fileName, pretty: true);
}
await driver.close();
}, timeout: Timeout.none);
}
| flutter/dev/benchmarks/macrobenchmarks/test_driver/large_image_changer_test.dart/0 | {
"file_path": "flutter/dev/benchmarks/macrobenchmarks/test_driver/large_image_changer_test.dart",
"repo_id": "flutter",
"token_count": 484
} | 650 |
{{flutter_js}}
{{flutter_build_config}}
_flutter.loader.load({
config: {
// Use the local CanvasKit bundle instead of the CDN to reduce test flakiness.
canvasKitBaseUrl: "/canvaskit/",
},
}); | flutter/dev/benchmarks/macrobenchmarks/web/flutter_bootstrap.js/0 | {
"file_path": "flutter/dev/benchmarks/macrobenchmarks/web/flutter_bootstrap.js",
"repo_id": "flutter",
"token_count": 74
} | 651 |
#include "Generated.xcconfig"
| flutter/dev/benchmarks/microbenchmarks/ios/Flutter/Release.xcconfig/0 | {
"file_path": "flutter/dev/benchmarks/microbenchmarks/ios/Flutter/Release.xcconfig",
"repo_id": "flutter",
"token_count": 12
} | 652 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart' show clampDouble;
import '../common.dart';
const int _kBatchSize = 100000;
const int _kNumIterations = 1000;
void main() {
assert(false,
"Don't run benchmarks in debug mode! Use 'flutter run --release'.");
final BenchmarkResultPrinter printer = BenchmarkResultPrinter();
final Stopwatch watch = Stopwatch();
{
final List<double> clampDoubleValues = <double>[];
for (int j = 0; j < _kNumIterations; ++j) {
double tally = 0;
watch.reset();
watch.start();
for (int i = 0; i < _kBatchSize; i += 1) {
tally += clampDouble(-1.0, 0.0, 1.0);
tally += clampDouble(2.0, 0.0, 1.0);
tally += clampDouble(0.0, 0.0, 1.0);
tally += clampDouble(double.nan, 0.0, 1.0);
}
watch.stop();
clampDoubleValues.add(watch.elapsedMicroseconds.toDouble() / _kBatchSize);
if (tally < 0.0) {
print("This shouldn't happen.");
}
}
printer.addResultStatistics(
description: 'clamp - clampDouble',
values: clampDoubleValues,
unit: 'us per iteration',
name: 'clamp_clampDouble',
);
}
{
final List<double> doubleClampValues = <double>[];
for (int j = 0; j < _kNumIterations; ++j) {
double tally = 0;
watch.reset();
watch.start();
for (int i = 0; i < _kBatchSize; i += 1) {
tally += -1.0.clamp(0.0, 1.0);
tally += 2.0.clamp(0.0, 1.0);
tally += 0.0.clamp(0.0, 1.0);
tally += double.nan.clamp(0.0, 1.0);
}
watch.stop();
doubleClampValues.add(watch.elapsedMicroseconds.toDouble() / _kBatchSize);
if (tally < 0.0) {
print("This shouldn't happen.");
}
}
printer.addResultStatistics(
description: 'clamp - Double.clamp',
values: doubleClampValues,
unit: 'us per iteration',
name: 'clamp_Double_clamp',
);
}
printer.printToStdout();
}
| flutter/dev/benchmarks/microbenchmarks/lib/foundation/clamp.dart/0 | {
"file_path": "flutter/dev/benchmarks/microbenchmarks/lib/foundation/clamp.dart",
"repo_id": "flutter",
"token_count": 897
} | 653 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
import '../common.dart';
const Duration kBenchmarkTime = Duration(seconds: 15);
// Use an Align to loosen the constraints.
final Widget intrinsicTextHeight = Directionality(
textDirection: TextDirection.ltr,
child: Align(
child: IntrinsicHeight(
child: Text('A' * 100),
),
),
);
Future<void> main() async {
assert(false, "Don't run benchmarks in debug mode! Use 'flutter run --release'.");
// We control the framePolicy below to prevent us from scheduling frames in
// the engine, so that the engine does not interfere with our timings.
final LiveTestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized() as LiveTestWidgetsFlutterBinding;
final Stopwatch watch = Stopwatch();
int iterations = 0;
await benchmarkWidgets((WidgetTester tester) async {
runApp(intrinsicTextHeight);
// Wait for the UI to stabilize.
await tester.pump(const Duration(seconds: 1));
final TestViewConfiguration big = TestViewConfiguration.fromView(
size: const Size(360.0, 640.0),
view: tester.view,
);
final TestViewConfiguration small = TestViewConfiguration.fromView(
size: const Size(100.0, 640.0),
view: tester.view,
);
final RenderView renderView = WidgetsBinding.instance.renderViews.single;
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.benchmark;
watch.start();
while (watch.elapsed < kBenchmarkTime) {
renderView.configuration = iterations.isEven ? big : small;
await tester.pumpBenchmark(Duration(milliseconds: iterations * 16));
iterations += 1;
}
watch.stop();
});
final BenchmarkResultPrinter printer = BenchmarkResultPrinter();
printer.addResult(
description: 'Text intrinsic height',
value: watch.elapsedMicroseconds / iterations,
unit: 'µs per iteration',
name: 'text_intrinsic_height_iteration',
);
printer.printToStdout();
}
| flutter/dev/benchmarks/microbenchmarks/lib/layout/text_intrinsic_bench.dart/0 | {
"file_path": "flutter/dev/benchmarks/microbenchmarks/lib/layout/text_intrinsic_bench.dart",
"repo_id": "flutter",
"token_count": 724
} | 654 |
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
| flutter/dev/benchmarks/multiple_flutters/android/app/src/main/res/drawable/ic_launcher_background.xml/0 | {
"file_path": "flutter/dev/benchmarks/multiple_flutters/android/app/src/main/res/drawable/ic_launcher_background.xml",
"repo_id": "flutter",
"token_count": 2664
} | 655 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('scrolling performance test', () {
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
await driver.waitUntilFirstFrameRasterized();
});
tearDownAll(() async {
driver.close();
});
Future<void> testScrollPerf(String listKey, String summaryName) async {
// The slight initial delay avoids starting the timing during a
// period of increased load on the device. Without this delay, the
// benchmark has greater noise.
// See: https://github.com/flutter/flutter/issues/19434
await Future<void>.delayed(const Duration(milliseconds: 250));
await driver.forceGC();
final Timeline timeline = await driver.traceAction(() async {
// Find the scrollable stock list
final SerializableFinder list = find.byValueKey(listKey);
for (int j = 0; j < 5; j += 1) {
// Scroll down
for (int i = 0; i < 5; i += 1) {
await driver.scroll(list, 0.0, -300.0, const Duration(milliseconds: 300));
await Future<void>.delayed(const Duration(milliseconds: 500));
}
// Scroll up
for (int i = 0; i < 5; i += 1) {
await driver.scroll(list, 0.0, 300.0, const Duration(milliseconds: 300));
await Future<void>.delayed(const Duration(milliseconds: 500));
}
}
});
final TimelineSummary summary = TimelineSummary.summarize(timeline);
await summary.writeTimelineToFile(summaryName, pretty: true);
}
test('platform_views_scroll_perf', () async {
// Disable frame sync, since there are ongoing animations.
await driver.runUnsynchronized(() async {
await testScrollPerf('platform-views-scroll', 'platform_views_scroll_perf_non_intersecting');
});
}, timeout: Timeout.none);
});
}
| flutter/dev/benchmarks/platform_views_layout/test_driver/scroll_perf_non_intersecting_test.dart/0 | {
"file_path": "flutter/dev/benchmarks/platform_views_layout/test_driver/scroll_perf_non_intersecting_test.dart",
"repo_id": "flutter",
"token_count": 804
} | 656 |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
| flutter/dev/benchmarks/platform_views_layout_hybrid_composition/ios/Runner/Base.lproj/LaunchScreen.storyboard/0 | {
"file_path": "flutter/dev/benchmarks/platform_views_layout_hybrid_composition/ios/Runner/Base.lproj/LaunchScreen.storyboard",
"repo_id": "flutter",
"token_count": 768
} | 657 |
{
"title": "Acciones",
"market": "MERCADO",
"portfolio": "CARTERA"
}
| flutter/dev/benchmarks/test_apps/stocks/lib/i18n/stocks_es.arb/0 | {
"file_path": "flutter/dev/benchmarks/test_apps/stocks/lib/i18n/stocks_es.arb",
"repo_id": "flutter",
"token_count": 36
} | 658 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:convert';
import 'dart:io';
import 'package:intl/intl.dart';
import 'package:meta/meta.dart';
import 'package:path/path.dart' as path;
import 'package:platform/platform.dart' as platform;
import 'package:process/process.dart';
class CommandException implements Exception {}
Future<void> main() async {
await postProcess();
}
/// Post-processes an APIs documentation zip file to modify the footer and version
/// strings for commits promoted to either beta or stable channels.
Future<void> postProcess() async {
final String revision = await gitRevision(fullLength: true);
print('Docs revision being processed: $revision');
final Directory tmpFolder = Directory.systemTemp.createTempSync();
final String zipDestination = path.join(tmpFolder.path, 'api_docs.zip');
if (!Platform.environment.containsKey('SDK_CHECKOUT_PATH')) {
print('SDK_CHECKOUT_PATH env variable is required for this script');
exit(1);
}
final String checkoutPath = Platform.environment['SDK_CHECKOUT_PATH']!;
final String docsPath = path.join(checkoutPath, 'dev', 'docs');
await runProcessWithValidations(
<String>[
'curl',
'-L',
'https://storage.googleapis.com/flutter_infra_release/flutter/$revision/api_docs.zip',
'--output',
zipDestination,
'--fail',
],
docsPath,
);
// Unzip to docs folder.
await runProcessWithValidations(
<String>[
'unzip',
'-o',
zipDestination,
],
docsPath,
);
// Generate versions file.
await runProcessWithValidations(
<String>['flutter', '--version'],
docsPath,
);
final File versionFile = File('version');
final String version = versionFile.readAsStringSync();
// Recreate footer
final String publishPath = path.join(docsPath, '..', 'docs', 'doc', 'flutter', 'footer.js');
final File footerFile = File(publishPath)..createSync(recursive: true);
createFooter(footerFile, version);
}
/// Gets the git revision of the current checkout. [fullLength] if true will return
/// the full commit hash, if false it will return the first 10 characters only.
Future<String> gitRevision({
bool fullLength = false,
@visibleForTesting platform.Platform platform = const platform.LocalPlatform(),
@visibleForTesting ProcessManager processManager = const LocalProcessManager(),
}) async {
const int kGitRevisionLength = 10;
final ProcessResult gitResult = processManager.runSync(<String>['git', 'rev-parse', 'HEAD']);
if (gitResult.exitCode != 0) {
throw 'git rev-parse exit with non-zero exit code: ${gitResult.exitCode}';
}
final String gitRevision = (gitResult.stdout as String).trim();
if (fullLength) {
return gitRevision;
}
return gitRevision.length > kGitRevisionLength ? gitRevision.substring(0, kGitRevisionLength) : gitRevision;
}
/// Wrapper function to run a subprocess checking exit code and printing stderr and stdout.
/// [executable] is a string with the script/binary to execute, [args] is the list of flags/arguments
/// and [workingDirectory] is as string to the working directory where the subprocess will be run.
Future<void> runProcessWithValidations(
List<String> command,
String workingDirectory, {
@visibleForTesting ProcessManager processManager = const LocalProcessManager(),
bool verbose = true,
}) async {
final ProcessResult result =
processManager.runSync(command, stdoutEncoding: utf8, workingDirectory: workingDirectory);
if (result.exitCode == 0) {
if (verbose) {
print('stdout: ${result.stdout}');
}
} else {
if (verbose) {
print('stderr: ${result.stderr}');
}
throw CommandException();
}
}
/// Get the name of the release branch.
///
/// On LUCI builds, the git HEAD is detached, so first check for the env
/// variable "LUCI_BRANCH"; if it is not set, fall back to calling git.
Future<String> getBranchName({
@visibleForTesting platform.Platform platform = const platform.LocalPlatform(),
@visibleForTesting ProcessManager processManager = const LocalProcessManager(),
}) async {
final RegExp gitBranchRegexp = RegExp(r'^## (.*)');
final String? luciBranch = platform.environment['LUCI_BRANCH'];
if (luciBranch != null && luciBranch.trim().isNotEmpty) {
return luciBranch.trim();
}
final ProcessResult gitResult = processManager.runSync(<String>['git', 'status', '-b', '--porcelain']);
if (gitResult.exitCode != 0) {
throw 'git status exit with non-zero exit code: ${gitResult.exitCode}';
}
final RegExpMatch? gitBranchMatch = gitBranchRegexp.firstMatch((gitResult.stdout as String).trim().split('\n').first);
return gitBranchMatch == null ? '' : gitBranchMatch.group(1)!.split('...').first;
}
/// Updates the footer of the api documentation with the correct branch and versions.
/// [footerPath] is the path to the location of the footer js file and [version] is a
/// string with the version calculated by the flutter tool.
Future<void> createFooter(File footerFile, String version,
{@visibleForTesting String? timestampParam,
@visibleForTesting String? branchParam,
@visibleForTesting String? revisionParam}) async {
final String timestamp = timestampParam ?? DateFormat('yyyy-MM-dd HH:mm').format(DateTime.now());
final String gitBranch = branchParam ?? await getBranchName();
final String revision = revisionParam ?? await gitRevision();
final String gitBranchOut = gitBranch.isEmpty ? '' : '• $gitBranch';
footerFile.writeAsStringSync('''
(function() {
var span = document.querySelector('footer>span');
if (span) {
span.innerText = 'Flutter $version • $timestamp • $revision $gitBranchOut';
}
var sourceLink = document.querySelector('a.source-link');
if (sourceLink) {
sourceLink.href = sourceLink.href.replace('/master/', '/$revision/');
}
})();
''');
}
| flutter/dev/bots/post_process_docs.dart/0 | {
"file_path": "flutter/dev/bots/post_process_docs.dart",
"repo_id": "flutter",
"token_count": 1882
} | 659 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
void main(List<String> args) {
String type = '';
if (args[0] == '--material') {
type = 'material';
}
if (args[0] == '--cupertino') {
type = 'cupertino';
}
print('''
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
void main(List<String> args) {
print('Expected output $type');
}
''');
}
| flutter/dev/bots/test/analyze-test-input/root/dev/tools/localization/bin/gen_localizations.dart/0 | {
"file_path": "flutter/dev/bots/test/analyze-test-input/root/dev/tools/localization/bin/gen_localizations.dart",
"repo_id": "flutter",
"token_count": 192
} | 660 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// we ignore these so that the format of the strings below matches what package:test prints, to make maintenance easier
// ignore_for_file: use_raw_strings
import 'dart:io';
import 'common.dart';
const List<String> expectedMainErrors = <String>[
'dev/bots/test/analyze-snippet-code-test-input/custom_imports_broken.dart:19:11: (statement) (undefined_identifier)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:30:5: (expression) (unnecessary_new)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:103:5: (statement) (always_specify_types)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:111:5: (top-level declaration) (prefer_const_declarations)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:111:19: (top-level declaration) (unnecessary_nullable_for_final_variable_declarations)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:112:5: (top-level declaration) (prefer_const_declarations)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:112:21: (top-level declaration) (invalid_assignment)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:134:14: (top-level declaration) (undefined_identifier)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:136:21: (top-level declaration) (read_potentially_unassigned_final)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:147:12: (self-contained program) (unused_import)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:148:11: (self-contained program) (undefined_class)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:148:22: (self-contained program) (undefined_function)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:153:10: (stateful widget) (annotate_overrides)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:153:10: (stateful widget) (must_call_super)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:161:7: (top-level declaration) (undefined_identifier)',
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:165: Found "```" in code but it did not match RegExp: pattern=^ */// *```dart\$ flags= so something is wrong. Line was: "/// ```"',
'dev/bots/test/analyze-snippet-code-test-input/short_but_still_broken.dart:9:12: (statement) (invalid_assignment)',
'dev/bots/test/analyze-snippet-code-test-input/short_but_still_broken.dart:18:4: Empty ```dart block in snippet code.',
];
const List<String> expectedUiErrors = <String>[
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:14:7: (top-level declaration) (prefer_typing_uninitialized_variables)',
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:14:7: (top-level declaration) (inference_failure_on_uninitialized_variable)',
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:14:7: (top-level declaration) (missing_const_final_var_or_type)',
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:16:20: (top-level declaration) (prefer_final_fields)',
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:16:20: (top-level declaration) (unused_field)',
];
final RegExp errorPrefixRE = RegExp(r'^([-a-z0-9/_.:]+): .*(\([-a-z_ ]+\) \([-a-z_ ]+\))$');
String removeLintDescriptions(String error) {
final RegExpMatch? match = errorPrefixRE.firstMatch(error);
if (match != null) {
return '${match[1]}: ${match[2]}';
}
return error;
}
void main() {
// These tests don't run on Windows because the sample analyzer doesn't
// support Windows as a platform, since it is only run on Linux in the
// continuous integration tests.
if (Platform.isWindows) {
return;
}
test('analyze_snippet_code smoke test', () {
final ProcessResult process = Process.runSync(
'../../bin/cache/dart-sdk/bin/dart',
<String>[
'--enable-asserts',
'analyze_snippet_code.dart',
'--no-include-dart-ui',
'test/analyze-snippet-code-test-input',
],
);
expect(process.stdout, isEmpty);
final List<String> stderrLines = process.stderr.toString().split('\n');
expect(stderrLines.length, stderrLines.toSet().length, reason: 'found duplicates in $stderrLines');
final List<String> stderrNoDescriptions = stderrLines.map(removeLintDescriptions).toList();
expect(stderrNoDescriptions, <String>[
...expectedMainErrors,
'Found 18 snippet code errors.',
'See the documentation at the top of dev/bots/analyze_snippet_code.dart for details.',
'', // because we end with a newline, split gives us an extra blank line
]);
expect(process.exitCode, 1);
});
test('Analyzes dart:ui code', () {
final ProcessResult process = Process.runSync(
'../../bin/cache/dart-sdk/bin/dart',
<String>[
'--enable-asserts',
'analyze_snippet_code.dart',
'--dart-ui-location=test/analyze-snippet-code-test-dart-ui',
'test/analyze-snippet-code-test-input',
],
);
expect(process.stdout, isEmpty);
final List<String> stderrLines = process.stderr.toString().split('\n');
expect(stderrLines.length, stderrLines.toSet().length, reason: 'found duplicates in $stderrLines');
final List<String> stderrNoDescriptions = stderrLines.map(removeLintDescriptions).toList();
expect(stderrNoDescriptions, <String>[
...expectedUiErrors,
...expectedMainErrors,
'Found 23 snippet code errors.',
'See the documentation at the top of dev/bots/analyze_snippet_code.dart for details.',
'', // because we end with a newline, split gives us an extra blank line
]);
expect(process.exitCode, 1);
});
}
| flutter/dev/bots/test/analyze_snippet_code_test.dart/0 | {
"file_path": "flutter/dev/bots/test/analyze_snippet_code_test.dart",
"repo_id": "flutter",
"token_count": 2323
} | 661 |
#!/usr/bin/env bash
# Copyright 2014 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -euo pipefail
# Needed because if it is set, cd may print the path it changed to.
unset CDPATH
# On Mac OS, readlink -f doesn't work, so follow_links traverses the path one
# link at a time, and then cds into the link destination and find out where it
# ends up.
#
# The returned filesystem path must be a format usable by Dart's URI parser,
# since the Dart command line tool treats its argument as a file URI, not a
# filename. For instance, multiple consecutive slashes should be reduced to a
# single slash, since double-slashes indicate a URI "authority", and these are
# supposed to be filenames. There is an edge case where this will return
# multiple slashes: when the input resolves to the root directory. However, if
# that were the case, we wouldn't be running this shell, so we don't do anything
# about it.
#
# The function is enclosed in a subshell to avoid changing the working directory
# of the caller.
function follow_links() (
cd -P "$(dirname -- "$1")"
file="$PWD/$(basename -- "$1")"
while [[ -h "$file" ]]; do
cd -P "$(dirname -- "$file")"
file="$(readlink -- "$file")"
cd -P "$(dirname -- "$file")"
file="$PWD/$(basename -- "$file")"
done
echo "$file"
)
PROG_NAME="$(follow_links "${BASH_SOURCE[0]}")"
BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
REPO_DIR="$BIN_DIR/../../.."
DART_BIN="$REPO_DIR/bin/dart"
# Ensure pub get has been run in the repo before running the conductor
(cd "$REPO_DIR/dev/conductor/core"; "$DART_BIN" pub get 1>&2)
exec "$DART_BIN" --enable-asserts "$REPO_DIR/dev/conductor/core/bin/packages_autoroller.dart" "$@"
| flutter/dev/conductor/bin/packages_autoroller/0 | {
"file_path": "flutter/dev/conductor/bin/packages_autoroller",
"repo_id": "flutter",
"token_count": 586
} | 662 |
#!/usr/bin/env bash
# Copyright 2014 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# //flutter/dev/tools/lib/proto
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Ensure dart-sdk is cached
"$DIR/../../../../bin/dart" --version
if ! type protoc >/dev/null 2>&1; then
PROTOC_LINK='https://grpc.io/docs/protoc-installation/'
echo "Error! \"protoc\" binary required on path."
echo "See $PROTOC_LINK for more information."
exit 1
fi
if ! type dart >/dev/null 2>&1; then
echo "Error! \"dart\" binary required on path."
exit 1
fi
# Use null-safe protoc_plugin
dart pub global activate protoc_plugin 20.0.0
protoc --dart_out="$DIR" --proto_path="$DIR" "$DIR/conductor_state.proto"
for SOURCE_FILE in $(ls "$DIR"/*.pb*.dart); do
# Format in place file
dart format --output=write --line-length 120 "$SOURCE_FILE"
# Create temp copy with the license header prepended
cp "$DIR/license_header.txt" "${SOURCE_FILE}.tmp"
# Add an extra newline required by analysis (analysis also prevents
# license_header.txt from having the trailing newline)
echo '' >> "${SOURCE_FILE}.tmp"
cat "$SOURCE_FILE" >> "${SOURCE_FILE}.tmp"
# Move temp version (with license) over the original
mv "${SOURCE_FILE}.tmp" "$SOURCE_FILE"
done
| flutter/dev/conductor/core/lib/src/proto/compile_proto.sh/0 | {
"file_path": "flutter/dev/conductor/core/lib/src/proto/compile_proto.sh",
"repo_id": "flutter",
"token_count": 473
} | 663 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:args/args.dart';
import 'package:conductor_core/src/stdio.dart';
import 'package:test/test.dart';
export 'package:test/fake.dart';
export 'package:test/test.dart' hide isInstanceOf;
export '../../../../packages/flutter_tools/test/src/fake_process_manager.dart';
Matcher throwsAssertionWith(String messageSubString) {
return throwsA(
isA<AssertionError>().having(
(AssertionError e) => e.toString(),
'description',
contains(messageSubString),
),
);
}
Matcher throwsExceptionWith(String messageSubString) {
return throwsA(
isA<Exception>().having(
(Exception e) => e.toString(),
'description',
contains(messageSubString),
),
);
}
class TestStdio extends Stdio {
TestStdio({
this.verbose = false,
List<String>? stdin,
}) : stdin = stdin ?? <String>[];
String get error => logs.where((String log) => log.startsWith(r'[error] ')).join('\n');
String get stdout => logs.where((String log) {
return log.startsWith(r'[status] ') || log.startsWith(r'[trace] ') || log.startsWith(r'[write] ');
}).join('\n');
final bool verbose;
final List<String> stdin;
@override
String readLineSync() {
if (stdin.isEmpty) {
throw Exception('Unexpected call to readLineSync! Last stdout was ${logs.last}');
}
return stdin.removeAt(0);
}
}
class FakeArgResults implements ArgResults {
FakeArgResults({
required String? level,
required String candidateBranch,
String remote = 'upstream',
bool justPrint = false,
bool autoApprove = true, // so we don't have to mock stdin
bool help = false,
bool force = false,
bool skipTagging = false,
}) : _parsedArgs = <String, dynamic>{
'increment': level,
'candidate-branch': candidateBranch,
'remote': remote,
'just-print': justPrint,
'yes': autoApprove,
'help': help,
'force': force,
'skip-tagging': skipTagging,
};
@override
String? name;
@override
ArgResults? command;
@override
final List<String> rest = <String>[];
@override
List<String> get arguments {
assert(false, 'not yet implemented');
return <String>[];
}
final Map<String, dynamic> _parsedArgs;
@override
Iterable<String> get options {
assert(false, 'not yet implemented');
return <String>[];
}
@override
dynamic operator [](String name) {
return _parsedArgs[name];
}
@override
bool wasParsed(String name) {
assert(false, 'not yet implemented');
return false;
}
}
| flutter/dev/conductor/core/test/common.dart/0 | {
"file_path": "flutter/dev/conductor/core/test/common.dart",
"repo_id": "flutter",
"token_count": 1015
} | 664 |
# Flutter DeviceLab
DeviceLab is a physical lab that tests Flutter on real devices.
This package contains the code for the test framework and tests. More generally
the tests are referred to as "tasks" in the API, but since we primarily use it
for testing, this document refers to them as "tests".
Current statuses for the devicelab are available at
<https://flutter-dashboard.appspot.com/#/build>. See [dashboard user
guide](https://github.com/flutter/cocoon/blob/main/dashboard/USER_GUIDE.md)
for information on using the dashboards.
## Table of Contents
* [How the DeviceLab runs tests](#how-the-devicelab-runs-tests)
* [Running tests locally](#running-tests-locally)
* [Writing tests](#writing-tests)
* [Adding tests to continuous
integration](#adding-tests-to-continuous-integration)
* [Adding tests to presubmit](#adding-tests-to-presubmit)
* [Migrating to build and test model](#migrating-to-build-and-test-model)
## How the DeviceLab runs tests
DeviceLab tests are run against physical devices in Flutter's lab (the
"DeviceLab").
Tasks specify the type of device they are to run on (`linux_android`, `mac_ios`,
`mac_android`, `windows_android`, etc). When a device in the lab is free, it
will pickup tasks that need to be completed.
1. If the task succeeds, the test runner reports the success and uploads its
performance metrics to Flutter's infrastructure. Not all tasks record
performance metrics.
2. If task fails, an auto rerun happens. Whenever the last run succeeds, the
task will be reported as a success. For this case, a flake will be flagged and
populated to the test result.
3. If the task fails in all reruns, the test runner reports the failure to
Flutter's infrastructure and no performance metrics are collected
## Running tests locally
Do make sure your tests pass locally before deploying to the CI environment.
Below is a handful of commands that run tests in a similar way to how the
CI environment runs them. These commands are also useful when you need to
reproduce a CI test failure locally.
### Prerequisites
You must set the `ANDROID_SDK_ROOT` environment variable to run
tests on Android. If you have a local build of the Flutter engine, then you have
a copy of the Android SDK at `.../engine/src/third_party/android_tools/sdk`.
You can find where your Android SDK is using `flutter doctor -v`.
### Warnings
Running the devicelab will do things to your environment.
Notably, it will start and stop Gradle, for instance.
### Running specific tests
To run a test, use option `-t` (`--task`):
```sh
# from the .../flutter/dev/devicelab directory
../../bin/cache/dart-sdk/bin/dart bin/test_runner.dart test -t {NAME_OF_TEST}
```
Where `NAME_OR_PATH_OF_TEST` is the name of a task, which is a file's
basename in `bin/tasks`. Example: `complex_layout__start_up`.
To run multiple tests, repeat option `-t` (`--task`) multiple times:
```sh
../../bin/cache/dart-sdk/bin/dart bin/run.dart -t test1 -t test2 -t test3
```
### Running tests against a local engine build
To run device lab tests against a local engine build, pass the appropriate
flags to `bin/run.dart`:
```sh
../../bin/cache/dart-sdk/bin/dart bin/run.dart --task=[some_task] \
--local-engine-src-path=[path_to_local]/engine/src \
--local-engine=[local_engine_architecture] \
--local-engine-host=[local_engine_host_architecture]
```
An example of a local engine architecture is `android_debug_unopt_x86` and
an example of a local engine host architecture is `host_debug_unopt`.
### Running an A/B test for engine changes
You can run an A/B test that compares the performance of the default engine
against a local engine build. The test runs the same benchmark a specified
number of times against both engines, then outputs a tab-separated spreadsheet
with the results and stores them in a JSON file for future reference. The
results can be copied to a Google Spreadsheet for further inspection and the
JSON file can be reprocessed with the `summarize.dart` command for more detailed
output.
Example:
```sh
../../bin/cache/dart-sdk/bin/dart bin/run.dart --ab=10 \
--local-engine=host_debug_unopt \
--local-engine-host=host_debug_unopt \
-t bin/tasks/web_benchmarks_canvaskit.dart
```
The `--ab=10` tells the runner to run an A/B test 10 times.
`--local-engine=host_debug_unopt` tells the A/B test to use the
`host_debug_unopt` engine build. `--local-engine-host=host_debug_unopt` uses
the same engine build to run the `frontend_server` (in this example).
`--local-engine` is required for A/B test.
`--ab-result-file=filename` can be used to provide an alternate location to
output the JSON results file (defaults to `ABresults#.json`). A single `#`
character can be used to indicate where to insert a serial number if a file with
that name already exists, otherwise, the file will be overwritten.
A/B can run exactly one task. Multiple tasks are not supported.
Example output:
```text
Score Average A (noise) Average B (noise) Speed-up
bench_card_infinite_scroll.canvaskit.drawFrameDuration.average 2900.20 (8.44%) 2426.70 (8.94%) 1.20x
bench_card_infinite_scroll.canvaskit.totalUiFrame.average 4964.00 (6.29%) 4098.00 (8.03%) 1.21x
draw_rect.canvaskit.windowRenderDuration.average 1959.45 (16.56%) 2286.65 (0.61%) 0.86x
draw_rect.canvaskit.sceneBuildDuration.average 1969.45 (16.37%) 2294.90 (0.58%) 0.86x
draw_rect.canvaskit.drawFrameDuration.average 5335.20 (17.59%) 6437.60 (0.59%) 0.83x
draw_rect.canvaskit.totalUiFrame.average 6832.00 (13.16%) 7932.00 (0.34%) 0.86x
```
The output contains averages and noises for each score. More importantly, it
contains the speed-up value, i.e. how much _faster_ is the local engine than
the default engine. Values less than 1.0 indicate a slow-down. For example,
0.5x means the local engine is twice as slow as the default engine, and 2.0x
means it's twice as fast. Higher is better.
Summarize tool example:
```sh
../../bin/cache/dart-sdk/bin/dart bin/summarize.dart --[no-]tsv-table --[no-]raw-summary \
ABresults.json ABresults1.json ABresults2.json ...
```
`--[no-]tsv-table` tells the tool to print the summary in a table with tabs for
easy spreadsheet entry. (defaults to on)
`--[no-]raw-summary` tells the tool to print all per-run data collected by the
A/B test formatted with tabs for easy spreadsheet entry. (defaults to on)
Multiple trailing filenames can be specified and each such results file will be
processed in turn.
## Reproducing broken builds locally
To reproduce the breakage locally `git checkout` the corresponding Flutter
revision. Note the name of the test that failed. In the example above the
failing test is `flutter_gallery__transition_perf`. This name can be passed to
the `run.dart` command. For example:
```sh
../../bin/cache/dart-sdk/bin/dart bin/run.dart -t flutter_gallery__transition_perf
```
## Writing tests
A test is a simple Dart program that lives under `bin/tasks` and uses
`package:flutter_devicelab/framework/framework.dart` to define and run a _task_.
Example:
```dart
import 'dart:async';
import 'package:flutter_devicelab/framework/framework.dart';
Future<void> main() async {
await task(() async {
... do something interesting ...
// Aggregate results into a JSONable Map structure.
Map<String, dynamic> testResults = ...;
// Report success.
return new TaskResult.success(testResults);
// Or you can also report a failure.
return new TaskResult.failure('Something went wrong!');
});
}
```
Only one `task` is permitted per program. However, that task can run any number
of tests internally. A task has a name. It succeeds and fails independently of
other tasks, and is reported to the dashboard independently of other tasks.
A task runs in its own standalone Dart VM and reports results via Dart VM
service protocol. This ensures that tasks do not interfere with each other and
lets the CI system time out and clean up tasks that get stuck.
## Adding tests to continuous integration
Host only tests should be added to `flutter_tools`.
There are several PRs needed to add a DeviceLab task to CI.
_TASK_- the name of your test that also matches the name of the
file in `bin/tasks` without the `.dart` extension.
1. Add target to
[.ci.yaml](https://github.com/flutter/flutter/blob/master/.ci.yaml)
* Mirror an existing one that has the recipe `devicelab_drone`
If your test needs to run on multiple operating systems, create a separate
target for each operating system.
## Adding tests to presubmit
Flutter's DeviceLab has a limited capacity in presubmit. File an infra ticket
to investigate feasibility of adding a test to presubmit.
## Migrating to build and test model
To better utilize limited DeviceLab testbed resources and speed up commit validation
time, it is now supported to separate building artifacts (.apk/.app) from testing them.
The artifact will be built on a host only bot, a VM or physical bot without a device,
and the test will run based on the artifact against a testbed with a device.
Steps:
1. Update the task class to extend [`BuildTestTask`](https://github.com/flutter/flutter/blob/master/dev/devicelab/lib/tasks/build_test_task.dart)
- Override function `getBuildArgs`
- Override function `getTestArgs`
- Override function `parseTaskResult`
- Override function `getApplicationBinaryPath`
2. Update the `bin/tasks/{TEST}.dart` to point to the new task class
3. Validate the task locally
- build only: `dart bin/test_runner.dart test -t {NAME_OR_PATH_OF_TEST} --task-args build --task-args application-binary-path={PATH_TO_ARTIFACT}`
- test only: `dart bin/test_runner.dart test -t {NAME_OR_PATH_OF_TEST} --task-args test --task-args application-binary-path={PATH_TO_ARTIFACT}`
4. Add tasks to continuous integration
- Mirror a target with platform `Linux_build_test` or `Mac_build_test`
- The only difference from regular targets is the artifact property: if omitted, it will use the `task_name`.
5. Once validated in CI, enable the target in `PROD` by removing `bringup: true` and deleting the old target entry without build+test model.
Take gallery tasks for example:
1. Linux android
- Separating PR: https://github.com/flutter/flutter/pull/103550
- Switching PR: https://github.com/flutter/flutter/pull/110533
2. Mac iOS: https://github.com/flutter/flutter/pull/111164
| flutter/dev/devicelab/README.md/0 | {
"file_path": "flutter/dev/devicelab/README.md",
"repo_id": "flutter",
"token_count": 3174
} | 665 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';
class HelloWorldMemoryTest extends MemoryTest {
HelloWorldMemoryTest() : super(
'${flutterDirectory.path}/examples/hello_world',
'lib/main.dart',
'io.flutter.examples.hello_world',
);
/// Launch an app with no instrumentation and measure its memory usage after
/// 1.5s and 3.0s.
@override
Future<void> useMemory() async {
print('launching $project$test on device...');
await flutter('run', options: <String>[
'--verbose',
'--release',
'--no-resident',
'-d', device!.deviceId,
test,
]);
await Future<void>.delayed(const Duration(milliseconds: 1500));
await recordStart();
await Future<void>.delayed(const Duration(milliseconds: 3000));
await recordEnd();
}
}
Future<void> main() async {
await task(HelloWorldMemoryTest().run);
}
| flutter/dev/devicelab/bin/tasks/hello_world__memory.dart/0 | {
"file_path": "flutter/dev/devicelab/bin/tasks/hello_world__memory.dart",
"repo_id": "flutter",
"token_count": 404
} | 666 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/host_agent.dart';
import 'package:flutter_devicelab/framework/ios.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
/// Tests that the Flutter module project template works and supports
/// adding Flutter to an existing iOS app.
Future<void> main() async {
await task(() async {
// Update pod repo.
await eval(
'pod',
<String>['repo', 'update'],
environment: <String, String>{
'LANG': 'en_US.UTF-8',
},
);
// This variable cannot be `late`, as we reference it in the `finally` block
// which may execute before this field has been initialized.
String? simulatorDeviceId;
section('Create Flutter module project');
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_module_test.');
final Directory projectDir = Directory(path.join(tempDir.path, 'hello'));
try {
await inDirectory(tempDir, () async {
await flutter(
'create',
options: <String>[
'--org',
'io.flutter.devicelab',
'--template=module',
'hello',
],
);
});
// Copy test dart files to new module app.
final Directory flutterModuleLibSource = Directory(path.join(flutterDirectory.path, 'dev', 'integration_tests', 'ios_host_app', 'flutterapp', 'lib'));
final Directory flutterModuleLibDestination = Directory(path.join(projectDir.path, 'lib'));
// These test files don't have a .dart extension so the analyzer will ignore them. They aren't in a
// package and don't work on their own outside of the test module just created.
final File main = File(path.join(flutterModuleLibSource.path, 'main'));
main.copySync(path.join(flutterModuleLibDestination.path, 'main.dart'));
final File marquee = File(path.join(flutterModuleLibSource.path, 'marquee'));
marquee.copySync(path.join(flutterModuleLibDestination.path, 'marquee.dart'));
section('Create package with native assets');
await flutter(
'config',
options: <String>['--enable-native-assets'],
);
const String ffiPackageName = 'ffi_package';
await createFfiPackage(ffiPackageName, tempDir);
section('Add FFI package');
final File pubspec = File(path.join(projectDir.path, 'pubspec.yaml'));
String content = await pubspec.readAsString();
content = content.replaceFirst(
'dependencies:\n',
'''
dependencies:
$ffiPackageName:
path: ../$ffiPackageName
''',
);
await pubspec.writeAsString(content, flush: true);
await inDirectory(projectDir, () async {
await flutter(
'packages',
options: <String>['get'],
);
});
section('Build ephemeral host app in release mode without CocoaPods');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>['ios', '--no-codesign', '--verbose'],
);
});
// Check the tool is no longer copying to the legacy xcframework location.
checkDirectoryNotExists(path.join(projectDir.path, '.ios', 'Flutter', 'engine', 'Flutter.xcframework'));
final Directory ephemeralIOSHostApp = Directory(path.join(
projectDir.path,
'build',
'ios',
'iphoneos',
'Runner.app',
));
if (!exists(ephemeralIOSHostApp)) {
return TaskResult.failure('Failed to build ephemeral host .app');
}
if (!await _isAppAotBuild(ephemeralIOSHostApp)) {
return TaskResult.failure(
'Ephemeral host app ${ephemeralIOSHostApp.path} was not a release build as expected'
);
}
section('Build ephemeral host app in profile mode without CocoaPods');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>['ios', '--no-codesign', '--profile'],
);
});
if (!exists(ephemeralIOSHostApp)) {
return TaskResult.failure('Failed to build ephemeral host .app');
}
if (!await _isAppAotBuild(ephemeralIOSHostApp)) {
return TaskResult.failure(
'Ephemeral host app ${ephemeralIOSHostApp.path} was not a profile build as expected'
);
}
section('Clean build');
await inDirectory(projectDir, () async {
await flutter('clean');
});
section('Build ephemeral host app in debug mode for simulator without CocoaPods');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>['ios', '--no-codesign', '--simulator', '--debug'],
);
});
final Directory ephemeralSimulatorHostApp = Directory(path.join(
projectDir.path,
'build',
'ios',
'iphonesimulator',
'Runner.app',
));
if (!exists(ephemeralSimulatorHostApp)) {
return TaskResult.failure('Failed to build ephemeral host .app');
}
checkFileExists(path.join(ephemeralSimulatorHostApp.path, 'Frameworks', 'Flutter.framework', 'Flutter'));
if (!exists(File(path.join(
ephemeralSimulatorHostApp.path,
'Frameworks',
'App.framework',
'flutter_assets',
'isolate_snapshot_data',
)))) {
return TaskResult.failure(
'Ephemeral host app ${ephemeralSimulatorHostApp.path} was not a debug build as expected'
);
}
section('Clean build');
await inDirectory(projectDir, () async {
await flutter('clean');
});
// Make a fake Dart-only plugin, since there are no existing examples.
section('Create local plugin');
const String dartPluginName = 'dartplugin';
await _createFakeDartPlugin(dartPluginName, tempDir);
section('Add plugins');
content = content.replaceFirst(
'dependencies:\n',
// One framework, one Dart-only, one that does not support iOS, and one with a resource bundle.
'''
dependencies:
url_launcher: 6.0.20
android_alarm_manager: 2.0.2
google_sign_in_ios: 5.5.0
$dartPluginName:
path: ../$dartPluginName
''',
);
await pubspec.writeAsString(content, flush: true);
await inDirectory(projectDir, () async {
await flutter(
'packages',
options: <String>['get'],
);
});
section('Build ephemeral host app with CocoaPods');
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>['ios', '--no-codesign', '-v'],
);
});
final bool ephemeralHostAppWithCocoaPodsBuilt = exists(ephemeralIOSHostApp);
if (!ephemeralHostAppWithCocoaPodsBuilt) {
return TaskResult.failure('Failed to build ephemeral host .app with CocoaPods');
}
final File podfileLockFile = File(path.join(projectDir.path, '.ios', 'Podfile.lock'));
final String podfileLockOutput = podfileLockFile.readAsStringSync();
if (!podfileLockOutput.contains(':path: Flutter')
|| !podfileLockOutput.contains(':path: Flutter/FlutterPluginRegistrant')
|| !podfileLockOutput.contains(':path: ".symlinks/plugins/url_launcher_ios/ios"')
|| podfileLockOutput.contains('android_alarm_manager')
|| podfileLockOutput.contains(dartPluginName)) {
print(podfileLockOutput);
return TaskResult.failure('Building ephemeral host app Podfile.lock does not contain expected pods');
}
checkFileExists(path.join(ephemeralIOSHostApp.path, 'Frameworks', 'url_launcher_ios.framework', 'url_launcher_ios'));
// Resources should be embedded.
checkDirectoryExists(path.join(ephemeralIOSHostApp.path, 'Frameworks', 'GoogleSignIn.framework', 'GoogleSignIn.bundle'));
checkFileExists(path.join(ephemeralIOSHostApp.path, 'Frameworks', 'Flutter.framework', 'Flutter'));
// Android-only, no embedded framework.
checkDirectoryNotExists(path.join(ephemeralIOSHostApp.path, 'Frameworks', 'android_alarm_manager.framework'));
// Dart-only, no embedded framework.
checkDirectoryNotExists(path.join(ephemeralIOSHostApp.path, 'Frameworks', '$dartPluginName.framework'));
// Native assets embedded, no embedded framework.
checkFileExists(path.join(ephemeralIOSHostApp.path, 'Frameworks', '$ffiPackageName.framework', ffiPackageName));
section('Clean and pub get module');
await inDirectory(projectDir, () async {
await flutter('clean');
});
await inDirectory(projectDir, () async {
await flutter('pub', options: <String>['get']);
});
section('Add to existing iOS Objective-C app');
final Directory objectiveCHostApp = Directory(path.join(tempDir.path, 'hello_host_app'));
mkdir(objectiveCHostApp);
recursiveCopy(
Directory(path.join(flutterDirectory.path, 'dev', 'integration_tests', 'ios_host_app')),
objectiveCHostApp,
);
final File objectiveCAnalyticsOutputFile = File(path.join(tempDir.path, 'analytics-objc.log'));
final Directory objectiveCBuildDirectory = Directory(path.join(tempDir.path, 'build-objc'));
await inDirectory(objectiveCHostApp, () async {
section('Validate iOS Objective-C host app Podfile');
final File podfile = File(path.join(objectiveCHostApp.path, 'Podfile'));
String podfileContent = await podfile.readAsString();
final String podFailure = await eval(
'pod',
<String>['install'],
environment: <String, String>{
'LANG': 'en_US.UTF-8',
},
canFail: true,
);
if (!podFailure.contains('Missing `flutter_post_install(installer)` in Podfile `post_install` block')
|| !podFailure.contains('Add `flutter_post_install(installer)` to your Podfile `post_install` block to build Flutter plugins')) {
print(podfileContent);
throw TaskResult.failure('pod install unexpectedly succeed without "flutter_post_install" post_install block');
}
podfileContent = '''
$podfileContent
post_install do |installer|
flutter_post_install(installer)
end
''';
await podfile.writeAsString(podfileContent, flush: true);
await exec(
'pod',
<String>['install'],
environment: <String, String>{
'LANG': 'en_US.UTF-8',
},
);
File hostPodfileLockFile = File(path.join(objectiveCHostApp.path, 'Podfile.lock'));
String hostPodfileLockOutput = hostPodfileLockFile.readAsStringSync();
if (!hostPodfileLockOutput.contains(':path: "../hello/.ios/Flutter"')
|| !hostPodfileLockOutput.contains(':path: "../hello/.ios/Flutter/FlutterPluginRegistrant"')
|| !hostPodfileLockOutput.contains(':path: "../hello/.ios/.symlinks/plugins/url_launcher_ios/ios"')
|| hostPodfileLockOutput.contains('android_alarm_manager')
|| hostPodfileLockOutput.contains(dartPluginName)) {
print(hostPodfileLockOutput);
throw TaskResult.failure('Building host app Podfile.lock does not contain expected pods');
}
section('Validate install_flutter_[engine_pod|plugin_pods|application_pod] methods in the Podfile can be executed normally');
podfileContent = podfileContent.replaceFirst('''
install_all_flutter_pods flutter_application_path
''', '''
install_flutter_engine_pod(flutter_application_path)
install_flutter_plugin_pods(flutter_application_path)
install_flutter_application_pod(flutter_application_path)
''');
await podfile.writeAsString(podfileContent, flush: true);
await exec(
'pod',
<String>['install'],
environment: <String, String>{
'LANG': 'en_US.UTF-8',
},
);
hostPodfileLockFile = File(path.join(objectiveCHostApp.path, 'Podfile.lock'));
hostPodfileLockOutput = hostPodfileLockFile.readAsStringSync();
if (!hostPodfileLockOutput.contains(':path: "../hello/.ios/Flutter"')
|| !hostPodfileLockOutput.contains(':path: "../hello/.ios/Flutter/FlutterPluginRegistrant"')
|| !hostPodfileLockOutput.contains(':path: "../hello/.ios/.symlinks/plugins/url_launcher_ios/ios"')
|| hostPodfileLockOutput.contains('android_alarm_manager')
|| hostPodfileLockOutput.contains(dartPluginName)) {
print(hostPodfileLockOutput);
throw TaskResult.failure('Building host app Podfile.lock does not contain expected pods');
}
// Check the tool is no longer copying to the legacy App.framework location.
final File dummyAppFramework = File(path.join(projectDir.path, '.ios', 'Flutter', 'App.framework', 'App'));
checkFileNotExists(dummyAppFramework.path);
section('Build iOS Objective-C host app');
await exec(
'xcodebuild',
<String>[
'-workspace',
'Host.xcworkspace',
'-scheme',
'Host',
'-configuration',
'Debug',
'CODE_SIGNING_ALLOWED=NO',
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGN_IDENTITY=-',
'EXPANDED_CODE_SIGN_IDENTITY=-',
'BUILD_DIR=${objectiveCBuildDirectory.path}',
'COMPILER_INDEX_STORE_ENABLE=NO',
],
environment: <String, String> {
'FLUTTER_ANALYTICS_LOG_FILE': objectiveCAnalyticsOutputFile.path,
},
);
});
final String hostAppDirectory = path.join(
objectiveCBuildDirectory.path,
'Debug-iphoneos',
'Host.app',
);
final bool existingAppBuilt = exists(File(path.join(
hostAppDirectory,
'Host',
)));
if (!existingAppBuilt) {
return TaskResult.failure('Failed to build existing Objective-C app .app');
}
final String hostFrameworksDirectory = path.join(
hostAppDirectory,
'Frameworks',
);
checkFileExists(path.join(
hostFrameworksDirectory,
'Flutter.framework',
'Flutter',
));
checkFileExists(path.join(
hostFrameworksDirectory,
'App.framework',
'flutter_assets',
'isolate_snapshot_data',
));
checkFileExists(path.join(
hostFrameworksDirectory,
'$ffiPackageName.framework',
ffiPackageName,
));
section('Check the NOTICE file is correct');
final String licenseFilePath = path.join(
hostFrameworksDirectory,
'App.framework',
'flutter_assets',
'NOTICES.Z',
);
checkFileExists(licenseFilePath);
await inDirectory(objectiveCBuildDirectory, () async {
final Uint8List licenseData = File(licenseFilePath).readAsBytesSync();
final String licenseString = utf8.decode(gzip.decode(licenseData));
if (!licenseString.contains('skia') || !licenseString.contains('Flutter Authors')) {
return TaskResult.failure('License content missing');
}
});
section('Check that the host build sends the correct analytics');
final String objectiveCAnalyticsOutput = objectiveCAnalyticsOutputFile.readAsStringSync();
if (!objectiveCAnalyticsOutput.contains('cd24: ios')
|| !objectiveCAnalyticsOutput.contains('cd25: true')
|| !objectiveCAnalyticsOutput.contains('viewName: assemble')) {
return TaskResult.failure(
'Building outer Objective-C app produced the following analytics: "$objectiveCAnalyticsOutput" '
'but not the expected strings: "cd24: ios", "cd25: true", "viewName: assemble"'
);
}
section('Archive iOS Objective-C host app');
await inDirectory(objectiveCHostApp, () async {
final Directory objectiveCBuildArchiveDirectory = Directory(path.join(tempDir.path, 'build-objc-archive'));
await exec(
'xcodebuild',
<String>[
'-workspace',
'Host.xcworkspace',
'-scheme',
'Host',
'-configuration',
'Release',
'CODE_SIGNING_ALLOWED=NO',
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGN_IDENTITY=-',
'EXPANDED_CODE_SIGN_IDENTITY=-',
'-archivePath',
objectiveCBuildArchiveDirectory.path,
'COMPILER_INDEX_STORE_ENABLE=NO',
'archive',
],
environment: <String, String> {
'FLUTTER_ANALYTICS_LOG_FILE': objectiveCAnalyticsOutputFile.path,
},
);
final String archivedAppPath = path.join(
'${objectiveCBuildArchiveDirectory.path}.xcarchive',
'Products',
'Applications',
'Host.app',
);
checkFileExists(path.join(
archivedAppPath,
'Host',
));
checkFileNotExists(path.join(
archivedAppPath,
'Frameworks',
'App.framework',
'flutter_assets',
'isolate_snapshot_data',
));
final String builtFlutterBinary = path.join(
archivedAppPath,
'Frameworks',
'Flutter.framework',
'Flutter',
);
checkFileExists(builtFlutterBinary);
if ((await fileType(builtFlutterBinary)).contains('armv7')) {
throw TaskResult.failure('Unexpected armv7 architecture slice in $builtFlutterBinary');
}
final String builtAppBinary = path.join(
archivedAppPath,
'Frameworks',
'App.framework',
'App',
);
checkFileExists(builtAppBinary);
if ((await fileType(builtAppBinary)).contains('armv7')) {
throw TaskResult.failure('Unexpected armv7 architecture slice in $builtAppBinary');
}
// Check native assets are bundled.
checkFileExists(path.join(
archivedAppPath,
'Frameworks',
'$ffiPackageName.framework',
ffiPackageName,
));
// The host app example builds plugins statically, url_launcher_ios.framework
// should not exist.
checkDirectoryNotExists(path.join(
archivedAppPath,
'Frameworks',
'url_launcher_ios.framework',
));
checkFileExists(path.join(
'${objectiveCBuildArchiveDirectory.path}.xcarchive',
'dSYMs',
'App.framework.dSYM',
'Contents',
'Resources',
'DWARF',
'App'
));
});
section('Run platform unit tests');
final String resultBundleTemp = Directory.systemTemp.createTempSync('flutter_module_test_ios_xcresult.').path;
await testWithNewIOSSimulator('TestAdd2AppSim', (String deviceId) async {
simulatorDeviceId = deviceId;
final String resultBundlePath = path.join(resultBundleTemp, 'result');
final int testResultExit = await exec(
'xcodebuild',
<String>[
'-workspace',
'Host.xcworkspace',
'-scheme',
'Host',
'-configuration',
'Debug',
'-destination',
'id=$deviceId',
'-resultBundlePath',
resultBundlePath,
'test',
'CODE_SIGNING_ALLOWED=NO',
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGN_IDENTITY=-',
'EXPANDED_CODE_SIGN_IDENTITY=-',
'COMPILER_INDEX_STORE_ENABLE=NO',
],
workingDirectory: objectiveCHostApp.path,
canFail: true,
);
if (testResultExit != 0) {
final Directory? dumpDirectory = hostAgent.dumpDirectory;
if (dumpDirectory != null) {
// Zip the test results to the artifacts directory for upload.
await inDirectory(resultBundleTemp, () {
final String zipPath = path.join(dumpDirectory.path,
'module_test_ios-objc-${DateTime.now().toLocal().toIso8601String()}.zip');
return exec(
'zip',
<String>[
'-r',
'-9',
'-q',
zipPath,
'result.xcresult',
],
canFail: true, // Best effort to get the logs.
);
});
}
throw TaskResult.failure('Platform unit tests failed');
}
});
section('Fail building existing Objective-C iOS app if flutter script fails');
final String xcodebuildOutput = await inDirectory<String>(objectiveCHostApp, () =>
eval(
'xcodebuild',
<String>[
'-workspace',
'Host.xcworkspace',
'-scheme',
'Host',
'-configuration',
'Debug',
'FLUTTER_ENGINE=bogus', // Force a Flutter error.
'CODE_SIGNING_ALLOWED=NO',
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGN_IDENTITY=-',
'EXPANDED_CODE_SIGN_IDENTITY=-',
'BUILD_DIR=${objectiveCBuildDirectory.path}',
'COMPILER_INDEX_STORE_ENABLE=NO',
],
canFail: true,
)
);
if (!xcodebuildOutput.contains('flutter --verbose --local-engine-src-path=bogus assemble') || // Verbose output
!xcodebuildOutput.contains('Unable to detect a Flutter engine build directory in bogus')) {
return TaskResult.failure('Host Objective-C app build succeeded though flutter script failed');
}
section('Add to existing iOS Swift app');
final Directory swiftHostApp = Directory(path.join(tempDir.path, 'hello_host_app_swift'));
mkdir(swiftHostApp);
recursiveCopy(
Directory(path.join(flutterDirectory.path, 'dev', 'integration_tests', 'ios_host_app_swift')),
swiftHostApp,
);
final File swiftAnalyticsOutputFile = File(path.join(tempDir.path, 'analytics-swift.log'));
final Directory swiftBuildDirectory = Directory(path.join(tempDir.path, 'build-swift'));
await inDirectory(swiftHostApp, () async {
await exec(
'pod',
<String>['install'],
environment: <String, String>{
'LANG': 'en_US.UTF-8',
},
);
await exec(
'xcodebuild',
<String>[
'-workspace',
'Host.xcworkspace',
'-scheme',
'Host',
'-configuration',
'Debug',
'CODE_SIGNING_ALLOWED=NO',
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGN_IDENTITY=-',
'EXPANDED_CODE_SIGN_IDENTITY=-',
'BUILD_DIR=${swiftBuildDirectory.path}',
'COMPILER_INDEX_STORE_ENABLE=NO',
],
environment: <String, String> {
'FLUTTER_ANALYTICS_LOG_FILE': swiftAnalyticsOutputFile.path,
},
);
});
final bool existingSwiftAppBuilt = exists(File(path.join(
swiftBuildDirectory.path,
'Debug-iphoneos',
'Host.app',
'Host',
)));
if (!existingSwiftAppBuilt) {
return TaskResult.failure('Failed to build existing Swift app .app');
}
final String swiftAnalyticsOutput = swiftAnalyticsOutputFile.readAsStringSync();
if (!swiftAnalyticsOutput.contains('cd24: ios')
|| !swiftAnalyticsOutput.contains('cd25: true')
|| !swiftAnalyticsOutput.contains('viewName: assemble')) {
return TaskResult.failure(
'Building outer Swift app produced the following analytics: "$swiftAnalyticsOutput" '
'but not the expected strings: "cd24: ios", "cd25: true", "viewName: assemble"'
);
}
return TaskResult.success(null);
} catch (e) {
return TaskResult.failure(e.toString());
} finally {
unawaited(removeIOSSimulator(simulatorDeviceId));
rmTree(tempDir);
}
});
}
Future<bool> _isAppAotBuild(Directory app) async {
final String binary = path.join(
app.path,
'Frameworks',
'App.framework',
'App',
);
final String symbolTable = await eval(
'nm',
<String> [
'-gU',
binary,
],
);
return symbolTable.contains('kDartIsolateSnapshotInstructions');
}
Future<void> _createFakeDartPlugin(String name, Directory parent) async {
// Start from a standard plugin template.
await inDirectory(parent, () async {
await flutter(
'create',
options: <String>[
'--org',
'io.flutter.devicelab',
'--template=plugin',
'--platforms=ios',
name,
],
);
});
final String pluginDir = path.join(parent.path, name);
// Convert the metadata to Dart-only.
final String dartPluginClass = 'DartClassFor$name';
final File pubspec = File(path.join(pluginDir, 'pubspec.yaml'));
String content = await pubspec.readAsString();
content = content.replaceAll(
RegExp(r' pluginClass: .*?\n'),
' dartPluginClass: $dartPluginClass\n',
);
await pubspec.writeAsString(content, flush: true);
// Add the Dart registration hook that the build will generate a call to.
final File dartCode = File(path.join(pluginDir, 'lib', '$name.dart'));
content = await dartCode.readAsString();
content = '''
$content
class $dartPluginClass {
static void registerWith() {}
}
''';
await dartCode.writeAsString(content, flush: true);
// Remove the native plugin code.
await Directory(path.join(pluginDir, 'ios')).delete(recursive: true);
}
| flutter/dev/devicelab/bin/tasks/module_test_ios.dart/0 | {
"file_path": "flutter/dev/devicelab/bin/tasks/module_test_ios.dart",
"repo_id": "flutter",
"token_count": 11249
} | 667 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/plugin_tests.dart';
Future<void> main() async {
await task(combine(<TaskFunction>[
PluginTest('macos', <String>['--platforms=macos']).call,
// Test that Dart-only plugins are supported.
PluginTest('macos', <String>['--platforms=macos'], dartOnlyPlugin: true).call,
// Test that shared darwin directories are supported.
PluginTest('macos', <String>['--platforms=ios,macos'], sharedDarwinSource: true).call,
// Test that FFI plugins are supported.
PluginTest('macos', <String>['--platforms=macos'], template: 'plugin_ffi').call,
]));
}
| flutter/dev/devicelab/bin/tasks/plugin_test_macos.dart/0 | {
"file_path": "flutter/dev/devicelab/bin/tasks/plugin_test_macos.dart",
"repo_id": "flutter",
"token_count": 274
} | 668 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:convert' show JsonEncoder, LineSplitter, json, utf8;
import 'dart:io' as io;
import 'dart:math' as math;
import 'package:path/path.dart' as path;
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
/// The number of samples used to extract metrics, such as noise, means,
/// max/min values.
///
/// Keep this constant in sync with the same constant defined in `dev/benchmarks/macrobenchmarks/lib/src/web/recorder.dart`.
const int _kMeasuredSampleCount = 10;
/// Options passed to Chrome when launching it.
class ChromeOptions {
ChromeOptions({
this.userDataDirectory,
this.url,
this.windowWidth = 1024,
this.windowHeight = 1024,
this.headless,
this.debugPort,
this.enableWasmGC = false,
});
/// If not null passed as `--user-data-dir`.
final String? userDataDirectory;
/// If not null launches a Chrome tab at this URL.
final String? url;
/// The width of the Chrome window.
///
/// This is important for screenshots and benchmarks.
final int windowWidth;
/// The height of the Chrome window.
///
/// This is important for screenshots and benchmarks.
final int windowHeight;
/// Launches code in "headless" mode, which allows running Chrome in
/// environments without a display, such as LUCI and Cirrus.
final bool? headless;
/// The port Chrome will use for its debugging protocol.
///
/// If null, Chrome is launched without debugging. When running in headless
/// mode without a debug port, Chrome quits immediately. For most tests it is
/// typical to set [headless] to true and set a non-null debug port.
final int? debugPort;
/// Whether to enable experimental WasmGC flags
final bool enableWasmGC;
}
/// A function called when the Chrome process encounters an error.
typedef ChromeErrorCallback = void Function(String);
/// Manages a single Chrome process.
class Chrome {
Chrome._(this._chromeProcess, this._onError, this._debugConnection) {
// If the Chrome process quits before it was asked to quit, notify the
// error listener.
_chromeProcess.exitCode.then((int exitCode) {
if (!_isStopped) {
_onError('Chrome process exited prematurely with exit code $exitCode');
}
});
}
/// Launches Chrome with the give [options].
///
/// The [onError] callback is called with an error message when the Chrome
/// process encounters an error. In particular, [onError] is called when the
/// Chrome process exits prematurely, i.e. before [stop] is called.
static Future<Chrome> launch(ChromeOptions options, { String? workingDirectory, required ChromeErrorCallback onError }) async {
if (!io.Platform.isWindows) {
final io.ProcessResult versionResult = io.Process.runSync(_findSystemChromeExecutable(), const <String>['--version']);
print('Launching ${versionResult.stdout}');
} else {
print('Launching Chrome...');
}
final String jsFlags = options.enableWasmGC ? <String>[
'--experimental-wasm-gc',
'--experimental-wasm-type-reflection',
].join(' ') : '';
final bool withDebugging = options.debugPort != null;
final List<String> args = <String>[
if (options.userDataDirectory != null)
'--user-data-dir=${options.userDataDirectory}',
if (options.url != null)
options.url!,
if (io.Platform.environment['CHROME_NO_SANDBOX'] == 'true')
'--no-sandbox',
if (options.headless ?? false)
'--headless',
if (withDebugging)
'--remote-debugging-port=${options.debugPort}',
'--window-size=${options.windowWidth},${options.windowHeight}',
'--disable-extensions',
'--disable-popup-blocking',
// Indicates that the browser is in "browse without sign-in" (Guest session) mode.
'--bwsi',
'--no-first-run',
'--no-default-browser-check',
'--disable-default-apps',
'--disable-translate',
if (jsFlags.isNotEmpty) '--js-flags=$jsFlags',
];
final io.Process chromeProcess = await _spawnChromiumProcess(
_findSystemChromeExecutable(),
args,
workingDirectory: workingDirectory,
);
WipConnection? debugConnection;
if (withDebugging) {
debugConnection = await _connectToChromeDebugPort(chromeProcess, options.debugPort!);
}
return Chrome._(chromeProcess, onError, debugConnection);
}
final io.Process _chromeProcess;
final ChromeErrorCallback _onError;
final WipConnection? _debugConnection;
bool _isStopped = false;
Completer<void> ?_tracingCompleter;
StreamSubscription<WipEvent>? _tracingSubscription;
List<Map<String, dynamic>>? _tracingData;
/// Starts recording a performance trace.
///
/// If there is already a tracing session in progress, throws an error. Call
/// [endRecordingPerformance] before starting a new tracing session.
///
/// The [label] is for debugging convenience.
Future<void> beginRecordingPerformance(String label) async {
if (_tracingCompleter != null) {
throw StateError(
'Cannot start a new performance trace. A tracing session labeled '
'"$label" is already in progress.'
);
}
_tracingCompleter = Completer<void>();
_tracingData = <Map<String, dynamic>>[];
// Subscribe to tracing events prior to calling "Tracing.start". Otherwise,
// we'll miss tracing data.
_tracingSubscription = _debugConnection?.onNotification.listen((WipEvent event) {
// We receive data as a sequence of "Tracing.dataCollected" followed by
// "Tracing.tracingComplete" at the end. Until "Tracing.tracingComplete"
// is received, the data may be incomplete.
if (event.method == 'Tracing.tracingComplete') {
_tracingCompleter!.complete();
_tracingSubscription!.cancel();
_tracingSubscription = null;
} else if (event.method == 'Tracing.dataCollected') {
final dynamic value = event.params?['value'];
if (value is! List) {
throw FormatException('"Tracing.dataCollected" returned malformed data. '
'Expected a List but got: ${value.runtimeType}');
}
_tracingData?.addAll((event.params?['value'] as List<dynamic>).cast<Map<String, dynamic>>());
}
});
await _debugConnection?.sendCommand('Tracing.start', <String, dynamic>{
// The choice of categories is as follows:
//
// blink:
// provides everything on the UI thread, including scripting,
// style recalculations, layout, painting, and some compositor
// work.
// blink.user_timing:
// provides marks recorded using window.performance. We use marks
// to find frames that the benchmark cares to measure.
// gpu:
// provides tracing data from the GPU data
// disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1068259
// TODO(yjbanov): extract useful GPU data
'categories': 'blink,blink.user_timing',
'transferMode': 'SendAsStream',
});
}
/// Stops a performance tracing session started by [beginRecordingPerformance].
///
/// Returns all the collected tracing data unfiltered.
Future<List<Map<String, dynamic>>?> endRecordingPerformance() async {
await _debugConnection!.sendCommand('Tracing.end');
await _tracingCompleter!.future;
final List<Map<String, dynamic>>? data = _tracingData;
_tracingCompleter = null;
_tracingData = null;
return data;
}
Future<void> reloadPage({bool ignoreCache = false}) async {
await _debugConnection?.page.reload(ignoreCache: ignoreCache);
}
/// Stops the Chrome process.
void stop() {
_isStopped = true;
_tracingSubscription?.cancel();
_chromeProcess.kill();
}
}
String _findSystemChromeExecutable() {
// On some environments, such as the Dart HHH tester, Chrome resides in a
// non-standard location and is provided via the following environment
// variable.
final String? envExecutable = io.Platform.environment['CHROME_EXECUTABLE'];
if (envExecutable != null) {
return envExecutable;
}
if (io.Platform.isLinux) {
final io.ProcessResult which =
io.Process.runSync('which', <String>['google-chrome']);
if (which.exitCode != 0) {
throw Exception('Failed to locate system Chrome installation.');
}
return (which.stdout as String).trim();
} else if (io.Platform.isMacOS) {
return '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
} else if (io.Platform.isWindows) {
const String kWindowsExecutable = r'Google\Chrome\Application\chrome.exe';
final List<String> kWindowsPrefixes = <String?>[
io.Platform.environment['LOCALAPPDATA'],
io.Platform.environment['PROGRAMFILES'],
io.Platform.environment['PROGRAMFILES(X86)'],
].whereType<String>().toList();
final String windowsPrefix = kWindowsPrefixes.firstWhere((String prefix) {
final String expectedPath = path.join(prefix, kWindowsExecutable);
return io.File(expectedPath).existsSync();
}, orElse: () => '.');
return path.join(windowsPrefix, kWindowsExecutable);
} else {
throw Exception('Web benchmarks cannot run on ${io.Platform.operatingSystem}.');
}
}
/// Waits for Chrome to print DevTools URI and connects to it.
Future<WipConnection> _connectToChromeDebugPort(io.Process chromeProcess, int port) async {
final Uri devtoolsUri = await _getRemoteDebuggerUrl(Uri.parse('http://localhost:$port'));
print('Connecting to DevTools: $devtoolsUri');
final ChromeConnection chromeConnection = ChromeConnection('localhost', port);
final Iterable<ChromeTab> tabs = (await chromeConnection.getTabs()).where((ChromeTab tab) {
return tab.url.startsWith('http://localhost');
});
final ChromeTab tab = tabs.single;
final WipConnection debugConnection = await tab.connect();
print('Connected to Chrome tab: ${tab.title} (${tab.url})');
return debugConnection;
}
/// Gets the Chrome debugger URL for the web page being benchmarked.
Future<Uri> _getRemoteDebuggerUrl(Uri base) async {
final io.HttpClient client = io.HttpClient();
final io.HttpClientRequest request = await client.getUrl(base.resolve('/json/list'));
final io.HttpClientResponse response = await request.close();
final List<dynamic>? jsonObject = await json.fuse(utf8).decoder.bind(response).single as List<dynamic>?;
if (jsonObject == null || jsonObject.isEmpty) {
return base;
}
return base.resolve((jsonObject.first as Map<String, dynamic>)['webSocketDebuggerUrl'] as String);
}
/// Summarizes a Blink trace down to a few interesting values.
class BlinkTraceSummary {
BlinkTraceSummary._({
required this.averageBeginFrameTime,
required this.averageUpdateLifecyclePhasesTime,
}) : averageTotalUIFrameTime = averageBeginFrameTime + averageUpdateLifecyclePhasesTime;
static BlinkTraceSummary? fromJson(List<Map<String, dynamic>> traceJson) {
try {
// Convert raw JSON data to BlinkTraceEvent objects sorted by timestamp.
List<BlinkTraceEvent> events = traceJson
.map<BlinkTraceEvent>(BlinkTraceEvent.fromJson)
.toList()
..sort((BlinkTraceEvent a, BlinkTraceEvent b) => a.ts! - b.ts!);
Exception noMeasuredFramesFound() => Exception(
'No measured frames found in benchmark tracing data. This likely '
'indicates a bug in the benchmark. For example, the benchmark failed '
"to pump enough frames. It may also indicate a change in Chrome's "
'tracing data format. Check if Chrome version changed recently and '
'adjust the parsing code accordingly.',
);
// Use the pid from the first "measured_frame" event since the event is
// emitted by the script running on the process we're interested in.
//
// We previously tried using the "CrRendererMain" event. However, for
// reasons unknown, Chrome in the devicelab refuses to emit this event
// sometimes, causing to flakes.
final BlinkTraceEvent firstMeasuredFrameEvent = events.firstWhere(
(BlinkTraceEvent event) => event.isBeginMeasuredFrame,
orElse: () => throw noMeasuredFramesFound(),
);
final int tabPid = firstMeasuredFrameEvent.pid!;
// Filter out data from unrelated processes
events = events.where((BlinkTraceEvent element) => element.pid == tabPid).toList();
// Extract frame data.
final List<BlinkFrame> frames = <BlinkFrame>[];
int skipCount = 0;
BlinkFrame frame = BlinkFrame();
for (final BlinkTraceEvent event in events) {
if (event.isBeginFrame) {
frame.beginFrame = event;
} else if (event.isUpdateAllLifecyclePhases) {
frame.updateAllLifecyclePhases = event;
if (frame.endMeasuredFrame != null) {
frames.add(frame);
} else {
skipCount += 1;
}
frame = BlinkFrame();
} else if (event.isBeginMeasuredFrame) {
frame.beginMeasuredFrame = event;
} else if (event.isEndMeasuredFrame) {
frame.endMeasuredFrame = event;
}
}
print('Extracted ${frames.length} measured frames.');
print('Skipped $skipCount non-measured frames.');
if (frames.isEmpty) {
throw noMeasuredFramesFound();
}
// Compute averages and summarize.
return BlinkTraceSummary._(
averageBeginFrameTime: _computeAverageDuration(frames.map((BlinkFrame frame) => frame.beginFrame).whereType<BlinkTraceEvent>().toList()),
averageUpdateLifecyclePhasesTime: _computeAverageDuration(frames.map((BlinkFrame frame) => frame.updateAllLifecyclePhases).whereType<BlinkTraceEvent>().toList()),
);
} catch (_) {
final io.File traceFile = io.File('./chrome-trace.json');
io.stderr.writeln('Failed to interpret the Chrome trace contents. The trace was saved in ${traceFile.path}');
traceFile.writeAsStringSync(const JsonEncoder.withIndent(' ').convert(traceJson));
rethrow;
}
}
/// The average duration of "WebViewImpl::beginFrame" events.
///
/// This event contains all of scripting time of an animation frame, plus an
/// unknown small amount of work browser does before and after scripting.
final Duration averageBeginFrameTime;
/// The average duration of "WebViewImpl::updateAllLifecyclePhases" events.
///
/// This event contains style, layout, painting, and compositor computations,
/// which are not included in the scripting time. This event does not
/// include GPU time, which happens on a separate thread.
final Duration averageUpdateLifecyclePhasesTime;
/// The average sum of [averageBeginFrameTime] and
/// [averageUpdateLifecyclePhasesTime].
///
/// This value contains the vast majority of work the UI thread performs in
/// any given animation frame.
final Duration averageTotalUIFrameTime;
@override
String toString() => '$BlinkTraceSummary('
'averageBeginFrameTime: ${averageBeginFrameTime.inMicroseconds / 1000}ms, '
'averageUpdateLifecyclePhasesTime: ${averageUpdateLifecyclePhasesTime.inMicroseconds / 1000}ms)';
}
/// Contains events pertaining to a single frame in the Blink trace data.
class BlinkFrame {
/// Corresponds to 'WebViewImpl::beginFrame' event.
BlinkTraceEvent? beginFrame;
/// Corresponds to 'WebViewImpl::updateAllLifecyclePhases' event.
BlinkTraceEvent? updateAllLifecyclePhases;
/// Corresponds to 'measured_frame' begin event.
BlinkTraceEvent? beginMeasuredFrame;
/// Corresponds to 'measured_frame' end event.
BlinkTraceEvent? endMeasuredFrame;
}
/// Takes a list of events that have non-null [BlinkTraceEvent.tdur] computes
/// their average as a [Duration] value.
Duration _computeAverageDuration(List<BlinkTraceEvent> events) {
// Compute the sum of "tdur" fields of the last _kMeasuredSampleCount events.
final double sum = events
.skip(math.max(events.length - _kMeasuredSampleCount, 0))
.fold(0.0, (double previousValue, BlinkTraceEvent event) {
if (event.tdur == null) {
throw FormatException('Trace event lacks "tdur" field: $event');
}
return previousValue + event.tdur!;
});
final int sampleCount = math.min(events.length, _kMeasuredSampleCount);
return Duration(microseconds: sum ~/ sampleCount);
}
/// An event collected by the Blink tracer (in Chrome accessible using chrome://tracing).
///
/// See also:
/// * https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
class BlinkTraceEvent {
/// Parses an event from its JSON representation.
///
/// Sample event encoded as JSON (the data is bogus, this just shows the format):
///
/// ```
/// {
/// "name": "myName",
/// "cat": "category,list",
/// "ph": "B",
/// "ts": 12345,
/// "pid": 123,
/// "tid": 456,
/// "args": {
/// "someArg": 1,
/// "anotherArg": {
/// "value": "my value"
/// }
/// }
/// }
/// ```
///
/// For detailed documentation of the format see:
///
/// https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
BlinkTraceEvent.fromJson(Map<String, dynamic> json)
: args = json['args'] as Map<String, dynamic>,
cat = json['cat'] as String,
name = json['name'] as String,
ph = json['ph'] as String,
pid = _readInt(json, 'pid'),
tid = _readInt(json, 'tid'),
ts = _readInt(json, 'ts'),
tts = _readInt(json, 'tts'),
tdur = _readInt(json, 'tdur');
/// Event-specific data.
final Map<String, dynamic> args;
/// Event category.
final String cat;
/// Event name.
final String name;
/// Event "phase".
final String ph;
/// Process ID of the process that emitted the event.
final int? pid;
/// Thread ID of the thread that emitted the event.
final int? tid;
/// Timestamp in microseconds using tracer clock.
final int? ts;
/// Timestamp in microseconds using thread clock.
final int? tts;
/// Event duration in microseconds.
final int? tdur;
/// A "begin frame" event contains all of the scripting time of an animation
/// frame (JavaScript, WebAssembly), plus a negligible amount of internal
/// browser overhead.
///
/// This event does not include non-UI thread scripting, such as web workers,
/// service workers, and CSS Paint paintlets.
///
/// WebViewImpl::beginFrame was used in earlier versions of Chrome, kept
/// for compatibility.
///
/// This event is a duration event that has its `tdur` populated.
bool get isBeginFrame {
return ph == 'X' && (
name == 'WebViewImpl::beginFrame' ||
name == 'WebFrameWidgetBase::BeginMainFrame' ||
name == 'WebFrameWidgetImpl::BeginMainFrame'
);
}
/// An "update all lifecycle phases" event contains UI thread computations
/// related to an animation frame that's outside the scripting phase.
///
/// This event includes style recalculation, layer tree update, layout,
/// painting, and parts of compositing work.
///
/// WebViewImpl::updateAllLifecyclePhases was used in earlier versions of
/// Chrome, kept for compatibility.
///
/// This event is a duration event that has its `tdur` populated.
bool get isUpdateAllLifecyclePhases {
return ph == 'X' && (
name == 'WebViewImpl::updateAllLifecyclePhases' ||
name == 'WebFrameWidgetImpl::UpdateLifecycle'
);
}
/// Whether this is the beginning of a "measured_frame" event.
///
/// This event is a custom event emitted by our benchmark test harness.
///
/// See also:
/// * `recorder.dart`, which emits this event.
bool get isBeginMeasuredFrame => ph == 'b' && name == 'measured_frame';
/// Whether this is the end of a "measured_frame" event.
///
/// This event is a custom event emitted by our benchmark test harness.
///
/// See also:
/// * `recorder.dart`, which emits this event.
bool get isEndMeasuredFrame => ph == 'e' && name == 'measured_frame';
@override
String toString() => '$BlinkTraceEvent('
'args: ${json.encode(args)}, '
'cat: $cat, '
'name: $name, '
'ph: $ph, '
'pid: $pid, '
'tid: $tid, '
'ts: $ts, '
'tts: $tts, '
'tdur: $tdur)';
}
/// Read an integer out of [json] stored under [key].
///
/// Since JSON does not distinguish between `int` and `double`, extra
/// validation and conversion is needed.
///
/// Returns null if the value is null.
int? _readInt(Map<String, dynamic> json, String key) {
final num? jsonValue = json[key] as num?;
return jsonValue?.toInt();
}
/// Used by [Chrome.launch] to detect a glibc bug and retry launching the
/// browser.
///
/// Once every few thousands of launches we hit this glibc bug:
///
/// https://sourceware.org/bugzilla/show_bug.cgi?id=19329.
///
/// When this happens Chrome spits out something like the following then exits with code 127:
///
/// Inconsistency detected by ld.so: ../elf/dl-tls.c: 493: _dl_allocate_tls_init: Assertion `listp->slotinfo[cnt].gen <= GL(dl_tls_generation)' failed!
const String _kGlibcError = 'Inconsistency detected by ld.so';
Future<io.Process> _spawnChromiumProcess(String executable, List<String> args, { String? workingDirectory }) async {
// Keep attempting to launch the browser until one of:
// - Chrome launched successfully, in which case we just return from the loop.
// - The tool detected an unretryable Chrome error, in which case we throw ToolExit.
while (true) {
final io.Process process = await io.Process.start(executable, args, workingDirectory: workingDirectory);
process.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.listen((String line) {
print('[CHROME STDOUT]: $line');
});
// Wait until the DevTools are listening before trying to connect. This is
// only required for flutter_test --platform=chrome and not flutter run.
bool hitGlibcBug = false;
await process.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.map((String line) {
print('[CHROME STDERR]:$line');
if (line.contains(_kGlibcError)) {
hitGlibcBug = true;
}
return line;
})
.firstWhere((String line) => line.startsWith('DevTools listening'), orElse: () {
if (hitGlibcBug) {
print(
'Encountered glibc bug https://sourceware.org/bugzilla/show_bug.cgi?id=19329. '
'Will try launching browser again.',
);
return '';
}
print('Failed to launch browser. Command used to launch it: ${args.join(' ')}');
throw Exception(
'Failed to launch browser. Make sure you are using an up-to-date '
'Chrome or Edge. Otherwise, consider using -d web-server instead '
'and filing an issue at https://github.com/flutter/flutter/issues.',
);
});
if (!hitGlibcBug) {
return process;
}
// A precaution that avoids accumulating browser processes, in case the
// glibc bug doesn't cause the browser to quit and we keep looping and
// launching more processes.
unawaited(process.exitCode.timeout(const Duration(seconds: 1), onTimeout: () {
process.kill();
return 0;
}));
}
}
| flutter/dev/devicelab/lib/framework/browser.dart/0 | {
"file_path": "flutter/dev/devicelab/lib/framework/browser.dart",
"repo_id": "flutter",
"token_count": 8014
} | 669 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import '../framework/devices.dart';
import '../framework/framework.dart';
import '../framework/task_result.dart';
import '../framework/utils.dart';
TaskFunction androidVerifiedInputTest({Map<String, String>? environment}) {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/android_verified_input',
'test_driver/main_test.dart',
environment: environment,
).call;
}
class DriverTest {
DriverTest(
this.testDirectory,
this.testTarget, {
this.extraOptions = const <String>[],
this.deviceIdOverride,
this.environment,
}
);
final String testDirectory;
final String testTarget;
final List<String> extraOptions;
final String? deviceIdOverride;
final Map<String, String>? environment;
Future<TaskResult> call() {
return inDirectory<TaskResult>(testDirectory, () async {
String deviceId;
if (deviceIdOverride != null) {
deviceId = deviceIdOverride!;
} else {
final Device device = await devices.workingDevice;
await device.unlock();
deviceId = device.deviceId;
}
await flutter('packages', options: <String>['get']);
final List<String> options = <String>[
'--no-android-gradle-daemon',
'-v',
'-t',
testTarget,
'-d',
deviceId,
...extraOptions,
];
await flutter('drive', options: options, environment: environment);
return TaskResult.success(null);
});
}
}
| flutter/dev/devicelab/lib/tasks/android_verified_input_test.dart/0 | {
"file_path": "flutter/dev/devicelab/lib/tasks/android_verified_input_test.dart",
"repo_id": "flutter",
"token_count": 602
} | 670 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:convert' show json;
import 'dart:io' as io;
import 'package:logging/logging.dart';
import 'package:path/path.dart' as path;
import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart' as shelf_io;
import 'package:shelf_static/shelf_static.dart';
import '../framework/browser.dart';
import '../framework/task_result.dart';
import '../framework/utils.dart';
/// The port number used by the local benchmark server.
const int benchmarkServerPort = 9999;
const int chromeDebugPort = 10000;
typedef WebBenchmarkOptions = ({
String webRenderer,
bool useWasm,
});
Future<TaskResult> runWebBenchmark(WebBenchmarkOptions benchmarkOptions) async {
// Reduce logging level. Otherwise, package:webkit_inspection_protocol is way too spammy.
Logger.root.level = Level.INFO;
final String macrobenchmarksDirectory = path.join(flutterDirectory.path, 'dev', 'benchmarks', 'macrobenchmarks');
return inDirectory(macrobenchmarksDirectory, () async {
await flutter('clean');
await evalFlutter('build', options: <String>[
'web',
if (benchmarkOptions.useWasm) ...<String>[
'-O4',
'--wasm',
'--no-strip-wasm',
],
'--dart-define=FLUTTER_WEB_ENABLE_PROFILING=true',
if (!benchmarkOptions.useWasm) '--web-renderer=${benchmarkOptions.webRenderer}',
'--profile',
'--no-web-resources-cdn',
'-t',
'lib/web_benchmarks.dart',
]);
final Completer<List<Map<String, dynamic>>> profileData = Completer<List<Map<String, dynamic>>>();
final List<Map<String, dynamic>> collectedProfiles = <Map<String, dynamic>>[];
List<String>? benchmarks;
late Iterator<String> benchmarkIterator;
// This future fixes a race condition between the web-page loading and
// asking to run a benchmark, and us connecting to Chrome's DevTools port.
// Sometime one wins. Other times, the other wins.
Future<Chrome>? whenChromeIsReady;
Chrome? chrome;
late io.HttpServer server;
Cascade cascade = Cascade();
List<Map<String, dynamic>>? latestPerformanceTrace;
cascade = cascade.add((Request request) async {
try {
chrome ??= await whenChromeIsReady;
if (request.requestedUri.path.endsWith('/profile-data')) {
final Map<String, dynamic> profile = json.decode(await request.readAsString()) as Map<String, dynamic>;
final String benchmarkName = profile['name'] as String;
if (benchmarkName != benchmarkIterator.current) {
profileData.completeError(Exception(
'Browser returned benchmark results from a wrong benchmark.\n'
'Requested to run benchmark ${benchmarkIterator.current}, but '
'got results for $benchmarkName.',
));
unawaited(server.close());
}
// Trace data is null when the benchmark is not frame-based, such as RawRecorder.
if (latestPerformanceTrace != null) {
final BlinkTraceSummary traceSummary = BlinkTraceSummary.fromJson(latestPerformanceTrace!)!;
profile['totalUiFrame.average'] = traceSummary.averageTotalUIFrameTime.inMicroseconds;
profile['scoreKeys'] ??= <dynamic>[]; // using dynamic for consistency with JSON
(profile['scoreKeys'] as List<dynamic>).add('totalUiFrame.average');
latestPerformanceTrace = null;
}
collectedProfiles.add(profile);
return Response.ok('Profile received');
} else if (request.requestedUri.path.endsWith('/start-performance-tracing')) {
latestPerformanceTrace = null;
await chrome!.beginRecordingPerformance(request.requestedUri.queryParameters['label']!);
return Response.ok('Started performance tracing');
} else if (request.requestedUri.path.endsWith('/stop-performance-tracing')) {
latestPerformanceTrace = await chrome!.endRecordingPerformance();
return Response.ok('Stopped performance tracing');
} else if (request.requestedUri.path.endsWith('/on-error')) {
final Map<String, dynamic> errorDetails = json.decode(await request.readAsString()) as Map<String, dynamic>;
unawaited(server.close());
// Keep the stack trace as a string. It's thrown in the browser, not this Dart VM.
profileData.completeError('${errorDetails['error']}\n${errorDetails['stackTrace']}');
return Response.ok('');
} else if (request.requestedUri.path.endsWith('/next-benchmark')) {
if (benchmarks == null) {
benchmarks = (json.decode(await request.readAsString()) as List<dynamic>).cast<String>();
benchmarkIterator = benchmarks!.iterator;
}
if (benchmarkIterator.moveNext()) {
final String nextBenchmark = benchmarkIterator.current;
print('Launching benchmark "$nextBenchmark"');
return Response.ok(nextBenchmark);
} else {
profileData.complete(collectedProfiles);
return Response.notFound('Finished running benchmarks.');
}
} else if (request.requestedUri.path.endsWith('/print-to-console')) {
// A passthrough used by
// `dev/benchmarks/macrobenchmarks/lib/web_benchmarks.dart`
// to print information.
final String message = await request.readAsString();
print('[APP] $message');
return Response.ok('Reported.');
} else {
return Response.notFound(
'This request is not handled by the profile-data handler.');
}
} catch (error, stackTrace) {
profileData.completeError(error, stackTrace);
return Response.internalServerError(body: '$error');
}
}).add(createBuildDirectoryHandler(
path.join(macrobenchmarksDirectory, 'build', 'web'),
));
server = await io.HttpServer.bind('localhost', benchmarkServerPort);
try {
shelf_io.serveRequests(server, cascade.handler);
final String dartToolDirectory = path.join('$macrobenchmarksDirectory/.dart_tool');
final String userDataDir = io.Directory(dartToolDirectory).createTempSync('flutter_chrome_user_data.').path;
// TODO(yjbanov): temporarily disables headful Chrome until we get
// devicelab hardware that is able to run it. Our current
// GCE VMs can only run in headless mode.
// See: https://github.com/flutter/flutter/issues/50164
final bool isUncalibratedSmokeTest = io.Platform.environment['CALIBRATED'] != 'true';
// final bool isUncalibratedSmokeTest =
// io.Platform.environment['UNCALIBRATED_SMOKE_TEST'] == 'true';
final ChromeOptions options = ChromeOptions(
url: 'http://localhost:$benchmarkServerPort/index.html',
userDataDirectory: userDataDir,
headless: isUncalibratedSmokeTest,
debugPort: chromeDebugPort,
enableWasmGC: benchmarkOptions.useWasm,
);
print('Launching Chrome.');
whenChromeIsReady = Chrome.launch(
options,
onError: (String error) {
profileData.completeError(Exception(error));
},
workingDirectory: cwd,
);
print('Waiting for the benchmark to report benchmark profile.');
final Map<String, dynamic> taskResult = <String, dynamic>{};
final List<String> benchmarkScoreKeys = <String>[];
final List<Map<String, dynamic>> profiles = await profileData.future;
print('Received profile data');
for (final Map<String, dynamic> profile in profiles) {
final String benchmarkName = profile['name'] as String;
if (benchmarkName.isEmpty) {
throw 'Benchmark name is empty';
}
final String namespace = '$benchmarkName.${benchmarkOptions.webRenderer}';
final List<String> scoreKeys = List<String>.from(profile['scoreKeys'] as List<dynamic>);
if (scoreKeys.isEmpty) {
throw 'No score keys in benchmark "$benchmarkName"';
}
for (final String scoreKey in scoreKeys) {
if (scoreKey.isEmpty) {
throw 'Score key is empty in benchmark "$benchmarkName". '
'Received [${scoreKeys.join(', ')}]';
}
benchmarkScoreKeys.add('$namespace.$scoreKey');
}
for (final String key in profile.keys) {
if (key == 'name' || key == 'scoreKeys') {
continue;
}
taskResult['$namespace.$key'] = profile[key];
}
}
return TaskResult.success(taskResult, benchmarkScoreKeys: benchmarkScoreKeys);
} finally {
unawaited(server.close());
chrome?.stop();
}
});
}
Handler createBuildDirectoryHandler(String buildDirectoryPath) {
final Handler childHandler = createStaticHandler(buildDirectoryPath);
return (Request request) async {
final Response response = await childHandler(request);
final String? mimeType = response.mimeType;
// Provide COOP/COEP headers so that the browser loads the page as
// crossOriginIsolated. This will make sure that we get high-resolution
// timers for our benchmark measurements.
if (mimeType == 'text/html' || mimeType == 'text/javascript') {
return response.change(headers: <String, String>{
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
});
} else {
return response;
}
};
}
| flutter/dev/devicelab/lib/tasks/web_benchmarks.dart/0 | {
"file_path": "flutter/dev/devicelab/lib/tasks/web_benchmarks.dart",
"repo_id": "flutter",
"token_count": 3693
} | 671 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter_devicelab/framework/runner.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import '../common.dart';
void main() {
final Map<String, String> isolateParams = <String, String>{
'runFlutterConfig': 'false',
'timeoutInMinutes': '1',
};
test('runs build and test when no args are passed', () async {
final TaskResult result = await runTask(
'smoke_test_build_test',
deviceId: 'FAKE_SUCCESS',
isolateParams: isolateParams,
);
expect(result.data!['benchmark'], 'data');
});
test('runs build only when build arg is given', () async {
final TaskResult result = await runTask(
'smoke_test_build_test',
taskArgs: <String>['--build'],
deviceId: 'FAKE_SUCCESS',
isolateParams: isolateParams,
);
expect(result.message, 'No tests run');
});
test('runs test only when test arg is given', () async {
final TaskResult result = await runTask(
'smoke_test_build_test',
taskArgs: <String>['--test'],
deviceId: 'FAKE_SUCCESS',
isolateParams: isolateParams,
);
expect(result.data!['benchmark'], 'data');
});
test('sets environment', () async {
final StringBuffer capturedPrintLines = StringBuffer();
await runZoned<Future<void>>(
() async {
await runTask(
'smoke_test_build_test',
taskArgs: <String>['--test'],
deviceId: 'FAKE_SUCCESS',
isolateParams: isolateParams,
);
},
zoneSpecification: ZoneSpecification(
// Intercept printing from the task.
print: (Zone self, ZoneDelegate parent, Zone zone, String line) async {
capturedPrintLines.writeln(line);
},
),
);
final String capturedPrint = capturedPrintLines.toString();
expect(capturedPrint,
contains('with environment {FLUTTER_DEVICELAB_DEVICEID: FAKE_SUCCESS, BOT: true, LANG: en_US.UTF-8}'));
expect(capturedPrint, contains('Process terminated with exit code 0.'));
});
test('throws exception when build and test arg are given', () async {
final TaskResult result = await runTask(
'smoke_test_build_test',
taskArgs: <String>['--build', '--test'],
deviceId: 'FAKE_SUCCESS',
isolateParams: isolateParams,
);
expect(result.message, 'Task failed: Exception: Both build and test should not be passed. Pass only one.');
});
test('copies artifacts when build and application binary arg are given', () async {
final TaskResult result = await runTask(
'smoke_test_build_test',
taskArgs: <String>['--build', '--application-binary-path=test'],
deviceId: 'FAKE_SUCCESS',
isolateParams: isolateParams,
);
expect(result.message, 'No tests run');
});
}
| flutter/dev/devicelab/test/tasks/build_test_task_test.dart/0 | {
"file_path": "flutter/dev/devicelab/test/tasks/build_test_task_test.dart",
"repo_id": "flutter",
"token_count": 1118
} | 672 |
{
"rules": {
".read": false,
".write": false
}
}
| flutter/dev/docs/firebase_rules.json/0 | {
"file_path": "flutter/dev/docs/firebase_rules.json",
"repo_id": "flutter",
"token_count": 30
} | 673 |
name: forbidden_from_release_tests
publish_to: 'none'
environment:
sdk: '>=3.2.0-0 <4.0.0'
dependencies:
args: 2.4.2
file: 7.0.0
package_config: 2.1.0
path: 1.9.0
process: 5.0.2
vm_snapshot_analysis: 0.7.6
collection: 1.18.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
meta: 1.12.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
platform: 3.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
# PUBSPEC CHECKSUM: b68e
| flutter/dev/forbidden_from_release_tests/pubspec.yaml/0 | {
"file_path": "flutter/dev/forbidden_from_release_tests/pubspec.yaml",
"repo_id": "flutter",
"token_count": 227
} | 674 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
const MethodChannel channel = MethodChannel('com.example.abstract_method_smoke_test');
await channel.invokeMethod<void>('show_keyboard');
runApp(const MyApp());
print('Test succeeded');
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePage();
}
class _HomePage extends State<HomePage> {
@override
void initState() {
super.initState();
// Trigger the second route.
// https://github.com/flutter/flutter/issues/40126
WidgetsBinding.instance.addPostFrameCallback((_) async {
Navigator.of(context).push(
MaterialPageRoute<void>(builder: (_) => const SecondPage()));
});
}
@override
Widget build(BuildContext context) {
return const Scaffold();
}
}
class SecondPage extends StatelessWidget {
const SecondPage({super.key});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Column(
children: <Widget>[
Expanded(
child: AndroidView(viewType: 'simple')
),
],
),
);
}
}
| flutter/dev/integration_tests/abstract_method_smoke_test/lib/main.dart/0 | {
"file_path": "flutter/dev/integration_tests/abstract_method_smoke_test/lib/main.dart",
"repo_id": "flutter",
"token_count": 611
} | 675 |
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android_embedding_v2_smoke_test">
<!-- ${applicationName} is used by the Flutter tool to select the Application
class to use. For most apps, this is the default Android application.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
Application and put your custom class here. -->
<application
android:name="${applicationName}"
android:label="android_embedding_v2_smoke_test">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
</manifest>
| flutter/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/AndroidManifest.xml/0 | {
"file_path": "flutter/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/AndroidManifest.xml",
"repo_id": "flutter",
"token_count": 856
} | 676 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// The name of the route containing the test suite.
const String selectionControlsRoute = 'controls';
/// The string supplied to the [ValueKey] for the enabled checkbox.
const String checkboxKeyValue = 'SelectionControls#Checkbox1';
/// The string supplied to the [ValueKey] for the disabled checkbox.
const String disabledCheckboxKeyValue = 'SelectionControls#Checkbox2';
/// The string supplied to the [ValueKey] for the radio button with value 1.
const String radio1KeyValue = 'SelectionControls#Radio1';
/// The string supplied to the [ValueKey] for the radio button with value 2.
const String radio2KeyValue = 'SelectionControls#Radio2';
/// The string supplied to the [ValueKey] for the radio button with value 3.
const String radio3KeyValue = 'SelectionControls#Radio3';
/// The string supplied to the [ValueKey] for the switch.
const String switchKeyValue = 'SelectionControls#Switch1';
/// The string supplied to the [ValueKey] for the labeled switch.
const String labeledSwitchKeyValue = 'SelectionControls#Switch2';
/// The label of the labeled switch.
const String switchLabel = 'Label';
| flutter/dev/integration_tests/android_semantics_testing/lib/src/tests/controls_constants.dart/0 | {
"file_path": "flutter/dev/integration_tests/android_semantics_testing/lib/src/tests/controls_constants.dart",
"repo_id": "flutter",
"token_count": 335
} | 677 |
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
| flutter/dev/integration_tests/android_views/android/gradle.properties/0 | {
"file_path": "flutter/dev/integration_tests/android_views/android/gradle.properties",
"repo_id": "flutter",
"token_count": 54
} | 678 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: "com.android.dynamic-feature"
android {
namespace "io.flutter.integration.deferred_components_test.component1"
compileSdk 34
sourceSets {
applicationVariants.all { variant ->
main.assets.srcDirs += "${project.buildDir}/intermediates/flutter/${variant.name}/deferred_assets"
main.jniLibs.srcDirs += "${project.buildDir}/intermediates/flutter/${variant.name}/deferred_libs"
}
}
defaultConfig {
minSdkVersion 21
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
dependencies {
implementation project(":app")
}
| flutter/dev/integration_tests/deferred_components_test/android/component1/build.gradle/0 | {
"file_path": "flutter/dev/integration_tests/deferred_components_test/android/component1/build.gradle",
"repo_id": "flutter",
"token_count": 532
} | 679 |
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.flutter.externalui">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name="${applicationName}"
android:label="external_textures">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:exported="true"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
</manifest>
| flutter/dev/integration_tests/external_textures/android/app/src/main/AndroidManifest.xml/0 | {
"file_path": "flutter/dev/integration_tests/external_textures/android/app/src/main/AndroidManifest.xml",
"repo_id": "flutter",
"token_count": 730
} | 680 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is auto generated.
// To update all the build.gradle files in the Flutter repo,
// See dev/tools/bin/generate_gradle_lockfiles.dart.
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
dependencyLocking {
ignoredDependencies.add('io.flutter:*')
lockFile = file("${rootProject.projectDir}/project-${project.name}.lockfile")
if (!project.hasProperty('local-engine-repo')) {
lockAllConfigurations()
}
}
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
| flutter/dev/integration_tests/flavors/android/build.gradle/0 | {
"file_path": "flutter/dev/integration_tests/flavors/android/build.gradle",
"repo_id": "flutter",
"token_count": 329
} | 681 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import Cocoa
import FlutterMacOS
@NSApplicationMain
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
}
| flutter/dev/integration_tests/flavors/macos/Runner/AppDelegate.swift/0 | {
"file_path": "flutter/dev/integration_tests/flavors/macos/Runner/AppDelegate.swift",
"repo_id": "flutter",
"token_count": 106
} | 682 |
include: ../../analysis_options.yaml
analyzer:
exclude:
- build/**
| flutter/dev/integration_tests/flutter_gallery/analysis_options.yaml/0 | {
"file_path": "flutter/dev/integration_tests/flutter_gallery/analysis_options.yaml",
"repo_id": "flutter",
"token_count": 28
} | 683 |
#include "Generated.xcconfig"
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
| flutter/dev/integration_tests/flutter_gallery/ios/Flutter/Release.xcconfig/0 | {
"file_path": "flutter/dev/integration_tests/flutter_gallery/ios/Flutter/Release.xcconfig",
"repo_id": "flutter",
"token_count": 41
} | 684 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'sections.dart';
const double kSectionIndicatorWidth = 32.0;
// The card for a single section. Displays the section's gradient and background image.
class SectionCard extends StatelessWidget {
const SectionCard({ super.key, required this.section });
final Section section;
@override
Widget build(BuildContext context) {
return Semantics(
label: section.title,
button: true,
child: DecoratedBox(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: <Color>[
section.leftColor!,
section.rightColor!,
],
),
),
child: Image.asset(
section.backgroundAsset!,
package: section.backgroundAssetPackage,
color: const Color.fromRGBO(255, 255, 255, 0.075),
colorBlendMode: BlendMode.modulate,
fit: BoxFit.cover,
),
),
);
}
}
// The title is rendered with two overlapping text widgets that are vertically
// offset a little. It's supposed to look sort-of 3D.
class SectionTitle extends StatelessWidget {
const SectionTitle({
super.key,
required this.section,
required this.scale,
required this.opacity,
}) : assert(opacity >= 0.0 && opacity <= 1.0);
final Section section;
final double scale;
final double opacity;
static const TextStyle sectionTitleStyle = TextStyle(
fontFamily: 'Raleway',
inherit: false,
fontSize: 24.0,
fontWeight: FontWeight.w500,
color: Colors.white,
textBaseline: TextBaseline.alphabetic,
);
static final TextStyle sectionTitleShadowStyle = sectionTitleStyle.copyWith(
color: const Color(0x19000000),
);
@override
Widget build(BuildContext context) {
return IgnorePointer(
child: Opacity(
opacity: opacity,
child: Transform(
transform: Matrix4.identity()..scale(scale),
alignment: Alignment.center,
child: Stack(
children: <Widget>[
Positioned(
top: 4.0,
child: Text(section.title!, style: sectionTitleShadowStyle),
),
Text(section.title!, style: sectionTitleStyle),
],
),
),
),
);
}
}
// Small horizontal bar that indicates the selected section.
class SectionIndicator extends StatelessWidget {
const SectionIndicator({ super.key, this.opacity = 1.0 });
final double opacity;
@override
Widget build(BuildContext context) {
return IgnorePointer(
child: Container(
width: kSectionIndicatorWidth,
height: 3.0,
color: Colors.white.withOpacity(opacity),
),
);
}
}
// Display a single SectionDetail.
class SectionDetailView extends StatelessWidget {
SectionDetailView({ super.key, required this.detail })
: assert(detail.imageAsset != null),
assert((detail.imageAsset ?? detail.title) != null);
final SectionDetail detail;
@override
Widget build(BuildContext context) {
final Widget image = DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
image: DecorationImage(
image: AssetImage(
detail.imageAsset!,
package: detail.imageAssetPackage,
),
fit: BoxFit.cover,
),
),
);
Widget item;
if (detail.title == null && detail.subtitle == null) {
item = Container(
height: 240.0,
padding: const EdgeInsets.all(16.0),
child: SafeArea(
top: false,
bottom: false,
child: image,
),
);
} else {
item = ListTile(
title: Text(detail.title!),
subtitle: Text(detail.subtitle!),
leading: SizedBox(width: 32.0, height: 32.0, child: image),
);
}
return DecoratedBox(
decoration: BoxDecoration(color: Colors.grey.shade200),
child: item,
);
}
}
| flutter/dev/integration_tests/flutter_gallery/lib/demo/animation/widgets.dart/0 | {
"file_path": "flutter/dev/integration_tests/flutter_gallery/lib/demo/animation/widgets.dart",
"repo_id": "flutter",
"token_count": 1677
} | 685 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/cupertino.dart';
import '../../gallery/demo.dart';
class CupertinoSwitchDemo extends StatefulWidget {
const CupertinoSwitchDemo({super.key});
static const String routeName = '/cupertino/switch';
@override
State<CupertinoSwitchDemo> createState() => _CupertinoSwitchDemoState();
}
class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
bool _switchValue = false;
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: const Text('Switch'),
// We're specifying a back label here because the previous page is a
// Material page. CupertinoPageRoutes could auto-populate these back
// labels.
previousPageTitle: 'Cupertino',
trailing: CupertinoDemoDocumentationButton(CupertinoSwitchDemo.routeName),
),
child: DefaultTextStyle(
style: CupertinoTheme.of(context).textTheme.textStyle,
child: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Semantics(
container: true,
child: Column(
children: <Widget>[
CupertinoSwitch(
value: _switchValue,
onChanged: (bool value) {
setState(() {
_switchValue = value;
});
},
),
Text(
"Enabled - ${_switchValue ? "On" : "Off"}"
),
],
),
),
Semantics(
container: true,
child: const Column(
children: <Widget>[
CupertinoSwitch(
value: true,
onChanged: null,
),
Text(
'Disabled - On'
),
],
),
),
Semantics(
container: true,
child: const Column(
children: <Widget>[
CupertinoSwitch(
value: false,
onChanged: null,
),
Text(
'Disabled - Off'
),
],
),
),
],
),
),
),
),
);
}
}
| flutter/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart/0 | {
"file_path": "flutter/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart",
"repo_id": "flutter",
"token_count": 1662
} | 686 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
class ElevationDemo extends StatefulWidget {
const ElevationDemo({super.key});
static const String routeName = '/material/elevation';
@override
State<StatefulWidget> createState() => _ElevationDemoState();
}
class _ElevationDemoState extends State<ElevationDemo> {
bool _showElevation = true;
List<Widget> buildCards() {
const List<double> elevations = <double>[
0.0,
1.0,
2.0,
3.0,
4.0,
5.0,
8.0,
16.0,
24.0,
];
return elevations.map<Widget>((double elevation) {
return Center(
child: Card(
margin: const EdgeInsets.all(20.0),
elevation: _showElevation ? elevation : 0.0,
child: SizedBox(
height: 100.0,
width: 100.0,
child: Center(
child: Text('${elevation.toStringAsFixed(0)} pt'),
),
),
),
);
}).toList();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Elevation'),
actions: <Widget>[
MaterialDemoDocumentationButton(ElevationDemo.routeName),
IconButton(
tooltip: 'Toggle elevation',
icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () {
setState(() => _showElevation = !_showElevation);
},
),
],
),
body: Scrollbar(
child: ListView(
primary: true,
children: buildCards(),
),
),
);
}
}
| flutter/dev/integration_tests/flutter_gallery/lib/demo/material/elevation_demo.dart/0 | {
"file_path": "flutter/dev/integration_tests/flutter_gallery/lib/demo/material/elevation_demo.dart",
"repo_id": "flutter",
"token_count": 848
} | 687 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import '../../gallery/demo.dart';
enum TabsDemoStyle {
iconsAndText,
iconsOnly,
textOnly
}
class _Page {
const _Page({ this.icon, this.text });
final IconData? icon;
final String? text;
}
const List<_Page> _allPages = <_Page>[
_Page(icon: Icons.grade, text: 'TRIUMPH'),
_Page(icon: Icons.playlist_add, text: 'NOTE'),
_Page(icon: Icons.check_circle, text: 'SUCCESS'),
_Page(icon: Icons.question_answer, text: 'OVERSTATE'),
_Page(icon: Icons.sentiment_very_satisfied, text: 'SATISFACTION'),
_Page(icon: Icons.camera, text: 'APERTURE'),
_Page(icon: Icons.assignment_late, text: 'WE MUST'),
_Page(icon: Icons.assignment_turned_in, text: 'WE CAN'),
_Page(icon: Icons.group, text: 'ALL'),
_Page(icon: Icons.block, text: 'EXCEPT'),
_Page(icon: Icons.sentiment_very_dissatisfied, text: 'CRYING'),
_Page(icon: Icons.error, text: 'MISTAKE'),
_Page(icon: Icons.loop, text: 'TRYING'),
_Page(icon: Icons.cake, text: 'CAKE'),
];
class ScrollableTabsDemo extends StatefulWidget {
const ScrollableTabsDemo({super.key});
static const String routeName = '/material/scrollable-tabs';
@override
ScrollableTabsDemoState createState() => ScrollableTabsDemoState();
}
class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTickerProviderStateMixin {
TabController? _controller;
TabsDemoStyle _demoStyle = TabsDemoStyle.iconsAndText;
bool _customIndicator = false;
@override
void initState() {
super.initState();
_controller = TabController(vsync: this, length: _allPages.length);
}
@override
void dispose() {
_controller!.dispose();
super.dispose();
}
void changeDemoStyle(TabsDemoStyle style) {
setState(() {
_demoStyle = style;
});
}
Decoration? getIndicator() {
if (!_customIndicator) {
return const UnderlineTabIndicator();
}
switch (_demoStyle) {
case TabsDemoStyle.iconsAndText:
return ShapeDecoration(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0)),
side: BorderSide(
color: Colors.white24,
width: 2.0,
),
) + const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0)),
side: BorderSide(
color: Colors.transparent,
width: 4.0,
),
),
);
case TabsDemoStyle.iconsOnly:
return ShapeDecoration(
shape: const CircleBorder(
side: BorderSide(
color: Colors.white24,
width: 4.0,
),
) + const CircleBorder(
side: BorderSide(
color: Colors.transparent,
width: 4.0,
),
),
);
case TabsDemoStyle.textOnly:
return ShapeDecoration(
shape: const StadiumBorder(
side: BorderSide(
color: Colors.white24,
width: 2.0,
),
) + const StadiumBorder(
side: BorderSide(
color: Colors.transparent,
width: 4.0,
),
),
);
}
}
@override
Widget build(BuildContext context) {
final Color iconColor = Theme.of(context).colorScheme.secondary;
return Scaffold(
appBar: AppBar(
title: const Text('Scrollable tabs'),
actions: <Widget>[
MaterialDemoDocumentationButton(ScrollableTabsDemo.routeName),
IconButton(
tooltip: 'Custom Indicator',
icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () {
setState(() {
_customIndicator = !_customIndicator;
});
},
),
PopupMenuButton<TabsDemoStyle>(
tooltip: 'Popup Menu',
onSelected: changeDemoStyle,
itemBuilder: (BuildContext context) => <PopupMenuItem<TabsDemoStyle>>[
const PopupMenuItem<TabsDemoStyle>(
value: TabsDemoStyle.iconsAndText,
child: Text('Icons and text'),
),
const PopupMenuItem<TabsDemoStyle>(
value: TabsDemoStyle.iconsOnly,
child: Text('Icons only'),
),
const PopupMenuItem<TabsDemoStyle>(
value: TabsDemoStyle.textOnly,
child: Text('Text only'),
),
],
),
],
bottom: TabBar(
controller: _controller,
isScrollable: true,
indicator: getIndicator(),
tabs: _allPages.map<Tab>((_Page page) {
return switch (_demoStyle) {
TabsDemoStyle.iconsAndText => Tab(text: page.text, icon: Icon(page.icon)),
TabsDemoStyle.iconsOnly => Tab(icon: Icon(page.icon)),
TabsDemoStyle.textOnly => Tab(text: page.text),
};
}).toList()
),
),
body: TabBarView(
controller: _controller,
children: _allPages.map<Widget>((_Page page) {
return SafeArea(
top: false,
bottom: false,
child: Container(
key: ObjectKey(page.icon),
padding: const EdgeInsets.all(12.0),
child: Card(
child: Center(
child: Icon(
page.icon,
color: iconColor,
size: 128.0,
semanticLabel: 'Placeholder for ${page.text} tab',
),
),
),
),
);
}).toList(),
),
);
}
}
| flutter/dev/integration_tests/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart/0 | {
"file_path": "flutter/dev/integration_tests/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart",
"repo_id": "flutter",
"token_count": 2886
} | 688 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'colors.dart';
class LoginPage extends StatefulWidget {
const LoginPage({super.key});
@override
State<LoginPage> createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
final TextEditingController _usernameController = TextEditingController();
final TextEditingController _passwordController = TextEditingController();
static const ShapeDecoration _decoration = ShapeDecoration(
shape: BeveledRectangleBorder(
side: BorderSide(color: kShrineBrown900, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(7.0)),
),
);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0.0,
backgroundColor: Colors.white,
leading: IconButton(
icon: const BackButtonIcon(),
tooltip: MaterialLocalizations.of(context).backButtonTooltip,
onPressed: () {
// The login screen is immediately displayed on top of the Shrine
// home screen using onGenerateRoute and so rootNavigator must be
// set to true in order to get out of Shrine completely.
Navigator.of(context, rootNavigator: true).pop();
},
),
),
body: SafeArea(
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 24.0),
children: <Widget>[
const SizedBox(height: 80.0),
Column(
children: <Widget>[
Image.asset('packages/shrine_images/diamond.png'),
const SizedBox(height: 16.0),
Text(
'SHRINE',
style: Theme.of(context).textTheme.headlineSmall,
),
],
),
const SizedBox(height: 120.0),
PrimaryColorOverride(
color: kShrineBrown900,
child: Container(
decoration: _decoration,
child: TextField(
controller: _usernameController,
decoration: const InputDecoration(
labelText: 'Username',
),
),
),
),
const SizedBox(height: 12.0),
PrimaryColorOverride(
color: kShrineBrown900,
child: Container(
decoration: _decoration,
child: TextField(
controller: _passwordController,
decoration: const InputDecoration(
labelText: 'Password',
),
),
),
),
const SizedBox(height: 12.0),
OverflowBar(
spacing: 8,
alignment: MainAxisAlignment.end,
children: <Widget>[
TextButton(
style: TextButton.styleFrom(
shape: const BeveledRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(7.0)),
),
),
onPressed: () {
// The login screen is immediately displayed on top of
// the Shrine home screen using onGenerateRoute and so
// rootNavigator must be set to true in order to get out
// of Shrine completely.
Navigator.of(context, rootNavigator: true).pop();
},
child: Text('CANCEL', style: Theme.of(context).textTheme.bodySmall),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 8.0,
shape: const BeveledRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(7.0)),
),
),
onPressed: () {
Navigator.pop(context);
},
child: Text('NEXT', style: Theme.of(context).textTheme.bodySmall),
),
],
),
],
),
),
);
}
}
class PrimaryColorOverride extends StatelessWidget {
const PrimaryColorOverride({super.key, this.color, this.child});
final Color? color;
final Widget? child;
@override
Widget build(BuildContext context) {
return Theme(
data: Theme.of(context).copyWith(primaryColor: color),
child: child!,
);
}
}
| flutter/dev/integration_tests/flutter_gallery/lib/demo/shrine/login.dart/0 | {
"file_path": "flutter/dev/integration_tests/flutter_gallery/lib/demo/shrine/login.dart",
"repo_id": "flutter",
"token_count": 2333
} | 689 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
class TextStyleItem extends StatelessWidget {
const TextStyleItem({
super.key,
required this.name,
required this.style,
required this.text,
});
final String name;
final TextStyle style;
final String text;
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final TextStyle nameStyle = theme.textTheme.bodySmall!.copyWith(color: theme.textTheme.bodySmall!.color);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
width: 72.0,
child: Text(name, style: nameStyle),
),
Expanded(
child: Text(text, style: style.copyWith(height: 1.0)),
),
],
),
);
}
}
class TypographyDemo extends StatelessWidget {
const TypographyDemo({super.key});
static const String routeName = '/typography';
@override
Widget build(BuildContext context) {
final TextTheme textTheme = Theme.of(context).textTheme;
final List<Widget> styleItems = <Widget>[
TextStyleItem(name: 'Display Large', style: textTheme.displayLarge!, text: 'Regular 57/64 +0'),
TextStyleItem(name: 'Display Medium', style: textTheme.displayMedium!, text: 'Regular 45/52 +0'),
TextStyleItem(name: 'Display Small', style: textTheme.displaySmall!, text: 'Regular 36/44 +0'),
TextStyleItem(name: 'Headline Large', style: textTheme.headlineLarge!, text: 'Regular 32/40 +0'),
TextStyleItem(name: 'Headline Medium', style: textTheme.headlineMedium!, text: 'Regular 28/36 +0'),
TextStyleItem(name: 'Headline Small', style: textTheme.headlineSmall!, text: 'Regular 24/32 +0'),
TextStyleItem(name: 'Title Large', style: textTheme.titleLarge!, text: 'Medium 22/28 +0'),
TextStyleItem(name: 'Title Medium', style: textTheme.titleMedium!, text: 'Medium 16/24 +0.15'),
TextStyleItem(name: 'Title Small', style: textTheme.titleSmall!, text: 'Medium 14/20 +0.1'),
TextStyleItem(name: 'Body Large', style: textTheme.bodyLarge!, text: 'Regular 16/24 +0.5'),
TextStyleItem(name: 'Body Medium', style: textTheme.bodyMedium!, text: 'Regular 14/20 +0.25'),
TextStyleItem(name: 'Body Small', style: textTheme.bodySmall!, text: 'Regular 12/16 +0.4'),
TextStyleItem(name: 'Label Large', style: textTheme.labelLarge!, text: 'Medium 14/20 +0.1'),
TextStyleItem(name: 'Label Medium', style: textTheme.labelMedium!, text: 'Medium 12/16 +0.5'),
TextStyleItem(name: 'Label Small', style: textTheme.labelSmall!, text: 'Medium 11/16 +0.5'),
];
return Scaffold(
appBar: AppBar(title: const Text('Typography')),
body: SafeArea(
top: false,
bottom: false,
child: Scrollbar(
child: ListView(
primary: true,
children: styleItems,
),
),
),
);
}
}
| flutter/dev/integration_tests/flutter_gallery/lib/demo/typography_demo.dart/0 | {
"file_path": "flutter/dev/integration_tests/flutter_gallery/lib/demo/typography_demo.dart",
"repo_id": "flutter",
"token_count": 1210
} | 690 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
typedef UpdateUrlFetcher = Future<String?> Function();
class Updater extends StatefulWidget {
const Updater({ required this.updateUrlFetcher, this.child, super.key });
final UpdateUrlFetcher updateUrlFetcher;
final Widget? child;
@override
State createState() => UpdaterState();
}
class UpdaterState extends State<Updater> {
@override
void initState() {
super.initState();
_checkForUpdates();
}
static DateTime? _lastUpdateCheck;
Future<void> _checkForUpdates() async {
// Only prompt once a day
if (_lastUpdateCheck != null &&
DateTime.now().difference(_lastUpdateCheck!) < const Duration(days: 1)) {
return; // We already checked for updates recently
}
_lastUpdateCheck = DateTime.now();
final String? updateUrl = await widget.updateUrlFetcher();
if (mounted) {
final bool? wantsUpdate = await showDialog<bool>(context: context, builder: _buildDialog);
if (wantsUpdate != null && updateUrl != null && wantsUpdate) {
launchUrl(Uri.parse(updateUrl));
}
}
}
Widget _buildDialog(BuildContext context) {
final ThemeData theme = Theme.of(context);
final TextStyle dialogTextStyle =
theme.textTheme.titleMedium!.copyWith(color: theme.textTheme.bodySmall!.color);
return AlertDialog(
title: const Text('Update Flutter Gallery?'),
content: Text('A newer version is available.', style: dialogTextStyle),
actions: <Widget>[
TextButton(
child: const Text('NO THANKS'),
onPressed: () {
Navigator.pop(context, false);
},
),
TextButton(
child: const Text('UPDATE'),
onPressed: () {
Navigator.pop(context, true);
},
),
],
);
}
@override
Widget build(BuildContext context) => widget.child!;
}
| flutter/dev/integration_tests/flutter_gallery/lib/gallery/updater.dart/0 | {
"file_path": "flutter/dev/integration_tests/flutter_gallery/lib/gallery/updater.dart",
"repo_id": "flutter",
"token_count": 779
} | 691 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_gallery/demo/material/text_form_field_demo.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('validates name field correctly', (WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp(home: TextFormFieldDemo()));
final Finder submitButton = find.widgetWithText(ElevatedButton, 'SUBMIT');
expect(submitButton, findsOneWidget);
final Finder nameField = find.widgetWithText(TextFormField, 'Name *');
expect(nameField, findsOneWidget);
final Finder phoneNumberField = find.widgetWithText(TextFormField, 'Phone Number *');
expect(phoneNumberField, findsOneWidget);
final Finder passwordField = find.widgetWithText(TextFormField, 'Password *');
expect(passwordField, findsOneWidget);
// Verify that the phone number's TextInputFormatter does what's expected.
await tester.enterText(phoneNumberField, '1234567890');
await tester.pumpAndSettle();
expect(find.text('(123) 456-7890'), findsOneWidget);
await tester.enterText(nameField, '');
await tester.pumpAndSettle();
// The submit button isn't initially visible. Drag it into view so that
// it will see the tap.
await tester.drag(nameField, const Offset(0.0, -1200.0));
await tester.pumpAndSettle();
await tester.tap(submitButton);
await tester.pumpAndSettle();
// Now drag the password field (the submit button will be obscured by
// the snackbar) and expose the name field again.
await tester.drag(passwordField, const Offset(0.0, 1200.0));
await tester.pumpAndSettle();
expect(find.text('Name is required.'), findsOneWidget);
expect(find.text('Please enter only alphabetical characters.'), findsNothing);
await tester.enterText(nameField, '#');
await tester.pumpAndSettle();
// Make the submit button visible again (by dragging the name field), so
// it will see the tap.
await tester.drag(nameField, const Offset(0.0, -1200.0));
await tester.tap(submitButton);
await tester.pumpAndSettle();
expect(find.text('Name is required.'), findsNothing);
expect(find.text('Please enter only alphabetical characters.'), findsOneWidget);
await tester.enterText(nameField, 'Jane Doe');
await tester.tap(submitButton);
await tester.pumpAndSettle();
expect(find.text('Name is required.'), findsNothing);
expect(find.text('Please enter only alphabetical characters.'), findsNothing);
});
}
| flutter/dev/integration_tests/flutter_gallery/test/demo/material/text_form_field_demo_test.dart/0 | {
"file_path": "flutter/dev/integration_tests/flutter_gallery/test/demo/material/text_form_field_demo_test.dart",
"repo_id": "flutter",
"token_count": 866
} | 692 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('scrolling performance test', () {
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
});
tearDownAll(() async {
driver.close();
});
test('measure', () async {
await driver.tap(find.text('Material'));
final SerializableFinder demoList = find.byValueKey('GalleryDemoList');
// TODO(eseidel): These are very artificial scrolls, we should use better
// https://github.com/flutter/flutter/issues/3316
// Scroll down
for (int i = 0; i < 5; i++) {
await driver.scroll(demoList, 0.0, -300.0, const Duration(milliseconds: 300));
await Future<void>.delayed(const Duration(milliseconds: 500));
}
// Scroll up
for (int i = 0; i < 5; i++) {
await driver.scroll(demoList, 0.0, 300.0, const Duration(milliseconds: 300));
await Future<void>.delayed(const Duration(milliseconds: 500));
}
}, timeout: Timeout.none);
});
}
| flutter/dev/integration_tests/flutter_gallery/test_driver/scroll_perf_web_test.dart/0 | {
"file_path": "flutter/dev/integration_tests/flutter_gallery/test_driver/scroll_perf_web_test.dart",
"repo_id": "flutter",
"token_count": 476
} | 693 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withInputStream { stream ->
localProperties.load(stream)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdk 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.yourcompany.flavors"
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode 1
versionName "1.0"
}
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
| flutter/dev/integration_tests/gradle_deprecated_settings/android/app/build.gradle/0 | {
"file_path": "flutter/dev/integration_tests/gradle_deprecated_settings/android/app/build.gradle",
"repo_id": "flutter",
"token_count": 438
} | 694 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter_driver/driver_extension.dart';
typedef DriverHandler = Future<String> Function();
/// Wraps a flutter driver [DataHandler] with one that waits until a delegate is set.
///
/// This allows the driver test to call [FlutterDriver.requestData] before the handler was
/// set by the app in which case the requestData call will only complete once the app is ready
/// for it.
class FutureDataHandler {
final Map<String, Completer<DriverHandler>> _handlers = <String, Completer<DriverHandler>>{};
/// Registers a lazy handler that will be invoked on the next message from the driver.
Completer<DriverHandler> registerHandler(String key) {
_handlers[key] = Completer<DriverHandler>();
return _handlers[key]!;
}
Future<String> handleMessage(String? message) async {
if (_handlers[message] == null) {
return 'Unsupported driver message: $message.\n'
'Supported messages are: ${_handlers.keys}.';
}
final DriverHandler handler = await _handlers[message]!.future;
return handler();
}
}
FutureDataHandler driverDataHandler = FutureDataHandler();
| flutter/dev/integration_tests/hybrid_android_views/lib/future_data_handler.dart/0 | {
"file_path": "flutter/dev/integration_tests/hybrid_android_views/lib/future_data_handler.dart",
"repo_id": "flutter",
"token_count": 388
} | 695 |
name: ios_add2app_life_cycle_flutter
description: A new flutter module project.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
#
# This version is used _only_ for the Runner app, which is used if you just do
# a `flutter run` or a `flutter make-host-app-editable`. It has no impact
# on any other native host app that you embed your Flutter project into.
version: 1.0.0+1
environment:
sdk: '>=3.2.0-0 <4.0.0'
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: 1.0.6
characters: 1.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
collection: 1.18.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
material_color_utilities: 0.8.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
meta: 1.12.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
async: 2.11.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
boolean_selector: 2.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
clock: 1.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
fake_async: 1.3.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
leak_tracker: 10.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
leak_tracker_flutter_testing: 3.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
leak_tracker_testing: 3.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
matcher: 0.12.16+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
path: 1.9.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_span: 1.10.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stack_trace: 1.11.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stream_channel: 2.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.7.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vm_service: 14.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add Flutter specific assets to your application, add an assets section,
# like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add Flutter specific custom fonts to your application, add a fonts
# section here, in this "flutter" section. Each entry in this list should
# have a "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
# This section identifies your Flutter project as a module meant for
# embedding in a native host app. These identifiers should _not_ ordinarily
# be changed after generation - they are used to ensure that the tooling can
# maintain consistency when adding or modifying assets and plugins.
# They also do not have any bearing on your native host application's
# identifiers, which may be completely independent or the same as these.
module:
androidPackage: com.example.iosadd2appflutter
iosBundleIdentifier: com.example.iosAdd2appFlutter
# PUBSPEC CHECKSUM: 2ed7
| flutter/dev/integration_tests/ios_add2app_life_cycle/flutterapp/pubspec.yaml/0 | {
"file_path": "flutter/dev/integration_tests/ios_add2app_life_cycle/flutterapp/pubspec.yaml",
"repo_id": "flutter",
"token_count": 1721
} | 696 |
{
"images" : [
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | flutter/dev/integration_tests/ios_app_with_extensions/ios/watch Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json/0 | {
"file_path": "flutter/dev/integration_tests/ios_app_with_extensions/ios/watch Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json",
"repo_id": "flutter",
"token_count": 261
} | 697 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <Flutter/Flutter.h>
#import "DualFlutterViewController.h"
@interface DualFlutterViewController ()
@end
@implementation DualFlutterViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Dual Flutter Views";
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]
initWithTitle:@"Back"
style:UIBarButtonItemStylePlain
target:nil
action:nil];
UIStackView* stackView = [[UIStackView alloc] initWithFrame:self.view.frame];
stackView.axis = UILayoutConstraintAxisVertical;
stackView.distribution = UIStackViewDistributionFillEqually;
stackView.layoutMargins = UIEdgeInsetsMake(0, 0, 50, 0);
stackView.layoutMarginsRelativeArrangement = YES;
[self.view addSubview:stackView];
_topFlutterViewController = [[FlutterViewController alloc] init];
_bottomFlutterViewController= [[FlutterViewController alloc] init];
[_topFlutterViewController setInitialRoute:@"marquee_green"];
[self addChildViewController:_topFlutterViewController];
[stackView addArrangedSubview:_topFlutterViewController.view];
[_topFlutterViewController didMoveToParentViewController:self];
[_bottomFlutterViewController setInitialRoute:@"marquee_purple"];
[self addChildViewController:_bottomFlutterViewController];
[stackView addArrangedSubview:_bottomFlutterViewController.view];
[_bottomFlutterViewController didMoveToParentViewController:self];
}
@end
| flutter/dev/integration_tests/ios_host_app/Host/DualFlutterViewController.m/0 | {
"file_path": "flutter/dev/integration_tests/ios_host_app/Host/DualFlutterViewController.m",
"repo_id": "flutter",
"token_count": 682
} | 698 |
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@import XCTest;
static const CGFloat kStandardTimeOut = 60.0;
@interface XCUIElement(Test)
@property (nonatomic, readonly) BOOL flt_hasKeyboardFocus;
- (void)flt_forceTap;
@end
@implementation XCUIElement(Test)
- (BOOL)flt_hasKeyboardFocus {
return [[self valueForKey:@"hasKeyboardFocus"] boolValue];
}
- (void)flt_forceTap {
if (self.isHittable) {
[self tap];
} else {
XCUICoordinate *normalized = [self coordinateWithNormalizedOffset:CGVectorMake(0, 0)];
// The offset is in actual pixels. (1, 1) to make sure tap within the view boundary.
XCUICoordinate *coordinate = [normalized coordinateWithOffset:CGVectorMake(1, 1)];
[coordinate tap];
}
}
@end
@interface PlatformViewUITests : XCTestCase
@property (strong) XCUIApplication *app;
@end
@implementation PlatformViewUITests
- (void)setUp {
[super setUp];
self.continueAfterFailure = NO;
self.app = [[XCUIApplication alloc] init];
[self.app launch];
}
- (void)tearDown {
[self.app terminate];
[super tearDown];
}
- (void)testPlatformViewFocus {
XCUIElement *entranceButton = self.app.buttons[@"platform view focus test"];
XCTAssertTrue([entranceButton waitForExistenceWithTimeout:kStandardTimeOut], @"The element tree is %@", self.app.debugDescription);
[entranceButton tap];
XCUIElement *platformView = self.app.textFields[@"platform_view[0]"];
XCTAssertTrue([platformView waitForExistenceWithTimeout:kStandardTimeOut]);
XCUIElement *flutterTextField = self.app.textFields[@"Flutter Text Field"];
XCTAssertTrue([flutterTextField waitForExistenceWithTimeout:kStandardTimeOut]);
[flutterTextField tap];
XCTAssertTrue([self.app.windows.element waitForExistenceWithTimeout:kStandardTimeOut]);
XCTAssertFalse(platformView.flt_hasKeyboardFocus);
XCTAssertTrue(flutterTextField.flt_hasKeyboardFocus);
// Tapping on platformView should unfocus the previously focused flutterTextField
[platformView tap];
XCTAssertTrue(platformView.flt_hasKeyboardFocus);
XCTAssertFalse(flutterTextField.flt_hasKeyboardFocus);
}
- (void)testPlatformViewZOrder {
XCUIElement *entranceButton = self.app.buttons[@"platform view z order test"];
XCTAssertTrue([entranceButton waitForExistenceWithTimeout:kStandardTimeOut], @"The element tree is %@", self.app.debugDescription);
[entranceButton tap];
XCUIElement *showAlertButton = self.app.buttons[@"Show Alert"];
XCTAssertTrue([showAlertButton waitForExistenceWithTimeout:kStandardTimeOut]);
[showAlertButton tap];
XCUIElement *platformButton = self.app.buttons[@"platform_view[0]"];
XCTAssertTrue([platformButton waitForExistenceWithTimeout:kStandardTimeOut]);
XCTAssertTrue([platformButton.label isEqualToString:@"Initial Button Title"]);
// The `app.otherElements` query fails to query `platform_view[1]` (the background),
// because it is covered by a dialog prompt, which removes semantic nodes underneath.
// The workaround is to set a manual delay here (must be longer than the delay used to
// show the background view on the dart side).
[NSThread sleepForTimeInterval:3];
for (int i = 1; i <= 5; i++) {
[platformButton flt_forceTap];
NSString *expectedButtonTitle = [NSString stringWithFormat:@"Button Tapped %d", i];
XCTAssertTrue([platformButton.label isEqualToString:expectedButtonTitle]);
}
}
@end
| flutter/dev/integration_tests/ios_platform_view_tests/ios/PlatformViewUITests/PlatformViewUITests.m/0 | {
"file_path": "flutter/dev/integration_tests/ios_platform_view_tests/ios/PlatformViewUITests/PlatformViewUITests.m",
"repo_id": "flutter",
"token_count": 1144
} | 699 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.