这段代码很容易
Bitmap bitmap;
View v1 = MyView.getRootView();
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);
Run Code Online (Sandbox Code Playgroud)
并且效果很好,但如果有活动就是这种情况.
如何从服务中截取屏幕截图?
我的目标是在一小时内截取屏幕截图,ei以每小时关闭屏幕,例如在12中然后在1中然后在2中......依此类推
我正在认真考虑使用Greg Young的EvenStore来实现基于事件的系统.但是,我不确定Greg Young的EventStore是否支持Snapshots.快照是我的应用程序的关键要求,因为我们不希望每次都重放所有事件来构造对象状态.
有人可以向我提供有关如何在EventStore中创建快照的示例(Greg Young Version)吗?
假设我有一个A依赖于项目的开发项目B- 该项目目前正在开发中,尚未发布.
所以,在APOM文件中,我有以下部分:
<dependency>
<groupId>com.example</groupId>
<artifactId>project-b</artifactId>
<version>1.0.0-SNAPSHOT</version>
<\dependency>
Run Code Online (Sandbox Code Playgroud)
在工作中,我们有一个远程仓库(Nexus)和一个CI盒(运行Jenkins).
当我的同事改变B并提交给SVN时,Jenkins会选择更改,编译并将其放入远程仓库.大约在那个时候,我可能会B在本地打开,进行更改,编译并将其安装到我的本地仓库中.
B当我尝试mvn clean install A本地时,Maven现在如何解决?
前几天我们弄得一团糟,基本上不得不手动删除本地存储库,以确保我们得到了我们期望获得的版本.所以我现在想弄清楚究竟发生了什么.(因此,如果你有详细文档中的地点的链接,那也将非常感激...)在本地,我有时在我的存储库文件夹中有一些SNAPSHOT版本,一个没有,有几个用什么看起来像SNAPSHOT文件名部分之后的时间戳...
snapshot dependency-management pom.xml maven dependency-resolver
出于某种原因,我无法让Nexus通过默认公共组服务我的SNAPSHOT工件.我已经阅读了Nexus手册的相关内容并搜索了Google,但我所做的一切似乎都无法解决.
我在第4.2节中实现了这些内容.(配置Maven使用单个Nexus组)本手册,所以我的settings.xml如下所示:
<settings>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://my-server/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
Run Code Online (Sandbox Code Playgroud)
一切都工作正常,直到我开始在干净的机器上构建东西(即我没有构建任何SNAPSHOT项目的东西)并且它不会下载所需的SNAPSHOT依赖项.Maven给了我以下内容:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyCo Actions Base Classes 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://my-sever/nexus/content/groups/public/com/myco/testing/1.0.0-SNAPSHOT/maven-metadata.xml
Downloading: http://my-sever/nexus/content/groups/public/com/myco/testing/1.0.0-SNAPSHOT/maven-metadata.xml
Downloading: http://my-sever/nexus/content/groups/public/com/myco/testing/1.0.0-SNAPSHOT/testing-1.0.0-SNAPSHOT.pom
[WARNING] The POM for com.myco:testing:jar:1.0.0-SNAPSHOT is missing, no dependency information available
Downloading: …Run Code Online (Sandbox Code Playgroud) 我可以调用aws rds describe-db-snapshots --db-instance-identifier {my_db_instance}和排序所有自动快照以查找最近创建的快照,但我希望有人有更好的想法.
childVC到parentVCchildVC.view为什么?
我刚刚遇到一个奇怪的行为,我想知道它是否正常或是否是一个bug.
我有一个视图控制器childVC,它是一个孩子parentVC.创建父/子关系时,我的代码是
[parentVC addChildViewController:childVC] ;
[parentVC.view addSubview:childVC.view] ;
[childVC didMoveToParentViewController: parentVC] ;
Run Code Online (Sandbox Code Playgroud)
几行,我想创建一个快照childVC.view.我的代码是
UIView * view = childVC.view ;
UIGraphicsBeginImageContextWithOptions(view.contentSize, NO, 0);
{
[...]
[view drawViewHierarchyInRect:view.bounds
afterScreenUpdates:YES];
image = UIGraphicsGetImageFromCurrentImageContext();
[...]
}
UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)
然后我有错误:
*由于未捕获的异常'UIViewControllerHierarchyInconsistency'终止应用程序,原因:'子视图控制器:应该有父视图控制器:( null)但实际的父级是:'*第一次抛出调用堆栈:(0 CoreFoundation 0x0260b466 __exceptionPreprocess + 182 1 libobjc.A .dylib
0x02290a97 objc_exception_throw + 44 2 CoreFoundation
0x0260b38d + [NSException raise:format:] + 141 3 UIKit
0x01136710 - [UIView(Hierarchy)_associatedViewControllerForwardsAppearanceCallbacks:performHierarchyCheck:isRoot:] + …
我在UI测试期间遇到以下错误(使用iPhone 6的模拟器):
Assertion Failure: UI Testing Failure - Failure getting snapshot Error
Domain=XCTestManagerErrorDomain Code=9 "Error -25204 getting snapshot
for element <AXUIElement 0x7fbd6be217d0> {pid=6874}"
UserInfo={NSLocalizedDescription=Error -25204 getting snapshot for
element <AXUIElement 0x7fbd6be217d0> {pid=6874}}
<unknown>:0: error: -[*screen name*] : UI Testing Failure - Failure
getting snapshot Error Domain=XCTestManagerErrorDomain Code=9 "Error
-25204 getting snapshot for element <AXUIElement 0x7fbd6be217d0> {pid=6874}" UserInfo={NSLocalizedDescription=Error -25204 getting
snapshot for element <AXUIElement 0x7fbd6be217d0> {pid=6874}}
Run Code Online (Sandbox Code Playgroud)
场景类似于UI测试正常工作的其他场景.所以,我不确定为什么在某些元素上获取快照时出错.
我使用辅助功能检查器进行了检查,所有元素似乎都有一个标识符.
这与Xcode版本7.3(7D175).
我打算创建快照测试,但一开始就遇到了问题。
我在运行测试时遇到这样的错误:
/Users/illia/WebstormProjects/TESTS/node_modules/jest/node_modules/jest-cli/build/cli/index.js:161
if (error?.stack) {
^
SyntaxError: Unexpected token '.'
Run Code Online (Sandbox Code Playgroud)
在测试文件中我没有错误
import renderer from 'react-test-renderer';
import PaymentDisclaimer from './PaymentDisclaimer';
it('renders correctly when all default props', () => {
const tree = renderer.create(<PaymentDisclaimer fullPrice={9} />).toJSON();
expect(tree).toMatchSnapshot();
});
Run Code Online (Sandbox Code Playgroud)
套餐:
"react-test-renderer": "^18.2.0",
"jest": "^29.0.3",
"ts-jest": "^29.0.1", (was installed as possible solution)
Run Code Online (Sandbox Code Playgroud) 这是场景:
两个Maven 3项目构建.
Build 1具有部署到Nexus的快照jar.
Build 2依赖于快照,引用类似1.0.0-SNAPSHOT,使用该mvn clean package assembly:single命令打包并压缩.
我们遇到的问题:偶尔在创建程序集时,jar的MANIFEST文件有时会说some.jar.1.0.0-SNAPSHOT,有时它会说some.jar.1.0.0-datetime戳,因此导致类未定义错误.
有没有办法在清单文件中阻止此命名问题?
- 编辑 -
进一步的研究发现了以下内容:
"如果快照是从一个仓库解决的,那么它将被加上时间戳,如果它来自反应堆或本地仓库,那么它将是-SNAPSHOT.该插件调用maven解析逻辑,因此这是核心maven行为."
这是正在遇到的确切问题.第二个构建清单文件总是有一个./lib/Framework-1.0.0-SNAPSHOT.jar条目,其中实际的jar文件名在./lib/Framework-1.0.0-SNAPSHOT.jar和./lib/之间变化Framework-1.0.0-timestamp.jar基于上面的引用.
所以我正在为我的Item组件编写一个测试ItemCard,然后尝试渲染该组件,然后使用该包装器创建快照,但是它返回一个空ShallowWrapper {}
请查看代码以获取更多信息:
Item.test.js
import { shallow } from 'enzyme';
import { ItemCard } from '../Item';
const fakeItem = {
id: 'aksnfj23',
title: 'Fake Coat',
price: '40000',
description: 'This is suuuper fake...',
image: 'fakecoat.jpg',
largeImage: 'largefakecoat.jpg',
};
describe('<ItemCard/>', () => {
it('renders and matches the snapshot', () => {
const wrapper = shallow(<ItemCard me item={fakeItem} showButtons />);
// console.log(wrapper.debug());
expect(wrapper).toMatchSnapshot();
});
});
Run Code Online (Sandbox Code Playgroud)
它创建的快照:
// Jest Snapshot v1
exports[`<ItemCard/> renders and matches the snapshot 1`] = `ShallowWrapper {}`; …Run Code Online (Sandbox Code Playgroud) snapshot ×10
maven ×3
testing ×3
ios ×2
jestjs ×2
nexus ×2
reactjs ×2
android ×1
capture ×1
enzyme ×1
image ×1
javascript ×1
objective-c ×1
parent-child ×1
pom.xml ×1
screenshot ×1